25 bool converged =
false;
27 while (!converged && cycle < max_cycles_) {
28 bool any_changed =
false;
29 for (
int alpha = 0; alpha < num_labels; ++alpha) {
32 if (!any_changed) converged =
true;
Performs alpha-expansion moves on an EnergyModel using a pluggable max-flow solver.
Definition AlphaExpansion.hpp:20
bool perform_expansion_move(const int alpha_label) const
Attempts a single alpha-expansion move for alpha_label.
Definition AlphaExpansion.hpp:41
Stores the graph and energy costs for the Alpha-Expansion algorithm.
Definition EnergyModel.hpp:17
int num_labels() const
Returns the total number of labels.
Definition EnergyModel.hpp:35
Abstract base class for alpha-expansion iteration strategies.
Definition ExpansionStrategy.hpp:32
Expansion strategy that cycles through labels in fixed order 0, 1, …, K-1.
Definition SequentialStrategy.hpp:14
SequentialStrategy(int max_cycles=100)
Constructs the strategy.
Definition SequentialStrategy.hpp:18
int execute(AlphaExpansion< T > &optimizer, EnergyModel< T > &model) const override
Runs sequential alpha-expansion until convergence or max_cycles.
Definition SequentialStrategy.hpp:22