4 #ifndef CoinPresolveMatrix_H
5 #define CoinPresolveMatrix_H
28 #define deleteAction(array,type) delete [] ((type) array)
30 #define deleteAction(array,type) delete [] array
43 #if PRESOLVE_DEBUG || PRESOLVE_CONSISTENCY
44 #define PRESOLVE_STMT(s) s
45 #define PRESOLVEASSERT(x) \
47 ((std::cerr << "FAILED ASSERTION at line " \
48 << __LINE__ << ": " #x "\n"), abort(), 0))
50 inline void DIE(
const char *s) { std::cout<<s; abort(); }
54 #define PRESENT_IN_REDUCED '\377'
58 #define PRESOLVEASSERT(x) {}
59 #define PRESOLVE_STMT(s) {}
61 inline void DIE(
const char *) {}
65 inline int ALIGN(
int n,
int m) {
return (((n + m - 1) / m) * m); }
70 #define COIN_DBL_MAX DBL_MAX
72 #define PRESOLVE_INF COIN_DBL_MAX
143 {
throw CoinError(error, ps_routine,
"CoinPresolve"); }
160 {
next = nextAction;}
166 virtual const char *
name()
const = 0;
182 class OsiSolverInterface;
306 unsigned char & st_byte =
rowstat_[sequence];
307 st_byte =
static_cast<unsigned char>(st_byte & (~7)) ;
308 st_byte =
static_cast<unsigned char>(st_byte | status) ;
315 {
return (static_cast<Status> (
rowstat_[sequence]&7)==
basic);}
319 unsigned char & st_byte =
colstat_[sequence];
320 st_byte =
static_cast<unsigned char>(st_byte & (~7)) ;
321 st_byte =
static_cast<unsigned char>(st_byte | status) ;
323 # ifdef PRESOLVE_DEBUG
327 { std::cout <<
"Bad status: Var " << sequence
328 <<
" isFree, lb = " <<
clo_[sequence]
329 <<
", ub = " <<
cup_[sequence] << std::endl ; }
335 { std::cout <<
"Bad status: Var " << sequence
336 <<
" atUpperBound, lb = " <<
clo_[sequence]
337 <<
", ub = " <<
cup_[sequence] << std::endl ; }
341 { std::cout <<
"Bad status: Var " << sequence
342 <<
" atLowerBound, lb = " <<
clo_[sequence]
343 <<
", ub = " <<
cup_[sequence] << std::endl ; }
347 { std::cout <<
"Bad status: Var " << sequence
348 <<
" superBasic, lb = " <<
clo_[sequence]
349 <<
", ub = " <<
cup_[sequence] << std::endl ; }
361 {
return (static_cast<Status> (
colstat_[sequence]&7)==
basic);}
407 void setColLower(
const double *colLower,
int lenParam) ;
409 void setColUpper(
const double *colUpper,
int lenParam) ;
413 void setCost(
const double *cost,
int lenParam) ;
417 void setRowLower(
const double *rowLower,
int lenParam) ;
419 void setRowUpper(
const double *rowUpper,
int lenParam) ;
421 void setRowPrice(
const double *rowSol,
int lenParam) ;
430 {
return (ncols_) ; }
433 {
return (nrows_) ; }
436 {
return (nelems_) ; }
479 for (
int i = 0 ; i <
ncols_ ; i++)
if (
hincol_[i] == 0) empty++ ;
691 #define NO_LINK -66666666
700 int ipre = link[i].
pre;
701 int isuc = link[i].
suc;
703 link[ipre].
suc = isuc;
706 link[isuc].
pre = ipre;
718 int isuc = link[j].
suc;
740 int ipre = link[i].
pre;
741 int isuc = link[i].
suc;
800 double nonLinearVariable,
815 OsiSolverInterface * si,
820 double nonLinearVariable,
821 const char * prohibited,
853 for (
int i = 0 ; i <
nrows_ ; i++)
if (
hinrow_[i] == 0) empty++ ;
863 integerType_[i] =
static_cast<unsigned char>(variableType) ; }
870 void setVariableType(
const unsigned char *variableType,
int lenParam) ;
910 {
return (
false) ; } }
947 assert(fabs(change_amount)<1.0e50);
1337 unsigned char *colstat,
1338 unsigned char *rowstat);
1356 unsigned char *colstat,
1357 unsigned char *rowstat);
1415 #define PRESOLVEFINITE(n) (-PRESOLVE_INF < (n) && (n) < PRESOLVE_INF)
1439 int *minndxs,
int *majlens,
1448 int *hrow,
int *hincol,
1451 hrow,hincol,clink,ncols,colx) ; }
1459 int *hcol,
int *hinrow,
1462 hcol,hinrow,rlink,nrows,rowx) ; }
1476 for (k = ks ; k < ke ; k++)
1478 {
if (minndxs[k] == tgt)
1482 abort () ;
return -1;
1484 {
if (minndxs[k] == tgt)
1520 const int *minndxs);
1601 int *majlens,
int *minndxs,
double *els)
1607 minndxs[kmi] = minndxs[ke-1] ;
1608 els[kmi] = els[ke-1] ;
1615 int *majlens,
int *minndxs,
double *els)
1621 int iMinor = minndxs[k];
1622 if (!marked[iMinor]) {
1623 minndxs[put]=iMinor;
1629 majlens[majndx] = put-ks ;
1645 int *hincol,
int *hrow,
double *colels)
1660 int *hinrow,
int *hcol,
double *rowels)
1675 int *minndxs,
int *majlinks,
1689 int *hincol,
int *hrow,