This program is part of QOBLIB - Quantum Optimization Benchmarking Library and is designed to verify solutions to Network Design Problems. It checks whether a proposed network topology satisfies degree constraints and correctly routes flows according to demand.
Design a network with N nodes (between 5 and 24) where each node has exactly two incoming and two outgoing connections. The objective is to minimize the maximum aggregate flow on any edge while routing traffic according to a demand matrix.
Given an instance size, demand matrix, and solution file, this checker:
- Parses the Gurobi-format solution file.
- Validates degree constraints (each node has exactly 2 in-edges and 2 out-edges).
- Verifies flow conservation for each commodity at each node.
- Checks that flows only use existing edges.
- Computes the maximum aggregate flow and verifies it matches the objective.
This program does not check for optimality.
The checker reads Gurobi solution files with the following format:
# Solution for model obj
# Objective value = 65500
z 65500
x#1#5 0
x#1#4 0
x#1#3 1
...
f#1#2#5 21000
f#1#2#4 0
...
Where:
zis the objective value (maximum flow on any edge, scaled by 1000)x#i#jis 1 if there's an edge from node i to node j, 0 otherwisef#k#i#jis the amount of flow for commodity k on edge (i,j), scaled by 1000
First, build the checker using Cargo:
cargo build --release./target/release/check_network <instance_size> <demand_file> <solution_file>instance_size: Number of nodes (e.g., 5 for network05)demand_file: Path to the demand matrix filesolution_file: Path to the solution file
Check a single solution:
./target/release/check_network 5 ../instances/demand.txt ../solutions/network05.opt.solCheck all solutions:
./check_all.shThe checker validates:
- Degree constraints: Each node has exactly in-degree = 2 and out-degree = 2
- Flow conservation: For each commodity k at each node i (i ≠ k), the net flow equals the demand
- Flow capacity: Flows can only use edges where x[i,j] = 1
- Objective value: The maximum aggregate flow matches the reported objective
If all checks pass:
Solution is valid
Otherwise, specific constraint violations are reported.
- 0: Solution is valid
- 1: Solution is invalid
- 2: Error (e.g., file not found, parsing error)
Part of QOBLIB, released under Apache 2.0.
Maximilian Schicker © 2025