-
Notifications
You must be signed in to change notification settings - Fork 0
/
cp_cuts.h
78 lines (60 loc) · 2.03 KB
/
cp_cuts.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef CUT_POOL
#define CUT_POOL
/*! \file CPCuts.h
\brief pool of cutting planes generated by constraint propagation
Maintains a set of cutting planes. Uses a hash table to speedup the search for repeated cuts.
*/
typedef struct _CPCuts CPCuts;
/** @brief creates a cut pool
*
* @param hashSize size of the hash table used to separate cuts in buckets and speed-up the search for repeated cuts
*/
CPCuts *cpc_create( int hashSize );
/** @brief returns the number of cuts stored in CPCuts
*
* @param cp cut pool
*/
int cpc_n_cuts( const CPCuts *cp );
/** @brief Adds a new cut to the cut pool in the format cx <= b. Ignores it if another cut equal to this one was already inserted.
*
* Adds a new cut to the cut pool. Ignores it if another cut equal to this one was already inserted.
*
* @param cp cut pool
* @param nz non-zero variables in cut
* @param idx indexes of non-zero variables
* @param coef coefficients of non-zero variables
* @param rhs right hand side constant
* @return returns 1 if the cut was added, 0 otherwise
*/
char cpc_add_cut( CPCuts *cp, int nz, const int _idx[], const double _coef[], double rhs );
/** @brief Returns the number of non-zeros in cut idxCut
*
* @param cp cut pool
* @param idxCut cut index
**/
int cpc_nz( const CPCuts *cp, int idxCut );
/** @brief returns a vector of column indexes for cut idxCut
*
* @param cp cut pool
* @param idxCut cut index*/
int *cpc_idx( const CPCuts *cp, int idxCut );
/** @brief returns a vector of coefficients for cut idxCut
*
* @param cp cut pool
* @param idxCut cut index*/
double *cpc_coef( const CPCuts *cp, int idxCut );
/** @brief returns the right hand side for cut idxCut
*
* @param cp cut pool
* @param idxCut cut index
* @return right hand side of cut idxCut
* */
double cpc_rhs( const CPCuts *cp, int idxCut );
/** @brief clear all generated cutting planes
* @param cp cut pool
* */
void cpc_clear( CPCuts *cpcuts );
/** @brief frees the memory of cut pool in *pcp and sets *pcp to NULL
*/
void cpc_free( CPCuts **pcp );
#endif