pub fn csp_lagrangian(
from: &[usize],
to: &[usize],
w_cost: &[f64],
w_res: &[f64],
n_nodes: usize,
source: usize,
target: usize,
budget: f64,
max_iter: usize,
) -> Option<LagrangianRoute>Expand description
Constrained shortest path by Lagrangian relaxation (the LARAC algorithm):
minimize cost subject to resource <= budget, dualizing the constraint so
each iteration is a plain Dijkstra on cost + lambda * resource. A binary
search on the two support paths (cheapest-infeasible and
feasible-so-far) drives lambda to the maximizer of the dual, which takes
few iterations and scales to graphs where exact label-setting is slow.
Returns the best feasible path found with the best dual lower bound on
the optimal cost: when cost == lower_bound the path is provably
optimal; otherwise it is feasible and within cost - lower_bound of the
optimum (the duality gap — close it with pareto_paths, which is
exact). Returns None when the target is unreachable or no path fits the
budget.