This repository solves the Radio Link Frequency Assignment Problem (RLFAP) by modeling it as a Constraint Satisfaction Problem (CSP).
Each radio link is a variable with an allowed set of frequencies (domain). Constraints between pairs of links enforce minimum separation, using operators like <, >, = depending on the instance specification.
parse_files(...): parses the three RLFA instance files (variables, domains, constraints).RLFAclass: extends a generic CSP and builds aconstraints_mapkeyed by(Xi, Xj)for fast constraint lookup.
- FC + MRV: Forward Checking with Minimum Remaining Values variable ordering.
- MAC + dom/wdeg: Maintain Arc Consistency with a dom/wdeg variable heuristic.
- Includes a modified revise/AC-3 pipeline that can update constraint weights on domain wipe-out.
- FC-CBJ + dom/wdeg: Forward Checking with Conflict-Directed Backjumping, implemented from scratch.
- Prints a results table including:
- runtime,
- number of assignments (visited nodes),
- number of constraint checks,
- solved/unsolved,
- and TIMEOUT if execution exceeds the time limit (1 minute).
rlfa.py— main runner: loads an instance, runs solvers, prints metricscsp.py,search.py,utils.py— CSP/search utilities (AIMA-based)sortedcontainers/— vendored dependency used by the implementationrlfap/— RLFA benchmark instances (variables/domains/constraints files)
- Choose the instance files inside
rlfa.py(currently selected inmain). - Run:
python rlfa.py
# or (linux)
python3 rlfa.py