Performs alpha-expansion moves on an EnergyModel using a pluggable max-flow solver.
More...
#include <AlphaExpansion.hpp>
template<typename T>
class AlphaExpansion< T >
Performs alpha-expansion moves on an EnergyModel using a pluggable max-flow solver.
An AlphaExpansion object holds a reference to an EnergyModel and a factory function that creates a new MaxFlowSolver for each expansion move. The model must outlive the optimizer, so do not destroy the model while the optimizer is still being used.
The optimizer is usually driven by an ExpansionStrategy, which decides the order of label expansions and when to stop.
- Template Parameters
-
| T | Numeric cost type. Must match the type of the associated EnergyModel<T>. |
◆ SolverFactory
Factory function that creates a new solver instance.
- Parameters
-
| num_vars | Number of binary variables (active nodes in the expansion subgraph). |
| num_edges | Estimated number of edges (used for pre-allocation; may be exceeded). |
◆ AlphaExpansion()
Constructs the optimizer.
- Parameters
-
| model | Energy model to optimize. Must outlive this object. |
| solver_factory | Factory used to create a fresh solver for each expansion move. |
◆ perform_expansion_move()
template<typename T >
| bool AlphaExpansion< T >::perform_expansion_move |
( |
const int |
alpha_label | ) |
const |
|
inline |
Attempts a single alpha-expansion move for alpha_label.
Builds the binary subgraph for alpha_label and runs max-flow. If the resulting label assignment reduces the total energy, it is applied to the model.
- Parameters
-
| alpha_label | The label to expand (0 ≤ alpha_label < num_labels). |
- Returns
true if any node's label changed and energy decreased; false otherwise.
The documentation for this class was generated from the following file: