79 template <
typename captype,
typename tcaptype,
typename flowtype>
class Energy:
public Graph<captype,tcaptype,flowtype>
99 Energy(
int var_num_max,
int edge_num_max,
void (*err_function)(
const char *) = NULL);
123 Value E00, Value E01,
124 Value E10, Value E11);
139 Value E000, Value E001,
140 Value E010, Value E011,
141 Value E100, Value E101,
142 Value E110, Value E111);
163 void (*error_function)(
const char *);
186 template <
typename captype,
typename tcaptype,
typename flowtype>
190 error_function = err_function;
193 template <
typename captype,
typename tcaptype,
typename flowtype>
196 template <
typename captype,
typename tcaptype,
typename flowtype>
200 template <
typename captype,
typename tcaptype,
typename flowtype>
203 template <
typename captype,
typename tcaptype,
typename flowtype>
210 template <
typename captype,
typename tcaptype,
typename flowtype>
255 template <
typename captype,
typename tcaptype,
typename flowtype>
257 Value E000, Value E001,
258 Value E010, Value E011,
259 Value E100, Value E101,
260 Value E110, Value E111)
262 register Value pi = (E000 + E011 + E101 + E110) - (E100 + E010 + E001 + E111);
263 register Value delta;
268 Econst += E111 - (E011 + E101 + E110);
274 delta = (E010 + E001) - (E000 + E011);
278 delta = (E100 + E001) - (E000 + E101);
282 delta = (E100 + E010) - (E000 + E110);
297 Econst += E000 - (E100 + E010 + E001);
303 delta = (E110 + E101) - (E100 + E111);
307 delta = (E110 + E011) - (E010 + E111);
311 delta = (E101 + E011) - (E001 + E111);
323 template <
typename captype,
typename tcaptype,
typename flowtype>
327 template <
typename captype,
typename tcaptype,
typename flowtype>
void add_term2(Var x, Var y, Value E00, Value E01, Value E10, Value E11)
Definition: energy.h:211
void add_constant(Value E)
Definition: energy.h:201
void add_edge(node_id i, node_id j, captype cap, captype rev_cap)
Definition: graph.h:400
node_id add_node(int num=1)
Definition: graph.h:360
void add_term3(Var x, Var y, Var z, Value E000, Value E001, Value E010, Value E011, Value E100, Value E101, Value E110, Value E111)
Definition: energy.h:256
int node_id
Definition: graph.h:63
void add_term1(Var x, Value E0, Value E1)
Definition: energy.h:204
void add_tweights(node_id i, tcaptype cap_source, tcaptype cap_sink)
Definition: graph.h:388
GraphT::node_id Var
Definition: energy.h:83
flowtype TotalValue
Definition: energy.h:91
flowtype maxflow(bool reuse_trees=false, Block< node_id > *changed_list=NULL)
Definition: maxflow.cpp:475
Energy(int var_num_max, int edge_num_max, void(*err_function)(const char *)=NULL)
Definition: energy.h:187
captype Value
Definition: energy.h:90
TotalValue minimize()
Definition: energy.h:324
termtype what_segment(node_id i, termtype default_segm=SOURCE)
Definition: graph.h:478
Var add_variable(int num=1)
Definition: energy.h:197
int get_var(Var x)
Definition: energy.h:328
~Energy()
Definition: energy.h:194