|
| | Ratio (const Graph &gra, Fn get_cost) |
| | Construct a new Ratio object.
|
| | Ratio (const Ratio &)=default |
| | Copy constructor.
|
| auto | eval (const auto &edge, const Vec &x) const -> double |
| | Evaluate the constraint function for an edge.
|
| auto | make_weight_fn (const Vec &x) const |
| | Build a weight callable with the iterate bound once.
|
| auto | grad (const auto &edge, const Vec &x) const -> Vec |
| | Compute the gradient of the constraint function.
|
template<typename Graph, typename Fn>
class netoptim_detail::Ratio< Graph, Fn >
Adapter: evaluates the scaling-ratio constraint for one edge.
Provides the eval / grad interface expected by NetworkOracle, adapting a cost function (edge -> (a_ij, a_ji)) to the constraint h_ij(x) = min(pi - a_ji, a_ij - psi) with x = (pi, psi) in log scale.
- Template Parameters
-
| Graph | Type of the directed graph representing matrix sparsity |
| Fn | Type of the cost function (edge -> matrix entry pair) |
template<typename Graph, typename Fn>
Evaluate the constraint function for an edge.
Computes min(pi - a_ji, a_ij - psi) where x = (pi, psi) in log scale. A positive result indicates the constraint is satisfied. The edge parameter is the graph's native edge data (e.g., the (a_ij, a_ji) cost pair from the adjacency structure).
- Parameters
-
| [in] | edge | the matrix entry (edge) to evaluate |
| [in] | x | vector containing (pi, psi) in log scale |
- Returns
- constraint value (positive if satisfied)
template<typename Graph, typename Fn>
Compute the gradient of the constraint function.
Returns a subgradient vector indicating which bound is active: [1.0, 0.0] if the upper bound (pi) is active, or [0.0, -1.0] if the lower bound (psi) is active.
- Parameters
-
| [in] | edge | the matrix entry (edge) for gradient computation |
| [in] | x | vector containing (pi, psi) in log scale |
- Returns
- gradient vector [d/d(pi), d/d(psi)]