1 /*
2  * Name:    sparse.h
3  * Author:  Pietro Belotti
4  * Purpose: data structures for sparse infeasible LP
5  *
6  * This code is published under the Eclipse Public License (EPL).
7  * See http://www.eclipse.org/legal/epl-v10.html
8  */
9 
10 #ifndef SPARSE_H
11 #define SPARSE_H
12 
13 #define COEFF_TYPE double
14 
15 #define SATD   1
16 #define UNSATD 0
17 
18 #define WEIGHT_STEP 100
19 #define WEIGHT_MAX  10000
20 
21 #define EPSILON 1e-8
22 
23 #define CONCURRENT_FLOPS 10
24 
25 #define PRINTF(x) {printf ("%2i: ", lp->my_id); printf (x);}
26 #define mymax(a,b) ((a) < (b) ? (b) : (a))
27 #define mymin(a,b) ((a) > (b) ? (b) : (a))
28 
29 /*
30  *    Sparse LP
31  *
32  *    contains a sparse description of the coefficient matrix
33  *    (specified by pairs (index, value) and parameters for the rtr
34  *    algorithm
35  *
36  */
37 
38 typedef struct _sparseLP {
39 
40   int       r0,c0; /* no. rows/columns  */
41   int       rk,ck; /* no. rows/columns in this chunk  */
42   int       nnzk;  /* # nonzero  */
43 
44   int         *il; /* inequality length	(nonzero coefficient of j-th row)  */
45   COEFF_TYPE **ic; /* inequality coefficient a_j  */
46   int        **ip; /* inequality index of a_j (i.e., j)  */
47 
48   COEFF_TYPE *rhs; /* right hand side b of ax >= b  */
49   COEFF_TYPE *rlb; /* constraint's lower bound (the b in "b <= ax <= c"), will replace rhs  */
50   COEFF_TYPE *rub; /* constraint's upper bound (the c in "b <= ax <= c"), will replace rhs  */
51 
52   int         *vl; /* variable length (nonzero coefficient of i-th column)  */
53   COEFF_TYPE **vc; /* variable coefficient a_j  */
54   int        **vp; /* variable index of a_j (i.e., j)  */
55 
56   COEFF_TYPE  *lb; /* mandatory lower bound for variables  */
57   COEFF_TYPE  *ub; /*           upper  */
58 
59   int ntaut;       /* number of tautologies (constraints fulfilled by any x in [l,u])  */
60   int niis;        /* number of 0-iis       (            violated                   )  */
61 
62   /*  double *cum_weights;  // cumulated weights  */
63   char *chosen;         /* 1 if constraint is included in the block, 0 otherwise  */
64 
65   char  noprep,    /* no preprocessing  */
66     bigm,          /* only write big-M file  */
67     onedim,        /* one-dimensional search  */
68     locsea,        /* variable local search  */
69     lincool,       /* linear temperature decrease  */
70     norm,          /* normalize solution  */
71     dblrand,       /* use double randomization  */
72     invcool;       /* inverse linear temperature decrease  */
73 
74   int   nIter,     /* number of iterations  */
75     restFreq,      /* restart every this iterations  */
76     blkcard,       /* block cardinality for variable local search (see locsea)  */
77     ncpus,         /* number of parallel threads  */
78     my_id;         /* process identifier  */
79 
80   double alpha,    /* scaling factor of average violation  */
81     beta,          /* convex combination parameter on segment (old temperature, new temperature)  */
82     gammaRate,     /* scaling value of the temperature (decreases either linearly or exponential)  */
83     muRate,        /* controls decrease of block size after non-improving iterations  */
84     timelimit,     /* maximum cpu time  */
85     infinity,      /* infinity  */
86     stretch;       /* elongation of dx0 in one-dimensional optimization  */
87 
88 } sparseLP;
89 
90 void userInterrupt ();
91 
92 #endif
93