Alpha Expansion Library
C++ library for the Alpha-Expansion graph-cut algorithm with Python bindings
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ORToolsSolver< T > Class Template Reference

MaxFlowSolver backed by Google OR-Tools SimpleMaxFlow. More...

#include <ORToolsSolver.hpp>

Inheritance diagram for ORToolsSolver< T >:
[legend]
Collaboration diagram for ORToolsSolver< T >:
[legend]

Public Member Functions

 ORToolsSolver ()
 
 ~ORToolsSolver () override=default
 
MaxFlowSolver< T >::Var add_variable () override
 Introduces a new binary variable and returns its handle.
 
void add_constant (T E) override
 Adds a constant term to the energy function.
 
void add_edge (int i, int j, T cap, T rev_cap)
 
void add_tweights (int i, T cap_source, T cap_sink)
 
void add_term1 (typename MaxFlowSolver< T >::Var x, T E0, T E1) override
 
void add_term2 (typename MaxFlowSolver< T >::Var x, typename MaxFlowSolver< T >::Var y, T A, T B, T C, T D) override
 
minimize () override
 Minimizes the energy and returns the minimum value.
 
int get_var (typename MaxFlowSolver< T >::Var x) override
 
- Public Member Functions inherited from MaxFlowSolver< T >
virtual ~MaxFlowSolver ()=default
 
virtual void add_term1 (Var x, T E0, T E1)=0
 Adds a unary term E(x) where x ∈ {0, 1}.
 
virtual void add_term2 (Var x, Var y, T E00, T E01, T E10, T E11)=0
 Adds a pairwise term E(x, y) where x, y ∈ {0, 1}.
 
virtual int get_var (Var x)=0
 Returns the optimal value of variable x (0 or 1) after minimize().
 

Additional Inherited Members

- Public Types inherited from MaxFlowSolver< T >
typedef int Var
 Integer handle identifying a binary variable.
 

Detailed Description

template<typename T>
class ORToolsSolver< T >

MaxFlowSolver backed by Google OR-Tools SimpleMaxFlow.

Available only when the library is built with -DUSE_OR_TOOLS=ON (the default).

Template Parameters
TNumeric cost type. Note: OR-Tools uses integer arc capacities internally, so floating-point values get truncated inside the flow network.

Constructor & Destructor Documentation

◆ ORToolsSolver()

template<typename T >
ORToolsSolver< T >::ORToolsSolver ( )
inline

◆ ~ORToolsSolver()

template<typename T >
ORToolsSolver< T >::~ORToolsSolver ( )
overridedefault

Member Function Documentation

◆ add_constant()

template<typename T >
void ORToolsSolver< T >::add_constant ( E)
inlineoverridevirtual

Adds a constant term to the energy function.

Parameters
EConstant to add.

Implements MaxFlowSolver< T >.

◆ add_edge()

template<typename T >
void ORToolsSolver< T >::add_edge ( int  i,
int  j,
cap,
rev_cap 
)
inline

◆ add_term1()

template<typename T >
void ORToolsSolver< T >::add_term1 ( typename MaxFlowSolver< T >::Var  x,
E0,
E1 
)
inlineoverride

◆ add_term2()

template<typename T >
void ORToolsSolver< T >::add_term2 ( typename MaxFlowSolver< T >::Var  x,
typename MaxFlowSolver< T >::Var  y,
A,
B,
C,
D 
)
inlineoverride

◆ add_tweights()

template<typename T >
void ORToolsSolver< T >::add_tweights ( int  i,
cap_source,
cap_sink 
)
inline

◆ add_variable()

template<typename T >
MaxFlowSolver< T >::Var ORToolsSolver< T >::add_variable ( )
inlineoverridevirtual

Introduces a new binary variable and returns its handle.

Implements MaxFlowSolver< T >.

◆ get_var()

template<typename T >
int ORToolsSolver< T >::get_var ( typename MaxFlowSolver< T >::Var  x)
inlineoverride

◆ minimize()

template<typename T >
T ORToolsSolver< T >::minimize ( )
inlineoverridevirtual

Minimizes the energy and returns the minimum value.

Implements MaxFlowSolver< T >.


The documentation for this class was generated from the following file: