CoinUtils  2.11.4
CoinPresolveMatrix.hpp
Go to the documentation of this file.
1 /* $Id$ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CoinPresolveMatrix_H
7 #define CoinPresolveMatrix_H
8 
9 #include "CoinPragma.hpp"
10 #include "CoinPackedMatrix.hpp"
11 #include "CoinMessage.hpp"
12 #include "CoinTime.hpp"
13 
14 #include <cmath>
15 #include <cassert>
16 #include <cfloat>
17 #include <cassert>
18 #include <cstdlib>
19 
20 //# define COIN_PRESOLVE_TUNING 2
21 #if PRESOLVE_DEBUG > 0
22 #include "CoinFinite.hpp"
23 #endif
24 
32 #if defined(_MSC_VER)
33 // Avoid MS Compiler problem in recognizing type to delete
34 // by casting to type.
35 // Is this still necessary? -- lh, 111202 --
36 #define deleteAction(array, type) delete[]((type)array)
37 #else
38 #define deleteAction(array, type) delete[] array
39 #endif
40 
41 /*
42  Define PRESOLVE_DEBUG and PRESOLVE_CONSISTENCY on the configure command
43  line or in a Makefile! See comments in CoinPresolvePsdebug.hpp.
44 */
45 #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0
46 
47 #define PRESOLVE_STMT(s) s
48 
49 #define PRESOLVEASSERT(x) \
50  ((x) ? 1 : ((std::cerr << "FAILED ASSERTION at line " << __LINE__ << ": " #x "\n"), abort(), 0))
51 
52 inline void DIE(const char *s)
53 {
54  std::cout << s;
55  abort();
56 }
57 
68 #define PRESENT_IN_REDUCED '\377'
69 
70 #else
71 
72 #define PRESOLVEASSERT(x) \
73  { \
74  }
75 #define PRESOLVE_STMT(s) \
76  { \
77  }
78 
79 inline void DIE(const char *) {}
80 
81 #endif
82 
83 /*
84  Unclear why these are separate from standard debug.
85 */
86 #ifndef PRESOLVE_DETAIL
87 #define PRESOLVE_DETAIL_PRINT(s) \
88  { \
89  }
90 #else
91 #define PRESOLVE_DETAIL_PRINT(s) s
92 #endif
93 
98 const double ZTOLDP = 1e-12;
103 const double ZTOLDP2 = 1e-10;
104 
106 #define PRESOLVE_INF COIN_DBL_MAX
107 #define PRESOLVE_SMALL_INF 1.0e20
109 #define PRESOLVEFINITE(n) (-PRESOLVE_INF < (n) && (n) < PRESOLVE_INF)
111 
112 class CoinPostsolveMatrix;
113 
164 public:
171  static void throwCoinError(const char *error, const char *ps_routine)
172  {
173  throw CoinError(error, ps_routine, "CoinPresolve");
174  }
175 
181 
188  : next(next)
189  {
190  }
192  inline void setNext(const CoinPresolveAction *nextAction)
193  {
194  next = nextAction;
195  }
196 
201  virtual const char *name() const = 0;
202 
206  virtual void postsolve(CoinPostsolveMatrix *prob) const = 0;
207 
209  virtual ~CoinPresolveAction() {}
210 };
211 
212 /*
213  These are needed for OSI-aware constructors associated with
214  CoinPrePostsolveMatrix, CoinPresolveMatrix, and CoinPostsolveMatrix.
215 */
216 class ClpSimplex;
217 class OsiSolverInterface;
218 
219 /*
220  CoinWarmStartBasis is required for methods in CoinPrePostsolveMatrix
221  that accept/return a CoinWarmStartBasis object.
222 */
223 class CoinWarmStartBasis;
224 
280 public:
290  CoinPrePostsolveMatrix(int ncols_alloc, int nrows_alloc,
291  CoinBigIndex nelems_alloc);
292 
297  CoinPrePostsolveMatrix(const OsiSolverInterface *si,
298  int ncols_,
299  int nrows_,
301 
306  CoinPrePostsolveMatrix(const ClpSimplex *si,
307  int ncols_,
308  int nrows_,
310  double bulkRatio);
311 
315 
325  enum Status {
326  isFree = 0x00,
327  basic = 0x01,
328  atUpperBound = 0x02,
329  atLowerBound = 0x03,
330  superBasic = 0x04
331  };
332 
345 
347  inline void setRowStatus(int sequence, Status status)
348  {
349  if (rowstat_ == nullptr) return;
350  unsigned char &st_byte = rowstat_[sequence];
351  st_byte = static_cast< unsigned char >(st_byte & (~7));
352  st_byte = static_cast< unsigned char >(st_byte | status);
353  }
355  inline Status getRowStatus(int sequence) const
356  {
357  return static_cast< Status >(rowstat_[sequence] & 7);
358  }
360  inline bool rowIsBasic(int sequence) const
361  {
362  return (static_cast< Status >(rowstat_[sequence] & 7) == basic);
363  }
365  inline void setColumnStatus(int sequence, Status status)
366  {
367  if (colstat_ == nullptr) return;
368  unsigned char &st_byte = colstat_[sequence];
369  st_byte = static_cast< unsigned char >(st_byte & (~7));
370  st_byte = static_cast< unsigned char >(st_byte | status);
371 
372 #ifdef PRESOLVE_DEBUG
373  switch (status) {
374  case isFree: {
375  if (clo_[sequence] > -PRESOLVE_INF || cup_[sequence] < PRESOLVE_INF) {
376  std::cout << "Bad status: Var " << sequence
377  << " isFree, lb = " << clo_[sequence]
378  << ", ub = " << cup_[sequence] << std::endl;
379  }
380  break;
381  }
382  case basic: {
383  break;
384  }
385  case atUpperBound: {
386  if (cup_[sequence] >= PRESOLVE_INF) {
387  std::cout << "Bad status: Var " << sequence
388  << " atUpperBound, lb = " << clo_[sequence]
389  << ", ub = " << cup_[sequence] << std::endl;
390  }
391  break;
392  }
393  case atLowerBound: {
394  if (clo_[sequence] <= -PRESOLVE_INF) {
395  std::cout << "Bad status: Var " << sequence
396  << " atLowerBound, lb = " << clo_[sequence]
397  << ", ub = " << cup_[sequence] << std::endl;
398  }
399  break;
400  }
401  case superBasic: {
402  if (clo_[sequence] <= -PRESOLVE_INF && cup_[sequence] >= PRESOLVE_INF) {
403  std::cout << "Bad status: Var " << sequence
404  << " superBasic, lb = " << clo_[sequence]
405  << ", ub = " << cup_[sequence] << std::endl;
406  }
407  break;
408  }
409  default: {
410  assert(false);
411  break;
412  }
413  }
414 #endif
415  }
417  inline Status getColumnStatus(int sequence) const
418  {
419  return static_cast< Status >(colstat_[sequence] & 7);
420  }
422  inline bool columnIsBasic(int sequence) const
423  {
424  return (static_cast< Status >(colstat_[sequence] & 7) == basic);
425  }
429  void setRowStatusUsingValue(int iRow);
433  void setColumnStatusUsingValue(int iColumn);
435  void setStructuralStatus(const char *strucStatus, int lenParam);
437  void setArtificialStatus(const char *artifStatus, int lenParam);
439  void setStatus(const CoinWarmStartBasis *basis);
445  const char *columnStatusString(int j) const;
449  const char *rowStatusString(int i) const;
451 
459  void setObjOffset(double offset);
467  void setObjSense(double objSense);
469  void setPrimalTolerance(double primTol);
471  void setDualTolerance(double dualTol);
473  void setColLower(const double *colLower, int lenParam);
475  void setColUpper(const double *colUpper, int lenParam);
477  void setColSolution(const double *colSol, int lenParam);
479  void setCost(const double *cost, int lenParam);
481  void setReducedCost(const double *redCost, int lenParam);
483  void setRowLower(const double *rowLower, int lenParam);
485  void setRowUpper(const double *rowUpper, int lenParam);
487  void setRowPrice(const double *rowSol, int lenParam);
489  void setRowActivity(const double *rowAct, int lenParam);
491 
494  inline int getNumCols() const
496  {
497  return (ncols_);
498  }
500  inline int getNumRows() const
501  {
502  return (nrows_);
503  }
505  inline CoinBigIndex getNumElems() const
506  {
507  return (nelems_);
508  }
510  inline const CoinBigIndex *getColStarts() const
511  {
512  return (mcstrt_);
513  }
515  inline const int *getColLengths() const
516  {
517  return (hincol_);
518  }
520  inline const int *getRowIndicesByCol() const
521  {
522  return (hrow_);
523  }
525  inline const double *getElementsByCol() const
526  {
527  return (colels_);
528  }
530  inline const double *getColLower() const
531  {
532  return (clo_);
533  }
535  inline const double *getColUpper() const
536  {
537  return (cup_);
538  }
540  inline const double *getCost() const
541  {
542  return (cost_);
543  }
545  inline const double *getRowLower() const
546  {
547  return (rlo_);
548  }
550  inline const double *getRowUpper() const
551  {
552  return (rup_);
553  }
555  inline const double *getColSolution() const
556  {
557  return (sol_);
558  }
560  inline const double *getRowActivity() const
561  {
562  return (acts_);
563  }
565  inline const double *getRowPrice() const
566  {
567  return (rowduals_);
568  }
570  inline const double *getReducedCost() const
571  {
572  return (rcosts_);
573  }
575  inline int countEmptyCols()
576  {
577  int empty = 0;
578  for (int i = 0; i < ncols_; i++)
579  if (hincol_[i] == 0)
580  empty++;
581  return (empty);
582  }
584 
587  inline CoinMessageHandler *messageHandler() const
589  {
590  return handler_;
591  }
597  inline void setMessageHandler(CoinMessageHandler *handler)
598  {
599  if (defaultHandler_ == true) {
600  delete handler_;
601  defaultHandler_ = false;
602  }
603  handler_ = handler;
604  }
606  inline CoinMessages messages() const
607  {
608  return messages_;
609  }
611 
621 
623  int ncols_;
625  int nrows_;
628 
630  int ncols0_;
632  int nrows0_;
645  double bulkRatio_;
647 
659  int *hincol_;
661  int *hrow_;
663  double *colels_;
664 
666  double *cost_;
669 
671  double *clo_;
673  double *cup_;
674 
676  double *rlo_;
678  double *rup_;
679 
694 
696  double ztolzb_;
698  double ztoldj_;
699 
705  double maxmin_;
707 
728  double *sol_;
734  double *rowduals_;
740  double *acts_;
746  double *rcosts_;
747 
754  unsigned char *colstat_;
755 
762  unsigned char *rowstat_;
764 
780 };
781 
785 const char *statusName(CoinPrePostsolveMatrix::Status status);
786 
812 public:
813  int pre, suc;
814 };
815 
816 #define NO_LINK -66666666
817 
823 inline void PRESOLVE_REMOVE_LINK(presolvehlink *link, int i)
824 {
825  int ipre = link[i].pre;
826  int isuc = link[i].suc;
827  if (ipre >= 0) {
828  link[ipre].suc = isuc;
829  }
830  if (isuc >= 0) {
831  link[isuc].pre = ipre;
832  }
833  link[i].pre = NO_LINK, link[i].suc = NO_LINK;
834 }
835 
841 inline void PRESOLVE_INSERT_LINK(presolvehlink *link, int i, int j)
842 {
843  int isuc = link[j].suc;
844  link[j].suc = i;
845  link[i].pre = j;
846  if (isuc >= 0) {
847  link[isuc].pre = i;
848  }
849  link[i].suc = isuc;
850 }
851 
863 inline void PRESOLVE_MOVE_LINK(presolvehlink *link, int i, int j)
864 {
865  int ipre = link[i].pre;
866  int isuc = link[i].suc;
867  if (ipre >= 0) {
868  link[ipre].suc = j;
869  }
870  if (isuc >= 0) {
871  link[isuc].pre = j;
872  }
873  link[i].pre = NO_LINK, link[i].suc = NO_LINK;
874 }
875 
908 public:
915  CoinPresolveMatrix(int ncols_alloc, int nrows_alloc,
916  CoinBigIndex nelems_alloc);
917 
922  CoinPresolveMatrix(int ncols0,
923  double maxmin,
924  // end prepost members
925 
926  ClpSimplex *si,
927 
928  // rowrep
929  int nrows,
930  CoinBigIndex nelems,
931  bool doStatus,
932  double nonLinearVariable,
933  double bulkRatio);
934 
936  void update_model(ClpSimplex *si,
937  int nrows0,
938  int ncols0,
939  CoinBigIndex nelems0);
944  CoinPresolveMatrix(int ncols0,
945  double maxmin,
946  // end prepost members
947  OsiSolverInterface *si,
948  // rowrep
949  int nrows,
950  CoinBigIndex nelems,
951  bool doStatus,
952  double nonLinearVariable,
953  const char *prohibited,
954  const char *rowProhibited = NULL);
955 
957  void update_model(OsiSolverInterface *si,
958  int nrows0,
959  int ncols0,
960  CoinBigIndex nelems0);
961 
964 
970  friend void assignPresolveToPostsolve(CoinPresolveMatrix *&preObj);
971 
980  void setMatrix(const CoinPackedMatrix *mtx);
981 
983  inline int countEmptyRows()
984  {
985  int empty = 0;
986  for (int i = 0; i < nrows_; i++)
987  if (hinrow_[i] == 0)
988  empty++;
989  return (empty);
990  }
991 
997  inline void setVariableType(int i, int variableType)
998  {
999  if (integerType_ == 0)
1000  integerType_ = new unsigned char[ncols0_];
1001  integerType_[i] = static_cast< unsigned char >(variableType);
1002  }
1003 
1009  void setVariableType(const unsigned char *variableType, int lenParam);
1010 
1016  void setVariableType(bool allIntegers, int lenParam);
1017 
1019  inline void setAnyInteger(bool anyInteger = true)
1020  {
1022  }
1024 
1028 
1030  inline const CoinBigIndex *getRowStarts() const
1031  {
1032  return (mrstrt_);
1033  }
1035  inline const int *getColIndicesByRow() const
1036  {
1037  return (hcol_);
1038  }
1040  inline const double *getElementsByRow() const
1041  {
1042  return (rowels_);
1043  }
1044 
1050  inline bool isInteger(int i) const
1051  {
1052  if (integerType_ == 0) {
1053  return (anyInteger_);
1054  } else if (integerType_[i] == 1) {
1055  return (true);
1056  } else {
1057  return (false);
1058  }
1059  }
1060 
1065  inline bool anyInteger() const
1066  {
1067  return (anyInteger_);
1068  }
1070  inline int presolveOptions() const
1071  {
1072  return presolveOptions_;
1073  }
1075  inline void setPresolveOptions(int value)
1076  {
1077  presolveOptions_ = value;
1078  }
1080 
1093 
1095  double dobias_;
1096 
1098  inline void change_bias(double change_amount)
1099  {
1100  dobias_ += change_amount;
1101 #if PRESOLVE_DEBUG > 2
1102  assert(fabs(change_amount) < 1.0e50);
1103  if (change_amount)
1104  PRESOLVE_STMT(printf("changing bias by %g to %g\n",
1105  change_amount, dobias_));
1106 #endif
1107  }
1108 
1120  int *hinrow_;
1122  double *rowels_;
1124  int *hcol_;
1126 
1128  unsigned char *integerType_;
1136  bool tuning_;
1138  void statistics();
1140  double startTime_;
1141 
1145  inline double feasibilityTolerance()
1146  {
1147  return (feasibilityTolerance_);
1148  }
1150  inline void setFeasibilityTolerance(double val)
1151  {
1152  feasibilityTolerance_ = val;
1153  }
1154 
1160  int status_;
1162  inline int status()
1163  {
1164  return (status_);
1165  }
1167  inline void setStatus(int status)
1168  {
1169  status_ = (status & 0x3);
1170  }
1171 
1179  int pass_;
1181  inline void setPass(int pass = 0)
1182  {
1183  pass_ = pass;
1184  }
1185 
1192  inline void setMaximumSubstitutionLevel(int level)
1193  {
1194  maxSubstLevel_ = level;
1195  }
1196 
1220  unsigned char *colChanged_;
1229 
1239  unsigned char *rowChanged_;
1273 
1284  int *usefulRowInt_;
1293  double *randomNumber_;
1294 
1298  double *sumUp_;
1302  double *sumDown_;
1304 
1316  int recomputeSums(int whichRow);
1317 
1319  void initializeStuff();
1321  void deleteStuff();
1322 
1325 
1331  void initColsToDo();
1332 
1338  int stepColsToDo();
1339 
1341  inline int numberColsToDo()
1342  {
1343  return (numberColsToDo_);
1344  }
1345 
1347  inline bool colChanged(int i) const
1348  {
1349  return (colChanged_[i] & 1) != 0;
1350  }
1352  inline void unsetColChanged(int i)
1353  {
1354  colChanged_[i] = static_cast< unsigned char >(colChanged_[i] & (~1));
1355  }
1357  inline void setColChanged(int i)
1358  {
1359  colChanged_[i] = static_cast< unsigned char >(colChanged_[i] | (1));
1360  }
1362  inline void addCol(int i)
1363  {
1364  if ((colChanged_[i] & 1) == 0) {
1365  colChanged_[i] = static_cast< unsigned char >(colChanged_[i] | (1));
1367  }
1368  }
1370  inline bool colProhibited(int i) const
1371  {
1372  return (colChanged_[i] & 2) != 0;
1373  }
1380  inline bool colProhibited2(int i) const
1381  {
1382  if (!anyProhibited_)
1383  return false;
1384  else
1385  return (colChanged_[i] & 2) != 0;
1386  }
1388  inline void setColProhibited(int i)
1389  {
1390  colChanged_[i] = static_cast< unsigned char >(colChanged_[i] | (2));
1391  }
1397  inline bool colUsed(int i) const
1398  {
1399  return (colChanged_[i] & 4) != 0;
1400  }
1402  inline void setColUsed(int i)
1403  {
1404  colChanged_[i] = static_cast< unsigned char >(colChanged_[i] | (4));
1405  }
1407  inline void unsetColUsed(int i)
1408  {
1409  colChanged_[i] = static_cast< unsigned char >(colChanged_[i] & (~4));
1410  }
1412  inline bool colInfinite(int i) const
1413  {
1414  return (colChanged_[i] & 8) != 0;
1415  }
1417  inline void unsetColInfinite(int i)
1418  {
1419  colChanged_[i] = static_cast< unsigned char >(colChanged_[i] & (~8));
1420  }
1422  inline void setColInfinite(int i)
1423  {
1424  colChanged_[i] = static_cast< unsigned char >(colChanged_[i] | (8));
1425  }
1426 
1432  void initRowsToDo();
1433 
1439  int stepRowsToDo();
1440 
1442  inline int numberRowsToDo()
1443  {
1444  return (numberRowsToDo_);
1445  }
1446 
1448  inline bool rowChanged(int i) const
1449  {
1450  return (rowChanged_[i] & 1) != 0;
1451  }
1453  inline void unsetRowChanged(int i)
1454  {
1455  rowChanged_[i] = static_cast< unsigned char >(rowChanged_[i] & (~1));
1456  }
1458  inline void setRowChanged(int i)
1459  {
1460  rowChanged_[i] = static_cast< unsigned char >(rowChanged_[i] | (1));
1461  }
1463  inline void addRow(int i)
1464  {
1465  if ((rowChanged_[i] & 1) == 0) {
1466  rowChanged_[i] = static_cast< unsigned char >(rowChanged_[i] | (1));
1468  }
1469  }
1471  inline bool rowProhibited(int i) const
1472  {
1473  return (rowChanged_[i] & 2) != 0;
1474  }
1481  inline bool rowProhibited2(int i) const
1482  {
1483  if (!anyProhibited_)
1484  return false;
1485  else
1486  return (rowChanged_[i] & 2) != 0;
1487  }
1489  inline void setRowProhibited(int i)
1490  {
1491  rowChanged_[i] = static_cast< unsigned char >(rowChanged_[i] | (2));
1492  }
1498  inline bool rowUsed(int i) const
1499  {
1500  return (rowChanged_[i] & 4) != 0;
1501  }
1503  inline void setRowUsed(int i)
1504  {
1505  rowChanged_[i] = static_cast< unsigned char >(rowChanged_[i] | (4));
1506  }
1508  inline void unsetRowUsed(int i)
1509  {
1510  rowChanged_[i] = static_cast< unsigned char >(rowChanged_[i] & (~4));
1511  }
1512 
1514  inline bool anyProhibited() const
1515  {
1516  return anyProhibited_;
1517  }
1519  inline void setAnyProhibited(bool val = true)
1520  {
1521  anyProhibited_ = val;
1522  }
1524 };
1525 
1555 public:
1562  CoinPostsolveMatrix(int ncols_alloc, int nrows_alloc,
1563  CoinBigIndex nelems_alloc);
1564 
1569  CoinPostsolveMatrix(ClpSimplex *si,
1570 
1571  int ncols0,
1572  int nrows0,
1573  CoinBigIndex nelems0,
1574 
1575  double maxmin_,
1576  // end prepost members
1577 
1578  double *sol,
1579  double *acts,
1580 
1581  unsigned char *colstat,
1582  unsigned char *rowstat);
1583 
1588  CoinPostsolveMatrix(OsiSolverInterface *si,
1589 
1590  int ncols0,
1591  int nrows0,
1592  CoinBigIndex nelems0,
1593 
1594  double maxmin_,
1595  // end prepost members
1596 
1597  double *sol,
1598  double *acts,
1599 
1600  unsigned char *colstat,
1601  unsigned char *rowstat);
1602 
1614 
1617 
1629 
1639 
1641 
1649  char *cdone_;
1650  char *rdone_;
1652 
1654  void check_nbasic();
1655 };
1656 
1663 
1668 void presolve_make_memlists(/*CoinBigIndex *starts,*/ int *lengths,
1669  presolvehlink *link, int n);
1670 
1678 bool presolve_expand_major(CoinBigIndex *majstrts, double *majels,
1679  int *minndxs, int *majlens,
1680  presolvehlink *majlinks, int nmaj, int k);
1681 
1687 inline bool presolve_expand_col(CoinBigIndex *mcstrt, double *colels,
1688  int *hrow, int *hincol,
1689  presolvehlink *clink, int ncols, int colx)
1690 {
1691  return presolve_expand_major(mcstrt, colels,
1692  hrow, hincol, clink, ncols, colx);
1693 }
1694 
1700 inline bool presolve_expand_row(CoinBigIndex *mrstrt, double *rowels,
1701  int *hcol, int *hinrow,
1702  presolvehlink *rlink, int nrows, int rowx)
1703 {
1704  return presolve_expand_major(mrstrt, rowels,
1705  hcol, hinrow, rlink, nrows, rowx);
1706 }
1707 
1717  CoinBigIndex ks, CoinBigIndex ke,
1718  const int *minndxs)
1719 {
1720  CoinBigIndex k;
1721  for (k = ks; k < ke; k++)
1722 #ifndef NDEBUG
1723  {
1724  if (minndxs[k] == tgt)
1725  return (k);
1726  }
1727  DIE("FIND_MINOR");
1728 
1729  abort();
1730  return -1;
1731 #else
1732  {
1733  if (minndxs[k] == tgt)
1734  break;
1735  }
1736  return (k);
1737 #endif
1738 }
1739 
1747  CoinBigIndex kce, const int *hrow)
1748 {
1749  return presolve_find_minor(row, kcs, kce, hrow);
1750 }
1751 
1759  CoinBigIndex kre, const int *hcol)
1760 {
1761  return presolve_find_minor(col, krs, kre, hcol);
1762 }
1763 
1773  const int *minndxs);
1774 
1782  CoinBigIndex kce, const int *hrow)
1783 {
1784  return presolve_find_minor1(row, kcs, kce, hrow);
1785 }
1786 
1794  CoinBigIndex kre, const int *hcol)
1795 {
1796  return presolve_find_minor1(col, krs, kre, hcol);
1797 }
1798 
1807 CoinBigIndex presolve_find_minor2(int tgt, CoinBigIndex ks, int majlen,
1808  const int *minndxs,
1809  const CoinBigIndex *majlinks);
1810 
1818 inline CoinBigIndex presolve_find_row2(int row, CoinBigIndex kcs, int collen,
1819  const int *hrow,
1820  const CoinBigIndex *clinks)
1821 {
1822  return presolve_find_minor2(row, kcs, collen, hrow, clinks);
1823 }
1824 
1833 CoinBigIndex presolve_find_minor3(int tgt, CoinBigIndex ks, int majlen,
1834  const int *minndxs,
1835  const CoinBigIndex *majlinks);
1836 
1844 inline CoinBigIndex presolve_find_row3(int row, CoinBigIndex kcs, int collen,
1845  const int *hrow,
1846  const CoinBigIndex *clinks)
1847 {
1848  return presolve_find_minor3(row, kcs, collen, hrow, clinks);
1849 }
1850 
1860 inline void presolve_delete_from_major(int majndx, int minndx,
1861  const CoinBigIndex *majstrts,
1862  int *majlens, int *minndxs, double *els)
1863 {
1864  const CoinBigIndex ks = majstrts[majndx];
1865  const CoinBigIndex ke = ks + majlens[majndx];
1866 
1867  const CoinBigIndex kmi = presolve_find_minor(minndx, ks, ke, minndxs);
1868 
1869  minndxs[kmi] = minndxs[ke - 1];
1870  els[kmi] = els[ke - 1];
1871  majlens[majndx]--;
1872 
1873  return;
1874 }
1875 
1882 inline void presolve_delete_many_from_major(int majndx, char *marked,
1883  const CoinBigIndex *majstrts,
1884  int *majlens, int *minndxs, double *els)
1885 {
1886  const CoinBigIndex ks = majstrts[majndx];
1887  const CoinBigIndex ke = ks + majlens[majndx];
1888  CoinBigIndex put = ks;
1889  for (CoinBigIndex k = ks; k < ke; k++) {
1890  int iMinor = minndxs[k];
1891  if (!marked[iMinor]) {
1892  minndxs[put] = iMinor;
1893  els[put++] = els[k];
1894  } else {
1895  marked[iMinor] = 0;
1896  }
1897  }
1898  majlens[majndx] = static_cast< int >(put - ks);
1899  return;
1900 }
1901 
1912 inline void presolve_delete_from_col(int row, int col,
1913  const CoinBigIndex *mcstrt,
1914  int *hincol, int *hrow, double *colels)
1915 {
1916  presolve_delete_from_major(col, row, mcstrt, hincol, hrow, colels);
1917 }
1918 
1929 inline void presolve_delete_from_row(int row, int col,
1930  const CoinBigIndex *mrstrt,
1931  int *hinrow, int *hcol, double *rowels)
1932 {
1933  presolve_delete_from_major(row, col, mrstrt, hinrow, hcol, rowels);
1934 }
1935 
1946 void presolve_delete_from_major2(int majndx, int minndx,
1947  CoinBigIndex *majstrts, int *majlens,
1948  int *minndxs, CoinBigIndex *majlinks,
1949  CoinBigIndex *free_listp);
1950 
1961 inline void presolve_delete_from_col2(int row, int col, CoinBigIndex *mcstrt,
1962  int *hincol, int *hrow,
1963  CoinBigIndex *clinks, CoinBigIndex *free_listp)
1964 {
1965  presolve_delete_from_major2(col, row, mcstrt, hincol, hrow, clinks, free_listp);
1966 }
1967 
1969 
1975 
1987 double *presolve_dupmajor(const double *elems, const int *indices,
1988  int length, CoinBigIndex offset, int tgt = -1);
1989 
1991 void coin_init_random_vec(double *work, int n);
1992 
1994 
1995 #endif
1996 
1997 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
1998 */
CoinPostsolveMatrix::presolve_delete_from_col2
void presolve_delete_from_col2(int row, int col, CoinBigIndex *mcstrt, int *hincol, int *hrow, CoinBigIndex *clinks, CoinBigIndex *free_listp)
Delete the entry for row row from column col in a column-major threaded matrix.
Definition: CoinPresolveMatrix.hpp:1961
CoinPrePostsolveMatrix::getNumRows
int getNumRows() const
Get current number of rows.
Definition: CoinPresolveMatrix.hpp:500
CoinPresolveMatrix::unsetRowUsed
void unsetRowUsed(int i)
Mark row as unused.
Definition: CoinPresolveMatrix.hpp:1508
CoinPresolveMatrix::setColChanged
void setColChanged(int i)
Mark column as changed.
Definition: CoinPresolveMatrix.hpp:1357
CoinPresolveMatrix::hinrow_
int * hinrow_
Vector of row lengths.
Definition: CoinPresolveMatrix.hpp:1120
CoinPrePostsolveMatrix::setColumnStatusUsingValue
void setColumnStatusUsingValue(int iColumn)
Set status of column (structural variable) to the correct nonbasic status given bounds and current va...
CoinPostsolveMatrix::maxlink_
CoinBigIndex maxlink_
Allocated size of link_.
Definition: CoinPresolveMatrix.hpp:1633
CoinPrePostsolveMatrix::setRowStatus
void setRowStatus(int sequence, Status status)
Set row status (i.e., status of artificial for this row)
Definition: CoinPresolveMatrix.hpp:347
CoinPresolveMatrix::colProhibited
bool colProhibited(int i) const
Test if column is eligible for preprocessing.
Definition: CoinPresolveMatrix.hpp:1370
CoinPresolveMatrix::rowsToDo_
int * rowsToDo_
Input list of rows to process.
Definition: CoinPresolveMatrix.hpp:1241
CoinPresolveMatrix::statistics
void statistics()
Say we want statistics - also set time.
CoinPrePostsolveMatrix::getRowIndicesByCol
const int * getRowIndicesByCol() const
Get vector of row indices for column-major packed matrix.
Definition: CoinPresolveMatrix.hpp:520
CoinPresolveMatrix::colInfinite
bool colInfinite(int i) const
Has column infinite ub (originally)
Definition: CoinPresolveMatrix.hpp:1412
CoinPrePostsolveMatrix::getRowActivity
const double * getRowActivity() const
Get row activity (constraint lhs values)
Definition: CoinPresolveMatrix.hpp:560
CoinPrePostsolveMatrix::getRowLower
const double * getRowLower() const
Get row lower bounds.
Definition: CoinPresolveMatrix.hpp:545
CoinPresolveMatrix::getElementsByRow
const double * getElementsByRow() const
Get vector of elements for row-major packed matrix.
Definition: CoinPresolveMatrix.hpp:1040
CoinPrePostsolveMatrix::presolve_find_row1
CoinBigIndex presolve_find_row1(int row, CoinBigIndex kcs, CoinBigIndex kce, const int *hrow)
Find position of a row in a column in a column-major matrix.
Definition: CoinPresolveMatrix.hpp:1781
CoinPrePostsolveMatrix::setArtificialStatus
void setArtificialStatus(const char *artifStatus, int lenParam)
Set row (artificial variable) status vector.
CoinPrePostsolveMatrix::ztoldj_
double ztoldj_
Dual feasibility tolerance.
Definition: CoinPresolveMatrix.hpp:698
CoinPresolveMatrix::initializeStuff
void initializeStuff()
Allocate scratch arrays.
CoinPresolveMatrix::initRowsToDo
void initRowsToDo()
Initialise the row ToDo lists.
CoinPrePostsolveMatrix::presolve_delete_from_major
void presolve_delete_from_major(int majndx, int minndx, const CoinBigIndex *majstrts, int *majlens, int *minndxs, double *els)
Delete the entry for a minor index from a major vector.
Definition: CoinPresolveMatrix.hpp:1860
CoinPresolveMatrix::sumDown_
double * sumDown_
Work array for sum of finite contributions to row lhs lower bound.
Definition: CoinPresolveMatrix.hpp:1302
CoinPresolveMatrix::clink_
presolvehlink * clink_
Linked list for the column-major representation.
Definition: CoinPresolveMatrix.hpp:1089
CoinPrePostsolveMatrix::setPrimalTolerance
void setPrimalTolerance(double primTol)
Set the primal feasibility tolerance.
CoinPrePostsolveMatrix::getColLower
const double * getColLower() const
Get column lower bounds.
Definition: CoinPresolveMatrix.hpp:530
CoinPresolveMatrix::initColsToDo
void initColsToDo()
Initialise the column ToDo lists.
CoinPresolveMatrix::setVariableType
void setVariableType(int i, int variableType)
Set variable type information for a single variable.
Definition: CoinPresolveMatrix.hpp:997
CoinPrePostsolveMatrix::presolve_delete_many_from_major
void presolve_delete_many_from_major(int majndx, char *marked, const CoinBigIndex *majstrts, int *majlens, int *minndxs, double *els)
Delete marked entries.
Definition: CoinPresolveMatrix.hpp:1882
CoinPresolveMatrix::numberColsToDo
int numberColsToDo()
Return the number of columns on the colsToDo_ list.
Definition: CoinPresolveMatrix.hpp:1341
CoinPrePostsolveMatrix::clo_
double * clo_
Column (primal variable) lower bounds.
Definition: CoinPresolveMatrix.hpp:671
CoinMessage.hpp
CoinPresolveAction::~CoinPresolveAction
virtual ~CoinPresolveAction()
Virtual destructor.
Definition: CoinPresolveMatrix.hpp:209
CoinPrePostsolveMatrix::messages
CoinMessages messages() const
Return messages.
Definition: CoinPresolveMatrix.hpp:606
CoinPrePostsolveMatrix::setStatus
void setStatus(const CoinWarmStartBasis *basis)
Set the status of all variables from a basis.
CoinPresolveMatrix::colsToDo_
int * colsToDo_
Input list of columns to process.
Definition: CoinPresolveMatrix.hpp:1222
CoinPresolveMatrix::usefulColumnInt_
int * usefulColumnInt_
Preallocated scratch work array, 2*ncols_.
Definition: CoinPresolveMatrix.hpp:1289
CoinPrePostsolveMatrix::acts_
double * acts_
Vector of constraint left-hand-side values (row activity)
Definition: CoinPresolveMatrix.hpp:740
CoinPostsolveMatrix::presolve_find_col
CoinBigIndex presolve_find_col(int col, CoinBigIndex krs, CoinBigIndex kre, const int *hcol)
Find position of a column in a row in a row-major matrix.
Definition: CoinPresolveMatrix.hpp:1758
CoinPrePostsolveMatrix::presolve_make_memlists
void presolve_make_memlists(int *lengths, presolvehlink *link, int n)
Initialise linked list for major vector order in bulk storage.
CoinPrePostsolveMatrix::getReducedCost
const double * getReducedCost() const
Get reduced costs.
Definition: CoinPresolveMatrix.hpp:570
CoinPrePostsolveMatrix::setColLower
void setColLower(const double *colLower, int lenParam)
Set column lower bounds.
CoinPresolveMatrix::anyProhibited_
bool anyProhibited_
Flag to say if any rows or columns are marked as prohibited.
Definition: CoinPresolveMatrix.hpp:1271
CoinPrePostsolveMatrix::messageHandler
CoinMessageHandler * messageHandler() const
Return message handler.
Definition: CoinPresolveMatrix.hpp:588
CoinPrePostsolveMatrix::atUpperBound
@ atUpperBound
Definition: CoinPresolveMatrix.hpp:328
coin_init_random_vec
void coin_init_random_vec(double *work, int n)
Initialize a vector with random numbers.
CoinPostsolveMatrix::~CoinPostsolveMatrix
~CoinPostsolveMatrix()
Destructor.
CoinPresolveMatrix::startTime_
double startTime_
Start time of presolve.
Definition: CoinPresolveMatrix.hpp:1140
CoinPresolveAction::CoinPresolveAction
CoinPresolveAction(const CoinPresolveAction *next)
Construct a postsolve object and add it to the transformation list.
Definition: CoinPresolveMatrix.hpp:187
CoinPrePostsolveMatrix::presolve_delete_from_row
void presolve_delete_from_row(int row, int col, const CoinBigIndex *mrstrt, int *hinrow, int *hcol, double *rowels)
Delete the entry for column col from row row in a row-major matrix.
Definition: CoinPresolveMatrix.hpp:1929
CoinPrePostsolveMatrix::superBasic
@ superBasic
Definition: CoinPresolveMatrix.hpp:330
CoinPresolveMatrix::getColIndicesByRow
const int * getColIndicesByRow() const
Get vector of column indices for row-major packed matrix.
Definition: CoinPresolveMatrix.hpp:1035
CoinPresolveMatrix::setAnyInteger
void setAnyInteger(bool anyInteger=true)
Set a flag for presence (true) or absence (false) of integer variables.
Definition: CoinPresolveMatrix.hpp:1019
CoinPostsolveMatrix::link_
CoinBigIndex * link_
Thread array.
Definition: CoinPresolveMatrix.hpp:1638
DIE
void DIE(const char *)
Definition: CoinPresolveMatrix.hpp:79
CoinMessages
Class to hold and manipulate an array of massaged messages.
Definition: CoinMessageHandler.hpp:140
CoinPrePostsolveMatrix::getRowPrice
const double * getRowPrice() const
Get row solution (dual variables)
Definition: CoinPresolveMatrix.hpp:565
CoinPresolveMatrix::integerType_
unsigned char * integerType_
Tracks integrality of columns (1 for integer, 0 for continuous)
Definition: CoinPresolveMatrix.hpp:1128
CoinPresolveMatrix::anyInteger_
bool anyInteger_
Flag to say if any variables are integer.
Definition: CoinPresolveMatrix.hpp:1134
CoinPrePostsolveMatrix::setRowUpper
void setRowUpper(const double *rowUpper, int lenParam)
Set row upper bounds.
CoinPresolveMatrix::usefulColumnDouble_
double * usefulColumnDouble_
Preallocated scratch work array, ncols_.
Definition: CoinPresolveMatrix.hpp:1291
CoinMessage
The standard set of Coin messages.
Definition: CoinMessage.hpp:78
CoinPrePostsolveMatrix::presolve_expand_major
bool presolve_expand_major(CoinBigIndex *majstrts, double *majels, int *minndxs, int *majlens, presolvehlink *majlinks, int nmaj, int k)
Make sure a major-dimension vector k has room for one more coefficient.
PRESOLVE_INF
#define PRESOLVE_INF
The usual finite infinity.
Definition: CoinPresolveMatrix.hpp:106
CoinPresolveMatrix::colChanged_
unsigned char * colChanged_
Column change status information.
Definition: CoinPresolveMatrix.hpp:1220
CoinPrePostsolveMatrix::setRowLower
void setRowLower(const double *rowLower, int lenParam)
Set row lower bounds.
CoinPrePostsolveMatrix::setRowPrice
void setRowPrice(const double *rowSol, int lenParam)
Set row solution.
CoinPresolveMatrix::randomNumber_
double * randomNumber_
Array of random numbers (max row,column)
Definition: CoinPresolveMatrix.hpp:1293
CoinPostsolveMatrix::presolve_find_minor3
CoinBigIndex presolve_find_minor3(int tgt, CoinBigIndex ks, int majlen, const int *minndxs, const CoinBigIndex *majlinks)
Find position of a minor index in a major vector in a threaded matrix.
CoinPresolveMatrix::addCol
void addCol(int i)
Mark column as changed and add to list of columns to process next.
Definition: CoinPresolveMatrix.hpp:1362
CoinPrePostsolveMatrix::defaultHandler_
bool defaultHandler_
Indicates if the current handler_ is default (true) or not (false).
Definition: CoinPresolveMatrix.hpp:776
CoinPrePostsolveMatrix::colstat_
unsigned char * colstat_
Status of primal variables.
Definition: CoinPresolveMatrix.hpp:754
CoinPresolveMatrix::status_
int status_
Output status: 0 = feasible, 1 = infeasible, 2 = unbounded.
Definition: CoinPresolveMatrix.hpp:1160
CoinPresolveMatrix::anyInteger
bool anyInteger() const
Check if there are any integer variables.
Definition: CoinPresolveMatrix.hpp:1065
CoinPrePostsolveMatrix::setColUpper
void setColUpper(const double *colUpper, int lenParam)
Set column upper bounds.
CoinWarmStartBasis
The default COIN simplex (basis-oriented) warm start class.
Definition: CoinWarmStartBasis.hpp:40
CoinPresolveMatrix::setPresolveOptions
void setPresolveOptions(int value)
Sets any special options (see presolveOptions_)
Definition: CoinPresolveMatrix.hpp:1075
CoinPresolveMatrix::dobias_
double dobias_
Objective function offset introduced during presolve.
Definition: CoinPresolveMatrix.hpp:1095
CoinPrePostsolveMatrix::originalOffset_
double originalOffset_
Original objective offset.
Definition: CoinPresolveMatrix.hpp:668
CoinPresolveMatrix::presolveOptions
int presolveOptions() const
Picks up any special options.
Definition: CoinPresolveMatrix.hpp:1070
CoinPrePostsolveMatrix::ncols_
int ncols_
current number of columns
Definition: CoinPresolveMatrix.hpp:623
CoinPragma.hpp
CoinPresolveMatrix::feasibilityTolerance
double feasibilityTolerance()
Return feasibility tolerance.
Definition: CoinPresolveMatrix.hpp:1145
CoinPrePostsolveMatrix::presolve_expand_row
bool presolve_expand_row(CoinBigIndex *mrstrt, double *rowels, int *hcol, int *hinrow, presolvehlink *rlink, int nrows, int rowx)
Make sure a row (rowx) in a row-major matrix has room for one more coefficient.
Definition: CoinPresolveMatrix.hpp:1700
CoinPrePostsolveMatrix::originalRow_
int * originalRow_
Original row numbers.
Definition: CoinPresolveMatrix.hpp:693
CoinPrePostsolveMatrix::rlo_
double * rlo_
Row (constraint) lower bounds.
Definition: CoinPresolveMatrix.hpp:676
CoinPrePostsolveMatrix::setObjOffset
void setObjOffset(double offset)
Set the objective function offset for the original system.
CoinPresolveMatrix::unsetColUsed
void unsetColUsed(int i)
Mark column as unused.
Definition: CoinPresolveMatrix.hpp:1407
CoinPostsolveMatrix::cdone_
char * cdone_
Definition: CoinPresolveMatrix.hpp:1649
CoinPresolveMatrix::stepRowsToDo
int stepRowsToDo()
Step row ToDo lists.
CoinPrePostsolveMatrix::presolve_find_row
CoinBigIndex presolve_find_row(int row, CoinBigIndex kcs, CoinBigIndex kce, const int *hrow)
Find position of a row in a column in a column-major matrix.
Definition: CoinPresolveMatrix.hpp:1746
CoinPrePostsolveMatrix::basic
@ basic
Definition: CoinPresolveMatrix.hpp:327
CoinPresolveAction::next
const CoinPresolveAction * next
The next presolve transformation.
Definition: CoinPresolveMatrix.hpp:180
CoinPresolveMatrix::rlink_
presolvehlink * rlink_
Linked list for the row-major representation.
Definition: CoinPresolveMatrix.hpp:1091
CoinPrePostsolveMatrix::handler_
CoinMessageHandler * handler_
Message handler.
Definition: CoinPresolveMatrix.hpp:774
CoinPrePostsolveMatrix::rowIsBasic
bool rowIsBasic(int sequence) const
Check if artificial for this row is basic.
Definition: CoinPresolveMatrix.hpp:360
CoinPrePostsolveMatrix::setRowActivity
void setRowActivity(const double *rowAct, int lenParam)
Set row activity.
CoinPresolveMatrix::rowChanged_
unsigned char * rowChanged_
Row change status information.
Definition: CoinPresolveMatrix.hpp:1239
CoinPrePostsolveMatrix::getCost
const double * getCost() const
Get objective coefficients.
Definition: CoinPresolveMatrix.hpp:540
CoinPresolveMatrix::colProhibited2
bool colProhibited2(int i) const
Test if column is eligible for preprocessing.
Definition: CoinPresolveMatrix.hpp:1380
CoinPrePostsolveMatrix::rowduals_
double * rowduals_
Vector of dual variable values.
Definition: CoinPresolveMatrix.hpp:734
presolve_dupmajor
double * presolve_dupmajor(const double *elems, const int *indices, int length, CoinBigIndex offset, int tgt=-1)
Duplicate a major-dimension vector; optionally omit the entry with minor index tgt.
CoinPresolveMatrix::~CoinPresolveMatrix
~CoinPresolveMatrix()
Destructor.
CoinPresolveMatrix::pass_
int pass_
Presolve pass number.
Definition: CoinPresolveMatrix.hpp:1179
CoinPrePostsolveMatrix::columnIsBasic
bool columnIsBasic(int sequence) const
Check if column (structural variable) is basic.
Definition: CoinPresolveMatrix.hpp:422
CoinPresolveMatrix::setColInfinite
void setColInfinite(int i)
Mark column as infinite ub (originally)
Definition: CoinPresolveMatrix.hpp:1422
CoinPresolveMatrix::assignPresolveToPostsolve
friend void assignPresolveToPostsolve(CoinPresolveMatrix *&preObj)
Initialize a CoinPostsolveMatrix object, destroying the CoinPresolveMatrix object.
CoinPrePostsolveMatrix::getNumCols
int getNumCols() const
Get current number of columns.
Definition: CoinPresolveMatrix.hpp:495
CoinPostsolveMatrix::presolve_find_row2
CoinBigIndex presolve_find_row2(int row, CoinBigIndex kcs, int collen, const int *hrow, const CoinBigIndex *clinks)
Find position of a row in a column in a column-major threaded matrix.
Definition: CoinPresolveMatrix.hpp:1818
CoinPostsolveMatrix
Augments CoinPrePostsolveMatrix with information about the problem that is only needed during postsol...
Definition: CoinPresolveMatrix.hpp:1554
CoinPrePostsolveMatrix::isFree
@ isFree
Definition: CoinPresolveMatrix.hpp:326
CoinPresolveMatrix::deleteStuff
void deleteStuff()
Free scratch arrays.
CoinPresolveMatrix::setStatus
void setStatus(int status)
Set problem status.
Definition: CoinPresolveMatrix.hpp:1167
CoinPrePostsolveMatrix::presolve_find_col1
CoinBigIndex presolve_find_col1(int col, CoinBigIndex krs, CoinBigIndex kre, const int *hcol)
Find position of a column in a row in a row-major matrix.
Definition: CoinPresolveMatrix.hpp:1793
CoinPresolveMatrix::setAnyProhibited
void setAnyProhibited(bool val=true)
Set a flag for presence of prohibited rows or columns.
Definition: CoinPresolveMatrix.hpp:1519
CoinPrePostsolveMatrix::nrows0_
int nrows0_
Allocated number of rows.
Definition: CoinPresolveMatrix.hpp:632
CoinPresolveMatrix::setColProhibited
void setColProhibited(int i)
Mark column as ineligible for preprocessing.
Definition: CoinPresolveMatrix.hpp:1388
CoinPresolveMatrix::addRow
void addRow(int i)
Mark row as changed and add to list of rows to process next.
Definition: CoinPresolveMatrix.hpp:1463
CoinPrePostsolveMatrix::getStatus
CoinWarmStartBasis * getStatus()
Get status in the form of a CoinWarmStartBasis.
CoinPrePostsolveMatrix::setRowStatusUsingValue
void setRowStatusUsingValue(int iRow)
Set status of row (artificial variable) to the correct nonbasic status given bounds and current value...
CoinPresolveMatrix::usefulRowDouble_
double * usefulRowDouble_
Preallocated scratch work array, 2*nrows_.
Definition: CoinPresolveMatrix.hpp:1287
CoinPrePostsolveMatrix::sol_
double * sol_
Vector of primal variable values.
Definition: CoinPresolveMatrix.hpp:728
CoinPresolveMatrix::setFeasibilityTolerance
void setFeasibilityTolerance(double val)
Set feasibility tolerance.
Definition: CoinPresolveMatrix.hpp:1150
CoinPrePostsolveMatrix::CoinPrePostsolveMatrix
CoinPrePostsolveMatrix(int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc)
‘Native’ constructor
CoinPrePostsolveMatrix::rowstat_
unsigned char * rowstat_
Status of constraints.
Definition: CoinPresolveMatrix.hpp:762
CoinMessageHandler
Base class for message handling.
Definition: CoinMessageHandler.hpp:345
CoinPresolveMatrix::stepColsToDo
int stepColsToDo()
Step column ToDo lists.
CoinPresolveMatrix::rowProhibited2
bool rowProhibited2(int i) const
Test if row is eligible for preprocessing.
Definition: CoinPresolveMatrix.hpp:1481
CoinPresolveMatrix::sumUp_
double * sumUp_
Work array for sum of finite contributions to row lhs upper bound.
Definition: CoinPresolveMatrix.hpp:1298
CoinPrePostsolveMatrix::rcosts_
double * rcosts_
Vector of reduced costs.
Definition: CoinPresolveMatrix.hpp:746
CoinPrePostsolveMatrix::colels_
double * colels_
Coefficients (positional correspondence with hrow_)
Definition: CoinPresolveMatrix.hpp:663
CoinPresolveMatrix::nextRowsToDo_
int * nextRowsToDo_
Output list of rows to process next.
Definition: CoinPresolveMatrix.hpp:1245
CoinPrePostsolveMatrix::getRowUpper
const double * getRowUpper() const
Get row upper bounds.
Definition: CoinPresolveMatrix.hpp:550
CoinPresolveMatrix::setRowProhibited
void setRowProhibited(int i)
Mark row as ineligible for preprocessing.
Definition: CoinPresolveMatrix.hpp:1489
CoinPresolveMatrix::numberNextColsToDo_
int numberNextColsToDo_
Length of nextColsToDo_.
Definition: CoinPresolveMatrix.hpp:1228
NO_LINK
#define NO_LINK
Definition: CoinPresolveMatrix.hpp:816
CoinPrePostsolveMatrix::getColumnStatus
Status getColumnStatus(int sequence) const
Get column (structural variable) status.
Definition: CoinPresolveMatrix.hpp:417
CoinPresolveMatrix::infiniteUp_
int * infiniteUp_
Work array for count of infinite contributions to row lhs upper bound.
Definition: CoinPresolveMatrix.hpp:1296
CoinPresolveMatrix::mrstrt_
CoinBigIndex * mrstrt_
Vector of row start positions in #hcol, rowels_.
Definition: CoinPresolveMatrix.hpp:1118
CoinPresolveAction::name
virtual const char * name() const =0
A name for debug printing.
CoinPresolveMatrix::infiniteDown_
int * infiniteDown_
Work array for count of infinite contributions to row lhs lower bound.
Definition: CoinPresolveMatrix.hpp:1300
CoinPostsolveMatrix::presolve_delete_from_major2
void presolve_delete_from_major2(int majndx, int minndx, CoinBigIndex *majstrts, int *majlens, int *minndxs, CoinBigIndex *majlinks, CoinBigIndex *free_listp)
Delete the entry for a minor index from a major vector in a threaded matrix.
CoinPresolveAction
Abstract base class of all presolve routines.
Definition: CoinPresolveMatrix.hpp:163
CoinPrePostsolveMatrix
Collects all the information about the problem that is needed in both presolve and postsolve.
Definition: CoinPresolveMatrix.hpp:279
CoinPrePostsolveMatrix::setReducedCost
void setReducedCost(const double *redCost, int lenParam)
Set reduced costs.
CoinPresolveMatrix::getRowStarts
const CoinBigIndex * getRowStarts() const
Get row start vector for row-major packed matrix.
Definition: CoinPresolveMatrix.hpp:1030
CoinPackedMatrix.hpp
CoinPrePostsolveMatrix::setMessageHandler
void setMessageHandler(CoinMessageHandler *handler)
Set message handler.
Definition: CoinPresolveMatrix.hpp:597
CoinPrePostsolveMatrix::mcstrt_
CoinBigIndex * mcstrt_
Vector of column start positions in hrow_, colels_.
Definition: CoinPresolveMatrix.hpp:657
CoinPrePostsolveMatrix::setDualTolerance
void setDualTolerance(double dualTol)
Set the dual feasibility tolerance.
CoinPrePostsolveMatrix::nelems0_
CoinBigIndex nelems0_
Allocated number of coefficients.
Definition: CoinPresolveMatrix.hpp:634
CoinPresolveAction::throwCoinError
static void throwCoinError(const char *error, const char *ps_routine)
Stub routine to throw exceptions.
Definition: CoinPresolveMatrix.hpp:171
CoinPresolveMatrix::numberRowsToDo_
int numberRowsToDo_
Length of rowsToDo_.
Definition: CoinPresolveMatrix.hpp:1243
CoinPrePostsolveMatrix::getColUpper
const double * getColUpper() const
Get column upper bounds.
Definition: CoinPresolveMatrix.hpp:535
CoinPresolveMatrix::colUsed
bool colUsed(int i) const
Test if column is marked as used.
Definition: CoinPresolveMatrix.hpp:1397
CoinPrePostsolveMatrix::statusName
const char * statusName(CoinPrePostsolveMatrix::Status status)
Generate a print string for a status code.
CoinPrePostsolveMatrix::setObjSense
void setObjSense(double objSense)
Set the objective sense (max/min)
CoinPrePostsolveMatrix::Status
Status
Enum for status of various sorts.
Definition: CoinPresolveMatrix.hpp:325
CoinPrePostsolveMatrix::getColSolution
const double * getColSolution() const
Get column solution (primal variable values)
Definition: CoinPresolveMatrix.hpp:555
CoinPrePostsolveMatrix::setCost
void setCost(const double *cost, int lenParam)
Set objective coefficients.
CoinPresolveMatrix::setColUsed
void setColUsed(int i)
Mark column as used.
Definition: CoinPresolveMatrix.hpp:1402
CoinPrePostsolveMatrix::columnStatusString
const char * columnStatusString(int j) const
Return a print string for status of a column (structural variable)
CoinPresolveMatrix::status
int status()
Returns problem status (0 = feasible, 1 = infeasible, 2 = unbounded)
Definition: CoinPresolveMatrix.hpp:1162
PRESOLVE_STMT
#define PRESOLVE_STMT(s)
Definition: CoinPresolveMatrix.hpp:75
CoinPresolveMatrix::anyProhibited
bool anyProhibited() const
Check if there are any prohibited rows or columns.
Definition: CoinPresolveMatrix.hpp:1514
CoinPrePostsolveMatrix::cost_
double * cost_
Objective coefficients.
Definition: CoinPresolveMatrix.hpp:666
CoinPrePostsolveMatrix::maxmin_
double maxmin_
Maximization/minimization.
Definition: CoinPresolveMatrix.hpp:705
CoinPrePostsolveMatrix::getNumElems
CoinBigIndex getNumElems() const
Get current number of non-zero coefficients.
Definition: CoinPresolveMatrix.hpp:505
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
CoinPrePostsolveMatrix::messages_
CoinMessage messages_
Standard COIN messages.
Definition: CoinPresolveMatrix.hpp:778
CoinPresolveMatrix::CoinPresolveMatrix
CoinPresolveMatrix(int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc)
‘Native’ constructor
CoinTime.hpp
CoinPresolveMatrix::countEmptyRows
int countEmptyRows()
Count number of empty rows.
Definition: CoinPresolveMatrix.hpp:983
CoinPresolveMatrix::unsetColChanged
void unsetColChanged(int i)
Mark column as not changed.
Definition: CoinPresolveMatrix.hpp:1352
CoinPostsolveMatrix::assignPresolveToPostsolve
void assignPresolveToPostsolve(CoinPresolveMatrix *&preObj)
Load an empty CoinPostsolveMatrix from a CoinPresolveMatrix.
CoinPresolveMatrix::hcol_
int * hcol_
Column indices (positional correspondence with rowels_)
Definition: CoinPresolveMatrix.hpp:1124
CoinPrePostsolveMatrix::presolve_delete_from_col
void presolve_delete_from_col(int row, int col, const CoinBigIndex *mcstrt, int *hincol, int *hrow, double *colels)
Delete the entry for row row from column col in a column-major matrix.
Definition: CoinPresolveMatrix.hpp:1912
CoinPresolveMatrix::presolveOptions_
int presolveOptions_
Fine control over presolve actions.
Definition: CoinPresolveMatrix.hpp:1265
CoinPrePostsolveMatrix::getRowStatus
Status getRowStatus(int sequence) const
Get row status.
Definition: CoinPresolveMatrix.hpp:355
CoinPrePostsolveMatrix::ztolzb_
double ztolzb_
Primal feasibility tolerance.
Definition: CoinPresolveMatrix.hpp:696
ZTOLDP2
const double ZTOLDP2
Alternate zero tolerance.
Definition: CoinPresolveMatrix.hpp:103
CoinPrePostsolveMatrix::rup_
double * rup_
Row (constraint) upper bounds.
Definition: CoinPresolveMatrix.hpp:678
CoinPrePostsolveMatrix::rowStatusString
const char * rowStatusString(int i) const
Return a print string for status of a row (artificial variable)
CoinPresolveMatrix::rowels_
double * rowels_
Coefficients (positional correspondence with hcol_)
Definition: CoinPresolveMatrix.hpp:1122
CoinPresolveMatrix::setMaximumSubstitutionLevel
void setMaximumSubstitutionLevel(int level)
Set Maximum substitution level (normally 3)
Definition: CoinPresolveMatrix.hpp:1192
CoinPrePostsolveMatrix::getColLengths
const int * getColLengths() const
Get column length vector for column-major packed matrix.
Definition: CoinPresolveMatrix.hpp:515
CoinPrePostsolveMatrix::originalColumn_
int * originalColumn_
Original column numbers.
Definition: CoinPresolveMatrix.hpp:686
CoinPresolveMatrix::colChanged
bool colChanged(int i) const
Has column been changed?
Definition: CoinPresolveMatrix.hpp:1347
CoinPostsolveMatrix::presolve_find_minor2
CoinBigIndex presolve_find_minor2(int tgt, CoinBigIndex ks, int majlen, const int *minndxs, const CoinBigIndex *majlinks)
Find position of a minor index in a major vector in a threaded matrix.
CoinPostsolveMatrix::check_nbasic
void check_nbasic()
debug
CoinPrePostsolveMatrix::setStructuralStatus
void setStructuralStatus(const char *strucStatus, int lenParam)
Set column (structural variable) status vector.
CoinPrePostsolveMatrix::setColSolution
void setColSolution(const double *colSol, int lenParam)
Set column solution.
CoinPresolveMatrix::tuning_
bool tuning_
Print statistics for tuning.
Definition: CoinPresolveMatrix.hpp:1136
CoinPresolveMatrix::nextColsToDo_
int * nextColsToDo_
Output list of columns to process next.
Definition: CoinPresolveMatrix.hpp:1226
CoinPresolveMatrix::numberNextRowsToDo_
int numberNextRowsToDo_
Length of nextRowsToDo_.
Definition: CoinPresolveMatrix.hpp:1247
CoinPresolveMatrix::unsetColInfinite
void unsetColInfinite(int i)
Mark column as not infinite ub (originally)
Definition: CoinPresolveMatrix.hpp:1417
CoinError
Error Class thrown by an exception.
Definition: CoinError.hpp:42
CoinPresolveMatrix::unsetRowChanged
void unsetRowChanged(int i)
Mark row as not changed.
Definition: CoinPresolveMatrix.hpp:1453
CoinPresolveMatrix::change_bias
void change_bias(double change_amount)
Adjust objective function constant offset.
Definition: CoinPresolveMatrix.hpp:1098
CoinPrePostsolveMatrix::presolve_expand_col
bool presolve_expand_col(CoinBigIndex *mcstrt, double *colels, int *hrow, int *hincol, presolvehlink *clink, int ncols, int colx)
Make sure a column (colx) in a column-major matrix has room for one more coefficient.
Definition: CoinPresolveMatrix.hpp:1687
CoinPresolveMatrix::setMatrix
void setMatrix(const CoinPackedMatrix *mtx)
Load the cofficient matrix.
CoinPrePostsolveMatrix::getColStarts
const CoinBigIndex * getColStarts() const
Get column start vector for column-major packed matrix.
Definition: CoinPresolveMatrix.hpp:510
CoinPostsolveMatrix::rdone_
char * rdone_
Definition: CoinPresolveMatrix.hpp:1650
CoinPrePostsolveMatrix::presolve_find_minor
CoinBigIndex presolve_find_minor(int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs)
Find position of a minor index in a major vector.
Definition: CoinPresolveMatrix.hpp:1716
CoinPresolveMatrix::recomputeSums
int recomputeSums(int whichRow)
Recompute row lhs bounds.
CoinPrePostsolveMatrix::ncols0_
int ncols0_
Allocated number of columns.
Definition: CoinPresolveMatrix.hpp:630
CoinPrePostsolveMatrix::nelems_
CoinBigIndex nelems_
current number of coefficients
Definition: CoinPresolveMatrix.hpp:627
CoinPostsolveMatrix::CoinPostsolveMatrix
CoinPostsolveMatrix(int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc)
‘Native’ constructor
CoinPresolveMatrix::maxSubstLevel_
int maxSubstLevel_
Maximum substitution level.
Definition: CoinPresolveMatrix.hpp:1190
CoinPresolveMatrix
Augments CoinPrePostsolveMatrix with information about the problem that is only needed during presolv...
Definition: CoinPresolveMatrix.hpp:907
CoinPrePostsolveMatrix::cup_
double * cup_
Column (primal variable) upper bounds.
Definition: CoinPresolveMatrix.hpp:673
CoinPostsolveMatrix::presolve_find_row3
CoinBigIndex presolve_find_row3(int row, CoinBigIndex kcs, int collen, const int *hrow, const CoinBigIndex *clinks)
Find position of a row in a column in a column-major threaded matrix.
Definition: CoinPresolveMatrix.hpp:1844
CoinPrePostsolveMatrix::countEmptyCols
int countEmptyCols()
Count empty columns.
Definition: CoinPresolveMatrix.hpp:575
CoinPresolveMatrix::setRowChanged
void setRowChanged(int i)
Mark row as changed.
Definition: CoinPresolveMatrix.hpp:1458
CoinPresolveMatrix::feasibilityTolerance_
double feasibilityTolerance_
Bounds can be moved by this to retain feasibility.
Definition: CoinPresolveMatrix.hpp:1143
CoinPostsolveMatrix::free_list_
CoinBigIndex free_list_
First entry in free entries thread.
Definition: CoinPresolveMatrix.hpp:1631
CoinPrePostsolveMatrix::atLowerBound
@ atLowerBound
Definition: CoinPresolveMatrix.hpp:329
CoinPrePostsolveMatrix::bulkRatio_
double bulkRatio_
Ratio of bulk0_ to nelems0_; default is 2.
Definition: CoinPresolveMatrix.hpp:645
CoinPrePostsolveMatrix::nrows_
int nrows_
current number of rows
Definition: CoinPresolveMatrix.hpp:625
CoinPresolveMatrix::rowChanged
bool rowChanged(int i) const
Has row been changed?
Definition: CoinPresolveMatrix.hpp:1448
CoinPresolveMatrix::numberColsToDo_
int numberColsToDo_
Length of colsToDo_.
Definition: CoinPresolveMatrix.hpp:1224
CoinPresolveMatrix::rowUsed
bool rowUsed(int i) const
Test if row is marked as used.
Definition: CoinPresolveMatrix.hpp:1498
CoinPrePostsolveMatrix::setColumnStatus
void setColumnStatus(int sequence, Status status)
Set column status (i.e., status of primal variable)
Definition: CoinPresolveMatrix.hpp:365
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:136
CoinPrePostsolveMatrix::hincol_
int * hincol_
Vector of column lengths.
Definition: CoinPresolveMatrix.hpp:659
CoinPresolveAction::setNext
void setNext(const CoinPresolveAction *nextAction)
modify next (when building rather than passing)
Definition: CoinPresolveMatrix.hpp:192
CoinPresolveAction::postsolve
virtual void postsolve(CoinPostsolveMatrix *prob) const =0
Apply the postsolve transformation for this particular presolve action.
ZTOLDP
const double ZTOLDP
Zero tolerance.
Definition: CoinPresolveMatrix.hpp:98
CoinPresolveMatrix::numberRowsToDo
int numberRowsToDo()
Return the number of rows on the rowsToDo_ list.
Definition: CoinPresolveMatrix.hpp:1442
CoinPrePostsolveMatrix::bulk0_
CoinBigIndex bulk0_
Allocated size of bulk storage for row indices and coefficients.
Definition: CoinPresolveMatrix.hpp:643
CoinPresolveMatrix::isInteger
bool isInteger(int i) const
Check for integrality of the specified variable.
Definition: CoinPresolveMatrix.hpp:1050
CoinPrePostsolveMatrix::hrow_
int * hrow_
Row indices (positional correspondence with colels_)
Definition: CoinPresolveMatrix.hpp:661
CoinPrePostsolveMatrix::presolve_find_minor1
CoinBigIndex presolve_find_minor1(int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs)
Find position of a minor index in a major vector.
CoinFinite.hpp
CoinPresolveMatrix::update_model
void update_model(ClpSimplex *si, int nrows0, int ncols0, CoinBigIndex nelems0)
Update the model held by a Clp OSI.
CoinPresolveMatrix::setPass
void setPass(int pass=0)
Set pass number.
Definition: CoinPresolveMatrix.hpp:1181
CoinPrePostsolveMatrix::~CoinPrePostsolveMatrix
~CoinPrePostsolveMatrix()
Destructor.
CoinPresolveMatrix::usefulRowInt_
int * usefulRowInt_
Preallocated scratch work array, 3*nrows_.
Definition: CoinPresolveMatrix.hpp:1285
CoinPrePostsolveMatrix::getElementsByCol
const double * getElementsByCol() const
Get vector of elements for column-major packed matrix.
Definition: CoinPresolveMatrix.hpp:525
CoinPresolveMatrix::rowProhibited
bool rowProhibited(int i) const
Test if row is eligible for preprocessing.
Definition: CoinPresolveMatrix.hpp:1471
CoinPresolveMatrix::setRowUsed
void setRowUsed(int i)
Mark row as used.
Definition: CoinPresolveMatrix.hpp:1503