|
CProp
Constraint propagation engine for Mixed Integer Programs
|
constraint propagation engine API More...
Go to the source code of this file.
Typedefs | |
| typedef struct _CProp | CProp |
Enumerations | |
| enum | IGNType { EOne, EZero, Infeasible } |
| Implication Graph Node Types. More... | |
Functions | |
| CProp * | cprop_create (int cols, const char integer[], const double lb[], const double ub[], const char **name) |
| creates a new CProp object More... | |
| int | cprop_add_constraint (CProp *cprop, int nz, const int idx[], const double coef[], char sense, double rhs, const char rname[]) |
| adds a new constraint More... | |
| int | cprop_update_bound (CProp *cprop, int j, double l, double u) |
| updates the bounds of a variable More... | |
| void | cprop_undo (CProp *cprop) |
| undo the last bound changed and all its implications More... | |
| char | cprop_feasible (const CProp *cprop) |
| returns 1 if problem is still feasible, zero otherwise More... | |
| const char * | cprop_inf_msg (const CProp *cprop) |
| message explaining how infeasibility was detected More... | |
| int | cprop_n_implications (const CProp *cprop) |
| returns how many implications the last change produced More... | |
| int | cprop_implied_var (const CProp *cprop, int i) |
| returns the i-th variable which bound was implied in the last operation More... | |
| double | cprop_get_lb (const CProp *cprop, int j) |
| returns the current lower bound for column j More... | |
| double | cprop_get_ub (const CProp *cprop, int j) |
| returns the current upper bound for column j More... | |
| enum IGNType | cprop_impl_graph_node_type (const CProp *cprop, int nodeId) |
| returns the node type More... | |
| int | cprop_impl_graph_node_var (const CProp *cprop, int nodeId) |
| returns the variable which a node refers More... | |
| int | cprop_impl_graph_node_id (const CProp *cprop, enum IGNType ntype, int col) |
| returns the node id More... | |
| int | cprop_impl_graph_in_d (const CProp *cprop, int nodeId) |
| number of incident arcs in implication graph node More... | |
| int | cprop_impl_graph_in_neigh (const CProp *cprop, int nodeId, int i) |
| returns the origin of the i-th incident arc to nodeId More... | |
| void | cprop_save_impl_graph (const CProp *cprop, const char *fName) |
| saves the implication graph in the DOT file format (graphviz) More... | |
| int | cprop_n_cuts (const CProp *cprop) |
| returns the number of cuts found processing the last infeasible solution More... | |
| int | cprop_cut_nz (const CProp *cprop, int idxCut) |
| returns the number of variables that appear on cut idxCut More... | |
| const int * | cprop_cut_idx (const CProp *cprop, int idxCut) |
| returns a vector with all columns of cut idxCut More... | |
| const double * | cprop_cut_coef (const CProp *cprop, int idxCut) |
| returns a vector with all coefficients of cut idxCut More... | |
| char | cprop_cut_sense (const CProp *cprop, int idxCut) |
| returns the sense of cut idxCut More... | |
| double | cprop_cut_rhs (const CProp *cprop, int idxCut) |
| returns the right hand side of cut idxCut More... | |
| void | cprop_set_verbose (CProp *cprop, char verbose) |
| activates detailed printing of implications as they are discovered More... | |
| void | cprop_free (CProp **cprop) |
| frees memory of cprop object More... | |
constraint propagation engine API
A simple, solver independent, Constraint Propagation engine for binary programs based on the technical report "Nogood Learning for Mixed Integer Programming", from Sandhol, T. and Shields, R. (2006) [https://www.cs.cmu.edu/~sandholm/nogoodsForMip.techReport06.pdf].
Definition in file cprop.h.
| enum IGNType |
| int cprop_add_constraint | ( | CProp * | cprop, |
| int | nz, | ||
| const int | idx[], | ||
| const double | coef[], | ||
| char | sense, | ||
| double | rhs, | ||
| const char | rname[] | ||
| ) |
adds a new constraint
Adds a new constraint and performs constraint propagation (CP). Returns 0 if not implication was found, -1 if CP indicates that the problem became unfeasible or >0 if new implications (changed variable bounds) were generated. Complexity is O(nz) (unless there are new implications in bounds).
| CProp | constraint propagation object |
| nz | non-zero variables in this constraint |
| idx | indice of each non-zero variable |
| coef | coefficient of each non-zero variable |
| sense | E equal G greater-or-equal L less-or-equal |
| rhs | right-hand-side |
| rname | row name |
| CProp* cprop_create | ( | int | cols, |
| const char | integer[], | ||
| const double | lb[], | ||
| const double | ub[], | ||
| const char ** | name | ||
| ) |
creates a new CProp object
Creates a new Constraint Propagation object entering information about all variables.
| cols | number of variables |
| integer | indicates if each variable is integer or not |
| lb | lower bound of each variable |
| ub | upper bound of each variable |
| name | names of variables, useful for debuging |
| const double* cprop_cut_coef | ( | const CProp * | cprop, |
| int | idxCut | ||
| ) |
returns a vector with all coefficients of cut idxCut
| cprop | constraint propagation object |
| idxCut | cut index |
| const int* cprop_cut_idx | ( | const CProp * | cprop, |
| int | idxCut | ||
| ) |
returns a vector with all columns of cut idxCut
| cprop | constraint propagation object |
| idxCut | cut index |
| int cprop_cut_nz | ( | const CProp * | cprop, |
| int | idxCut | ||
| ) |
returns the number of variables that appear on cut idxCut
| cprop | constraint propagation object |
| idxCut | cut index |
| double cprop_cut_rhs | ( | const CProp * | cprop, |
| int | idxCut | ||
| ) |
returns the right hand side of cut idxCut
| cprop | constraint propagation object |
| idxCut | cut index |
| char cprop_cut_sense | ( | const CProp * | cprop, |
| int | idxCut | ||
| ) |
returns the sense of cut idxCut
| cprop | constraint propagation object |
| idxCut | cut index |
| char cprop_feasible | ( | const CProp * | cprop | ) |
returns 1 if problem is still feasible, zero otherwise
| cprop | constraint propagation object |
| void cprop_free | ( | CProp ** | cprop | ) |
frees memory of cprop object
Frees memory of cprop object and sets it to NULL
| double cprop_get_lb | ( | const CProp * | cprop, |
| int | j | ||
| ) |
returns the current lower bound for column j
| cprop | constraint propagation object |
| j | index of variable |
| double cprop_get_ub | ( | const CProp * | cprop, |
| int | j | ||
| ) |
returns the current upper bound for column j
| cprop | constraint propagation object |
| j | index of variable |
| int cprop_impl_graph_in_d | ( | const CProp * | cprop, |
| int | nodeId | ||
| ) |
number of incident arcs in implication graph node
Returns the number of incident arcs in the implication graph for a node with id nodeId col is ignored if a node of type Infeasible is informed
| cprop | Constraint Propagation Object |
| nodeId | nodeId |
| int cprop_impl_graph_in_neigh | ( | const CProp * | cprop, |
| int | nodeId, | ||
| int | i | ||
| ) |
returns the origin of the i-th incident arc to nodeId
Returns the nodeId of the origin of the i-th incident arc in node nodeId
| cprop | Constraint Propagation Object |
| nodeid | nodeId |
| int cprop_impl_graph_node_id | ( | const CProp * | cprop, |
| enum IGNType | ntype, | ||
| int | col | ||
| ) |
returns the node id
Returns the node id for a node of type ntype related to column col
| cprop | constraint propagation object |
| ntype | node type |
| col | variable (column) index |
| enum IGNType cprop_impl_graph_node_type | ( | const CProp * | cprop, |
| int | nodeId | ||
| ) |
returns the node type
Returns the node type of a node in the implication graph
| cprop | constraint propagation object |
| nodeId | id of the node in the graph |
| int cprop_impl_graph_node_var | ( | const CProp * | cprop, |
| int | nodeId | ||
| ) |
returns the variable which a node refers
Returns the variable thar a node in the implication graph refers to
| cprop | constraint propagation object |
| nodeId | id of the node in the graph |
| int cprop_implied_var | ( | const CProp * | cprop, |
| int | i | ||
| ) |
returns the i-th variable which bound was implied in the last operation
returns the i-th variable which bound was implied in the last operation
| cprop | constraint propagation object |
| i | the i-th variable which a bound was changed was implied in the last operation |
| const char* cprop_inf_msg | ( | const CProp * | cprop | ) |
message explaining how infeasibility was detected
| cprop | constraint propagation object |
| int cprop_n_cuts | ( | const CProp * | cprop | ) |
returns the number of cuts found processing the last infeasible solution
| cprop | constraint propagation object |
| int cprop_n_implications | ( | const CProp * | cprop | ) |
returns how many implications the last change produced
returns how many implications the last action (add constraint or change bound) produced
| cprop | constraint propagation object |
| void cprop_save_impl_graph | ( | const CProp * | cprop, |
| const char * | fName | ||
| ) |
saves the implication graph in the DOT file format (graphviz)
| cprop | constraint propagation object |
| fName | file name (.dot extension recommended) |
| void cprop_set_verbose | ( | CProp * | cprop, |
| char | verbose | ||
| ) |
activates detailed printing of implications as they are discovered
Activates detailed printing of implications and bound changes as they are discovered. Useful to debug.
| cprop | Constraint Propagation Object |
| verbose | if messages will be printed on the screen |
| void cprop_undo | ( | CProp * | cprop | ) |
undo the last bound changed and all its implications
Undo the last bound changed and all its implications. Can be called multiple times (unlimited undo)
| cprop | constraint propagation object |
| int cprop_update_bound | ( | CProp * | cprop, |
| int | j, | ||
| double | l, | ||
| double | u | ||
| ) |
updates the bounds of a variable
Updates the bounds of variable j to [l, u] and performs Constraint Propagation. returns -1 if the problem became unfeasible, 0 if no implications were found or >0 if constraint propagation changed additional bounds all the effects of this bound change can be undone calling cprop_undo.
| CProp | constraint propagation object |
| j | variable index |
| l | lower bound |
| u | upper bound |
1.8.13