#include <digraphx/min_parametric_q.hpp>
template<typename DiGraph, typename Ratio, typename Domain>
MinParametricSolver class
Minimum Parametric Solver with constraint support.
| Template parameters | |
|---|---|
| DiGraph | Type of the directed graph representation |
| Ratio | Type representing the parameter value |
| Domain | Type of the domain for distance calculations |
This class implements algorithms for solving constrained parametric network optimization problems. It extends the basic parametric solver by incorporating constraint handling through callback functions and providing both predecessor and successor-based algorithm variants.
Problem formulation:
min r s.t. dist[v] - dist[u] <= distance(e, r) forall e(u, v) in G(V, E) subject to: update_ok(old_dist, new_dist) == true
Algorithm approach:
- Initialize with starting parameter value
- Use constrained negative cycle detection
- Apply update constraints during relaxation
- Adjust parameter based on violating cycles
- Alternate between predecessor/successor methods
Key innovations:
- Constraint-aware relaxation: Updates validated by callback
- Dual algorithm support: Both forward and reverse relaxation
- Alternating strategy: Improves robustness and convergence
- Early termination: Option to stop after first improvement
Constraint handling: The UpdateOk callback enables sophisticated constraint strategies:
// Example: Only allow significant improvements auto update_ok = [](double old_val, double new_val) { return new_val < old_val - 0.01; // Minimum improvement threshold }; // Example: Bounded updates auto update_ok = [](double old_val, double new_val) { return std::abs(new_val - old_val) <= max_step_size; };
Use cases:
- Resource allocation with capacity constraints
- Economic equilibrium with market frictions
- Network optimization with budget limitations
- Scheduling with time window constraints
Constructors, destructors, conversion operators
- MinParametricSolver(const DiGraph& digraph, MinParametricAPI<Node, Edge, Ratio>& omega)
- Initialize the solver with a graph and parametric API.
Public functions
Function documentation
template<typename DiGraph, typename Ratio, typename Domain>
MinParametricSolver<DiGraph, Ratio, Domain>:: MinParametricSolver(const DiGraph& digraph,
MinParametricAPI<Node, Edge, Ratio>& omega)
Initialize the solver with a graph and parametric API.
| Parameters | |
|---|---|
| digraph | A directed graph where each node maps to its neighbors and the edges connecting them |
| omega | An instance of MinParametricAPI that provides the necessary methods for distance calculation and cycle analysis |
template<typename DiGraph, typename Ratio, typename Domain>
template<typename Mapping>
auto MinParametricSolver<DiGraph, Ratio, Domain>:: run(Mapping& dist,
Ratio ratio,
const UpdateOk& update_ok,
bool pick_one_only = false) -> std::pair< Ratio, Cycle >
Execute the parametric solver algorithm to find the minimum ratio.
| Parameters | |
|---|---|
| dist | A mutable mapping of node distances that will be updated during the algorithm |
| ratio | The initial ratio value to start the optimization from |
| update_ok | A callback function that determines whether a distance update is acceptable |
| pick_one_only | If true, stops after finding the first improving cycle |
| Returns | std::pair<Ratio, Cycle> A pair containing:
|