ClpSimplex.hpp
Go to the documentation of this file.
1 /* $Id: ClpSimplex.hpp 1551 2010-05-24 23:34:44Z mjs $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 
5 /*
6  Authors
7 
8  John Forrest
9 
10  */
11 #ifndef ClpSimplex_H
12 #define ClpSimplex_H
13 
14 #include <iostream>
15 #include <cfloat>
16 #include "ClpModel.hpp"
17 #include "ClpMatrixBase.hpp"
18 #include "ClpSolve.hpp"
19 class ClpDualRowPivot;
21 class ClpFactorization;
22 class CoinIndexedVector;
23 class ClpNonLinearCost;
24 class ClpNodeStuff;
25 class CoinStructuredModel;
26 class OsiClpSolverInterface;
27 class CoinWarmStartBasis;
28 class ClpDisasterHandler;
29 class ClpConstraint;
30 
49 class ClpSimplex : public ClpModel {
50  friend void ClpSimplexUnitTest(const std::string & mpsDir);
51 
52 public:
57  enum Status {
58  isFree = 0x00,
59  basic = 0x01,
60  atUpperBound = 0x02,
61  atLowerBound = 0x03,
62  superBasic = 0x04,
63  isFixed = 0x05
64  };
65  // For Dual
66  enum FakeBound {
67  noFake = 0x00,
68  lowerFake = 0x01,
69  upperFake = 0x02,
70  bothFake = 0x03
71  };
72 
75  ClpSimplex (bool emptyMessages = false );
77 
82  ClpSimplex(const ClpSimplex & rhs, int scalingMode = -1);
87  ClpSimplex(const ClpModel & rhs, int scalingMode = -1);
94  ClpSimplex (const ClpModel * wholeModel,
95  int numberRows, const int * whichRows,
96  int numberColumns, const int * whichColumns,
97  bool dropNames = true, bool dropIntegers = true,
98  bool fixOthers = false);
105  ClpSimplex (const ClpSimplex * wholeModel,
106  int numberRows, const int * whichRows,
107  int numberColumns, const int * whichColumns,
108  bool dropNames = true, bool dropIntegers = true,
109  bool fixOthers = false);
113  ClpSimplex (ClpSimplex * wholeModel,
114  int numberColumns, const int * whichColumns);
117  void originalModel(ClpSimplex * miniModel);
123  void setPersistenceFlag(int value);
125  void makeBaseModel();
127  void deleteBaseModel();
129  inline ClpSimplex * baseModel() const {
130  return baseModel_;
131  }
135  void setToBaseModel(ClpSimplex * model = NULL);
137  ClpSimplex & operator=(const ClpSimplex & rhs);
139  ~ClpSimplex ( );
140  // Ones below are just ClpModel with some changes
152  void loadProblem ( const ClpMatrixBase& matrix,
153  const double* collb, const double* colub,
154  const double* obj,
155  const double* rowlb, const double* rowub,
156  const double * rowObjective = NULL);
157  void loadProblem ( const CoinPackedMatrix& matrix,
158  const double* collb, const double* colub,
159  const double* obj,
160  const double* rowlb, const double* rowub,
161  const double * rowObjective = NULL);
162 
165  void loadProblem ( const int numcols, const int numrows,
166  const CoinBigIndex* start, const int* index,
167  const double* value,
168  const double* collb, const double* colub,
169  const double* obj,
170  const double* rowlb, const double* rowub,
171  const double * rowObjective = NULL);
173  void loadProblem ( const int numcols, const int numrows,
174  const CoinBigIndex* start, const int* index,
175  const double* value, const int * length,
176  const double* collb, const double* colub,
177  const double* obj,
178  const double* rowlb, const double* rowub,
179  const double * rowObjective = NULL);
184  int loadProblem ( CoinModel & modelObject, bool keepSolution = false);
186  int readMps(const char *filename,
187  bool keepNames = false,
188  bool ignoreErrors = false);
190  int readGMPL(const char *filename, const char * dataName,
191  bool keepNames = false);
194  int readLp(const char *filename, const double epsilon = 1e-5);
199  void borrowModel(ClpModel & otherModel);
200  void borrowModel(ClpSimplex & otherModel);
204  void getbackSolution(const ClpSimplex & smallModel, const int * whichRow, const int * whichColumn);
213  int loadNonLinear(void * info, int & numberConstraints,
214  ClpConstraint ** & constraints);
216 
222  int initialSolve(ClpSolve & options);
224  int initialSolve();
226  int initialDualSolve();
228  int initialPrimalSolve();
230  int initialBarrierSolve();
243  int dual(int ifValuesPass = 0, int startFinishOptions = 0);
244  // If using Debug
245  int dualDebug(int ifValuesPass = 0, int startFinishOptions = 0);
256  int primal(int ifValuesPass = 0, int startFinishOptions = 0);
262  int nonlinearSLP(int numberPasses, double deltaTolerance);
268  int nonlinearSLP(int numberConstraints, ClpConstraint ** constraints,
269  int numberPasses, double deltaTolerance);
272  int barrier(bool crossover = true);
275  int reducedGradient(int phase = 0);
277  int solve(CoinStructuredModel * model);
284  int loadProblem ( CoinStructuredModel & modelObject,
285  bool originalOrder = true, bool keepSolution = false);
300  int cleanup(int cleanupScaling);
321  int dualRanging(int numberCheck, const int * which,
322  double * costIncrease, int * sequenceIncrease,
323  double * costDecrease, int * sequenceDecrease,
324  double * valueIncrease = NULL, double * valueDecrease = NULL);
339  int primalRanging(int numberCheck, const int * which,
340  double * valueIncrease, int * sequenceIncrease,
341  double * valueDecrease, int * sequenceDecrease);
356  int writeBasis(const char *filename,
357  bool writeValues = false,
358  int formatType = 0) const;
361  int readBasis(const char *filename);
363  CoinWarmStartBasis * getBasis() const;
366  // Swaps factorization
379  int tightenPrimalBounds(double factor = 0.0, int doTight = 0, bool tightIntegers = false);
396  int crash(double gap, int pivot);
409  int strongBranching(int numberVariables, const int * variables,
410  double * newLower, double * newUpper,
411  double ** outputSolution,
412  int * outputStatus, int * outputIterations,
413  bool stopOnFirstInfeasible = true,
414  bool alwaysFinish = false,
415  int startFinishOptions = 0);
417  int fathom(void * stuff);
423  int fathomMany(void * stuff);
425  double doubleCheck();
427  int startFastDual2(ClpNodeStuff * stuff);
429  int fastDual2(ClpNodeStuff * stuff);
431  void stopFastDual2(ClpNodeStuff * stuff);
438  ClpSimplex * fastCrunch(ClpNodeStuff * stuff, int mode);
440 
448  int pivot();
449 
455  int primalPivotResult();
456 
463  int dualPivotResult();
464 
476  int startup(int ifValuesPass, int startFinishOptions = 0);
477  void finish(int startFinishOptions = 0);
478 
480  bool statusOfProblem(bool initial = false);
484 
487  inline bool primalFeasible() const {
489  return (numberPrimalInfeasibilities_ == 0);
490  }
492  inline bool dualFeasible() const {
493  return (numberDualInfeasibilities_ == 0);
494  }
496  inline ClpFactorization * factorization() const {
497  return factorization_;
498  }
500  bool sparseFactorization() const;
501  void setSparseFactorization(bool value);
503  int factorizationFrequency() const;
504  void setFactorizationFrequency(int value);
506  inline double dualBound() const {
507  return dualBound_;
508  }
509  void setDualBound(double value);
511  inline double infeasibilityCost() const {
512  return infeasibilityCost_;
513  }
514  void setInfeasibilityCost(double value);
531  inline int perturbation() const {
532  return perturbation_;
533  }
534  void setPerturbation(int value);
536  inline int algorithm() const {
537  return algorithm_;
538  }
540  inline void setAlgorithm(int value) {
541  algorithm_ = value;
542  }
544  bool isObjectiveLimitTestValid() const ;
546  inline double sumDualInfeasibilities() const {
548  }
549  inline void setSumDualInfeasibilities(double value) {
550  sumDualInfeasibilities_ = value;
551  }
553  inline double sumOfRelaxedDualInfeasibilities() const {
555  }
556  inline void setSumOfRelaxedDualInfeasibilities(double value) {
558  }
560  inline int numberDualInfeasibilities() const {
562  }
563  inline void setNumberDualInfeasibilities(int value) {
565  }
569  }
571  inline double sumPrimalInfeasibilities() const {
573  }
574  inline void setSumPrimalInfeasibilities(double value) {
576  }
578  inline double sumOfRelaxedPrimalInfeasibilities() const {
580  }
581  inline void setSumOfRelaxedPrimalInfeasibilities(double value) {
583  }
585  inline int numberPrimalInfeasibilities() const {
587  }
588  inline void setNumberPrimalInfeasibilities(int value) {
590  }
597  int saveModel(const char * fileName);
600  int restoreModel(const char * fileName);
601 
609  void checkSolution(int setToBounds = 0);
612  void checkSolutionInternal();
614  inline CoinIndexedVector * rowArray(int index) const {
615  return rowArray_[index];
616  }
618  inline CoinIndexedVector * columnArray(int index) const {
619  return columnArray_[index];
620  }
622 
623  /******************** End of most useful part **************/
629  int getSolution ( const double * rowActivities,
630  const double * columnActivities);
634  int getSolution ();
641  int createPiecewiseLinearCosts(const int * starts,
642  const double * lower, const double * gradient);
644  inline ClpDualRowPivot * dualRowPivot() const {
645  return dualRowPivot_;
646  }
649  return primalColumnPivot_;
650  }
652  inline bool goodAccuracy() const {
653  return (largestPrimalError_ < 1.0e-7 && largestDualError_ < 1.0e-7);
654  }
656  void returnModel(ClpSimplex & otherModel);
664  int internalFactorize(int solveType);
668  void restoreData(ClpDataSave saved);
670  void cleanStatus();
672  int factorize();
675  void computeDuals(double * givenDjs);
677  void computePrimals ( const double * rowActivities,
678  const double * columnActivities);
680  void add(double * array,
681  int column, double multiplier) const;
687  void unpack(CoinIndexedVector * rowArray) const ;
693  void unpack(CoinIndexedVector * rowArray, int sequence) const;
700  void unpackPacked(CoinIndexedVector * rowArray) ;
707  void unpackPacked(CoinIndexedVector * rowArray, int sequence);
708 protected:
713  int housekeeping(double objectiveChange);
716  void checkPrimalSolution(const double * rowActivities = NULL,
717  const double * columnActivies = NULL);
720  void checkDualSolution();
722  void checkBothSolutions();
727  double scaleObjective(double value);
729  int solveDW(CoinStructuredModel * model);
731  int solveBenders(CoinStructuredModel * model);
732 public:
743  void setValuesPassAction(double incomingInfeasibility,
744  double allowedInfeasibility);
746 
748 public:
750  inline double alphaAccuracy() const {
751  return alphaAccuracy_;
752  }
753  inline void setAlphaAccuracy(double value) {
754  alphaAccuracy_ = value;
755  }
756 public:
758  //inline double objectiveValue() const {
759  //return (objectiveValue_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset];
760  //}
762  inline void setDisasterHandler(ClpDisasterHandler * handler) {
763  disasterArea_ = handler;
764  }
767  return disasterArea_;
768  }
770  inline double largeValue() const {
771  return largeValue_;
772  }
773  void setLargeValue( double value) ;
775  inline double largestPrimalError() const {
776  return largestPrimalError_;
777  }
779  inline double largestDualError() const {
780  return largestDualError_;
781  }
783  inline void setLargestPrimalError(double value) {
784  largestPrimalError_ = value;
785  }
787  inline void setLargestDualError(double value) {
788  largestDualError_ = value;
789  }
791  inline double zeroTolerance() const {
792  return zeroTolerance_;/*factorization_->zeroTolerance();*/
793  }
795  inline void setZeroTolerance( double value) {
796  zeroTolerance_ = value;
797  }
799  inline int * pivotVariable() const {
800  return pivotVariable_;
801  }
803  inline bool automaticScaling() const {
804  return automaticScale_ != 0;
805  }
806  inline void setAutomaticScaling(bool onOff) {
807  automaticScale_ = onOff ? 1 : 0;
808  }
810  inline double currentDualTolerance() const {
811  return dualTolerance_;
812  }
813  inline void setCurrentDualTolerance(double value) {
814  dualTolerance_ = value;
815  }
817  inline double currentPrimalTolerance() const {
818  return primalTolerance_;
819  }
820  inline void setCurrentPrimalTolerance(double value) {
821  primalTolerance_ = value;
822  }
824  inline int numberRefinements() const {
825  return numberRefinements_;
826  }
827  void setNumberRefinements( int value) ;
829  inline double alpha() const {
830  return alpha_;
831  }
832  inline void setAlpha(double value) {
833  alpha_ = value;
834  }
836  inline double dualIn() const {
837  return dualIn_;
838  }
840  inline int pivotRow() const {
841  return pivotRow_;
842  }
843  inline void setPivotRow(int value) {
844  pivotRow_ = value;
845  }
847  double valueIncomingDual() const;
849 
850 protected:
856  int gutsOfSolution ( double * givenDuals,
857  const double * givenPrimals,
858  bool valuesPass = false);
860  void gutsOfDelete(int type);
862  void gutsOfCopy(const ClpSimplex & rhs);
874  bool createRim(int what, bool makeRowCopy = false, int startFinishOptions = 0);
876  void createRim1(bool initial);
878  void createRim4(bool initial);
880  void createRim5(bool initial);
885  void deleteRim(int getRidOfFactorizationData = 2);
887  bool sanityCheck();
889 public:
894  inline double * solutionRegion(int section) const {
895  if (!section) return rowActivityWork_;
896  else return columnActivityWork_;
897  }
898  inline double * djRegion(int section) const {
899  if (!section) return rowReducedCost_;
900  else return reducedCostWork_;
901  }
902  inline double * lowerRegion(int section) const {
903  if (!section) return rowLowerWork_;
904  else return columnLowerWork_;
905  }
906  inline double * upperRegion(int section) const {
907  if (!section) return rowUpperWork_;
908  else return columnUpperWork_;
909  }
910  inline double * costRegion(int section) const {
911  if (!section) return rowObjectiveWork_;
912  else return objectiveWork_;
913  }
915  inline double * solutionRegion() const {
916  return solution_;
917  }
918  inline double * djRegion() const {
919  return dj_;
920  }
921  inline double * lowerRegion() const {
922  return lower_;
923  }
924  inline double * upperRegion() const {
925  return upper_;
926  }
927  inline double * costRegion() const {
928  return cost_;
929  }
930  inline Status getStatus(int sequence) const {
931  return static_cast<Status> (status_[sequence] & 7);
932  }
933  inline void setStatus(int sequence, Status newstatus) {
934  unsigned char & st_byte = status_[sequence];
935  st_byte = static_cast<unsigned char>(st_byte & ~7);
936  st_byte = static_cast<unsigned char>(st_byte | newstatus);
937  }
939  bool startPermanentArrays();
944  void setInitialDenseFactorization(bool onOff);
945  bool initialDenseFactorization() const;
947  inline int sequenceIn() const {
948  return sequenceIn_;
949  }
950  inline int sequenceOut() const {
951  return sequenceOut_;
952  }
954  inline void setSequenceIn(int sequence) {
955  sequenceIn_ = sequence;
956  }
957  inline void setSequenceOut(int sequence) {
958  sequenceOut_ = sequence;
959  }
961  inline int directionIn() const {
962  return directionIn_;
963  }
964  inline int directionOut() const {
965  return directionOut_;
966  }
968  inline void setDirectionIn(int direction) {
969  directionIn_ = direction;
970  }
971  inline void setDirectionOut(int direction) {
972  directionOut_ = direction;
973  }
975  inline double valueOut() const {
976  return valueOut_;
977  }
979  inline void setValueOut(double value) {
980  valueOut_ = value;
981  }
983  inline void setLowerOut(double value) {
984  lowerOut_ = value;
985  }
987  inline void setUpperOut(double value) {
988  upperOut_ = value;
989  }
991  inline void setTheta(double value) {
992  theta_ = value;
993  }
995  inline int isColumn(int sequence) const {
996  return sequence < numberColumns_ ? 1 : 0;
997  }
999  inline int sequenceWithin(int sequence) const {
1000  return sequence < numberColumns_ ? sequence : sequence - numberColumns_;
1001  }
1003  inline double solution(int sequence) {
1004  return solution_[sequence];
1005  }
1007  inline double & solutionAddress(int sequence) {
1008  return solution_[sequence];
1009  }
1010  inline double reducedCost(int sequence) {
1011  return dj_[sequence];
1012  }
1013  inline double & reducedCostAddress(int sequence) {
1014  return dj_[sequence];
1015  }
1016  inline double lower(int sequence) {
1017  return lower_[sequence];
1018  }
1020  inline double & lowerAddress(int sequence) {
1021  return lower_[sequence];
1022  }
1023  inline double upper(int sequence) {
1024  return upper_[sequence];
1025  }
1027  inline double & upperAddress(int sequence) {
1028  return upper_[sequence];
1029  }
1030  inline double cost(int sequence) {
1031  return cost_[sequence];
1032  }
1034  inline double & costAddress(int sequence) {
1035  return cost_[sequence];
1036  }
1038  inline double originalLower(int iSequence) const {
1039  if (iSequence < numberColumns_) return columnLower_[iSequence];
1040  else
1041  return rowLower_[iSequence-numberColumns_];
1042  }
1044  inline double originalUpper(int iSequence) const {
1045  if (iSequence < numberColumns_) return columnUpper_[iSequence];
1046  else
1047  return rowUpper_[iSequence-numberColumns_];
1048  }
1050  inline double theta() const {
1051  return theta_;
1052  }
1055  inline double bestPossibleImprovement() const {
1056  return bestPossibleImprovement_;
1057  }
1059  inline ClpNonLinearCost * nonLinearCost() const {
1060  return nonLinearCost_;
1061  }
1074  inline int moreSpecialOptions() const {
1075  return moreSpecialOptions_;
1076  }
1089  inline void setMoreSpecialOptions(int value) {
1090  moreSpecialOptions_ = value;
1091  }
1093 
1095  inline void setFakeBound(int sequence, FakeBound fakeBound) {
1096  unsigned char & st_byte = status_[sequence];
1097  st_byte = static_cast<unsigned char>(st_byte & ~24);
1098  st_byte = static_cast<unsigned char>(st_byte | (fakeBound << 3));
1099  }
1100  inline FakeBound getFakeBound(int sequence) const {
1101  return static_cast<FakeBound> ((status_[sequence] >> 3) & 3);
1102  }
1103  inline void setRowStatus(int sequence, Status newstatus) {
1104  unsigned char & st_byte = status_[sequence+numberColumns_];
1105  st_byte = static_cast<unsigned char>(st_byte & ~7);
1106  st_byte = static_cast<unsigned char>(st_byte | newstatus);
1107  }
1108  inline Status getRowStatus(int sequence) const {
1109  return static_cast<Status> (status_[sequence+numberColumns_] & 7);
1110  }
1111  inline void setColumnStatus(int sequence, Status newstatus) {
1112  unsigned char & st_byte = status_[sequence];
1113  st_byte = static_cast<unsigned char>(st_byte & ~7);
1114  st_byte = static_cast<unsigned char>(st_byte | newstatus);
1115  }
1116  inline Status getColumnStatus(int sequence) const {
1117  return static_cast<Status> (status_[sequence] & 7);
1118  }
1119  inline void setPivoted( int sequence) {
1120  status_[sequence] = static_cast<unsigned char>(status_[sequence] | 32);
1121  }
1122  inline void clearPivoted( int sequence) {
1123  status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~32);
1124  }
1125  inline bool pivoted(int sequence) const {
1126  return (((status_[sequence] >> 5) & 1) != 0);
1127  }
1129  void setFlagged( int sequence);
1130  inline void clearFlagged( int sequence) {
1131  status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~64);
1132  }
1133  inline bool flagged(int sequence) const {
1134  return ((status_[sequence] & 64) != 0);
1135  }
1137  inline void setActive( int iRow) {
1138  status_[iRow] = static_cast<unsigned char>(status_[iRow] | 128);
1139  }
1140  inline void clearActive( int iRow) {
1141  status_[iRow] = static_cast<unsigned char>(status_[iRow] & ~128);
1142  }
1143  inline bool active(int iRow) const {
1144  return ((status_[iRow] & 128) != 0);
1145  }
1148  void createStatus() ;
1151  void allSlackBasis(bool resetSolution = false);
1152 
1154  inline int lastBadIteration() const {
1155  return lastBadIteration_;
1156  }
1158  inline int progressFlag() const {
1159  return (progressFlag_ & 3);
1160  }
1162  inline void forceFactorization(int value) {
1163  forceFactorization_ = value;
1164  }
1166  inline double rawObjectiveValue() const {
1167  return objectiveValue_;
1168  }
1170  void computeObjectiveValue(bool useWorkingSolution = false);
1176  inline int numberExtraRows() const {
1177  return numberExtraRows_;
1178  }
1181  inline int maximumBasic() const {
1182  return maximumBasic_;
1183  }
1185  inline int baseIteration() const {
1186  return baseIteration_;
1187  }
1189  void generateCpp( FILE * fp, bool defaultFactor = false);
1193  void setEmptyFactorization();
1195  void moveInfo(const ClpSimplex & rhs, bool justStatus = false);
1197 
1199  // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
1200  // *** At present only without scaling
1201  // *** Slacks havve -1.0 element (so == row activity) - take care
1203  void getBInvARow(int row, double* z, double * slack = NULL);
1204 
1206  void getBInvRow(int row, double* z);
1207 
1209  void getBInvACol(int col, double* vec);
1210 
1212  void getBInvCol(int col, double* vec);
1213 
1218  void getBasics(int* index);
1219 
1221  //-------------------------------------------------------------------------
1225  void setObjectiveCoefficient( int elementIndex, double elementValue );
1227  inline void setObjCoeff( int elementIndex, double elementValue ) {
1228  setObjectiveCoefficient( elementIndex, elementValue);
1229  }
1230 
1233  void setColumnLower( int elementIndex, double elementValue );
1234 
1237  void setColumnUpper( int elementIndex, double elementValue );
1238 
1240  void setColumnBounds( int elementIndex,
1241  double lower, double upper );
1242 
1251  void setColumnSetBounds(const int* indexFirst,
1252  const int* indexLast,
1253  const double* boundList);
1254 
1257  inline void setColLower( int elementIndex, double elementValue ) {
1258  setColumnLower(elementIndex, elementValue);
1259  }
1262  inline void setColUpper( int elementIndex, double elementValue ) {
1263  setColumnUpper(elementIndex, elementValue);
1264  }
1265 
1267  inline void setColBounds( int elementIndex,
1268  double newlower, double newupper ) {
1269  setColumnBounds(elementIndex, newlower, newupper);
1270  }
1271 
1278  inline void setColSetBounds(const int* indexFirst,
1279  const int* indexLast,
1280  const double* boundList) {
1281  setColumnSetBounds(indexFirst, indexLast, boundList);
1282  }
1283 
1286  void setRowLower( int elementIndex, double elementValue );
1287 
1290  void setRowUpper( int elementIndex, double elementValue ) ;
1291 
1293  void setRowBounds( int elementIndex,
1294  double lower, double upper ) ;
1295 
1302  void setRowSetBounds(const int* indexFirst,
1303  const int* indexLast,
1304  const double* boundList);
1306  void resize (int newNumberRows, int newNumberColumns);
1307 
1309 
1311 protected:
1312 
1337  double largeValue_;
1345  double dualBound_;
1347  double alpha_;
1349  double theta_;
1351  double lowerIn_;
1353  double valueIn_;
1355  double upperIn_;
1357  double dualIn_;
1359  double lowerOut_;
1361  double valueOut_;
1363  double upperOut_;
1365  double dualOut_;
1383  double * lower_;
1385  double * rowLowerWork_;
1389  double * upper_;
1391  double * rowUpperWork_;
1395  double * cost_;
1399  double * objectiveWork_;
1401  CoinIndexedVector * rowArray_[6];
1403  CoinIndexedVector * columnArray_[6];
1417  double * dj_;
1423  double * solution_;
1445  double * savedSolution_;
1466  unsigned char * saveStatus_;
1514 public:
1516  mutable int spareIntArray_[4];
1518  mutable double spareDoubleArray_[4];
1519 protected:
1523 };
1524 //#############################################################################
1533 void
1534 ClpSimplexUnitTest(const std::string & mpsDir);
1535 
1536 // For Devex stuff
1537 #define DEVEX_TRY_NORM 1.0e-4
1538 #define DEVEX_ADD_ONE 1.0
1539 #endif
void setLargestPrimalError(double value)
Largest error on Ax-b.
Definition: ClpSimplex.hpp:783
void stopFastDual2(ClpNodeStuff *stuff)
Stops Fast dual2.
ClpFactorization * factorization_
factorization
int housekeeping(double objectiveChange)
This does basis housekeeping and does values for in/out variables.
void setAlphaAccuracy(double value)
If problem is primal feasible.
Definition: ClpSimplex.hpp:753
double * costRegion() const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:927
double rawObjectiveValue() const
Raw objective value (so always minimize in primal)
int gutsOfSolution(double *givenDuals, const double *givenPrimals, bool valuesPass=false)
May change basis and then returns number changed.
int fathom(void *stuff)
Fathom - 1 if solution.
int numberExtraRows_
Number of extra rows.
double * perturbationArray_
Perturbation array (maximumPerturbationSize_)
void setAlpha(double value)
If problem is primal feasible.
Definition: ClpSimplex.hpp:832
double & reducedCostAddress(int sequence)
Return row or column sections - not as much needed as it once was.
bool pivoted(int sequence) const
To flag a variable (not inline to allow for column generation)
void createStatus()
Set up status array (can be used by OsiClp).
double largestPrimalError() const
Largest error on Ax-b.
Definition: ClpSimplex.hpp:775
int readGMPL(const char *filename, const char *dataName, bool keepNames=false)
Read GMPL files from the given filenames.
double * savedSolution_
Saved version of solution.
void setColumnSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of columns simultaneously The default implementation just invokes setColL...
double * columnLowerWork_
Column lower bounds - working copy.
int baseIteration_
Iteration when we entered dual or primal.
ClpDataSave saveData()
Save data.
void setDualRowPivotAlgorithm(ClpDualRowPivot &choice)
Sets row pivot choice algorithm in dual.
double largestPrimalError_
Largest error on Ax-b.
int lastBadIteration() const
So we know when to be cautious.
void setFactorizationFrequency(int value)
If problem is primal feasible.
int writeBasis(const char *filename, bool writeValues=false, int formatType=0) const
Write the basis in MPS format to the specified file.
void clearActive(int iRow)
To flag a variable (not inline to allow for column generation)
double originalLower(int iSequence) const
Return original lower bound.
double currentDualTolerance() const
Current dual tolerance.
Definition: ClpSimplex.hpp:810
int changeMade_
If change has been made (first attempt at stopping looping)
This is a very simple class to guide algorithms.
Definition: ClpSolve.hpp:20
Dual Row Pivot Abstract Base Class.
double allowedInfeasibility_
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
double incomingInfeasibility_
For advanced use.
double dualOut_
Infeasibility (dual) or ? (primal) of Out variable.
void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
double zeroTolerance_
Zero tolerance.
void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot &choice)
Sets column pivot choice algorithm in primal.
double scaleObjective(double value)
If input negative scales objective so maximum <= -value and returns scale factor used.
double largestDualError() const
Largest error on basic duals.
Definition: ClpSimplex.hpp:779
void add(double *array, int column, double multiplier) const
Adds multiple of a column into an array.
This is a tiny class where data can be saved round calls.
Definition: ClpModel.hpp:1217
void setLowerOut(double value)
Set lower of out variable.
Definition: ClpSimplex.hpp:983
int numberColumns_
Number of columns.
Definition: ClpModel.hpp:1086
double * rowUpper_
Row upper.
Definition: ClpModel.hpp:1098
bool sanityCheck()
Sanity check on input rim data (after scaling) - returns true if okay.
bool startPermanentArrays()
Start or reset using maximumRows_ and Columns_ - true if change.
int rowPrimalSequence_
Sequence of worst (-1 if feasible)
double sumPrimalInfeasibilities() const
Sum of primal infeasibilities.
Definition: ClpSimplex.hpp:571
int pivot()
Pivot in a variable and out a variable.
double * cost_
Working copy of objective (Owner of arrays below)
void setColumnUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
void setRowStatus(int sequence, Status newstatus)
To flag a variable (not inline to allow for column generation)
void restoreData(ClpDataSave saved)
Restore data.
double * djRegion(int section) const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:898
ClpNonLinearCost * nonLinearCost() const
Return pointer to details of costs.
int numberPrimalInfeasibilities_
Number of primal infeasibilities.
void setSumDualInfeasibilities(double value)
If problem is primal feasible.
Definition: ClpSimplex.hpp:549
void setSumOfRelaxedDualInfeasibilities(double value)
If problem is primal feasible.
Definition: ClpSimplex.hpp:556
int forceFactorization_
Now for some reliability aids This forces re-factorization early.
void setSparseFactorization(bool value)
If problem is primal feasible.
double & upperAddress(int sequence)
Return address of row or column upper bound.
int moreSpecialOptions_
More special options - see set for details.
void setNumberRefinements(int value)
If problem is primal feasible.
double zeroTolerance() const
Get zero tolerance.
Definition: ClpSimplex.hpp:791
int solveType() const
Solve type - 1 simplex, 2 simplex interface, 3 Interior.
Definition: ClpModel.hpp:367
Constraint Abstract Base Class.
void setSequenceOut(int sequence)
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:957
int maximumBasic() const
Maximum number of basic variables - can be more than number of rows if GUB.
double valueOut_
Value of Out variable.
void setPersistenceFlag(int value)
Array persistence flag If 0 then as now (delete/new) 1 then only do arrays if bigger needed 2 as 1 bu...
void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
CoinWarmStartBasis * getBasis() const
Returns a basis (to be deleted by user)
friend class OsiClpSolverInterface
Allow OsiClp certain perks.
void loadProblem(const ClpMatrixBase &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const double *rowObjective=NULL)
Loads a problem (the constraints on the rows are given by lower and upper bounds).
CoinPackedMatrix * matrix() const
Matrix (if not ClpPackedmatrix be careful about memory leak.
Definition: ClpModel.hpp:684
FakeBound getFakeBound(int sequence) const
To flag a variable (not inline to allow for column generation)
int strongBranching(int numberVariables, const int *variables, double *newLower, double *newUpper, double **outputSolution, int *outputStatus, int *outputIterations, bool stopOnFirstInfeasible=true, bool alwaysFinish=false, int startFinishOptions=0)
For strong branching.
int readBasis(const char *filename)
Read a basis from the given filename, returns -1 on file error, 0 if no values, 1 if values...
ClpSimplex * fastCrunch(ClpNodeStuff *stuff, int mode)
Deals with crunch aspects mode 0 - in 1 - out with solution 2 - out without solution returns small mo...
void createRim4(bool initial)
Does objective.
unsigned char * status_
Status (i.e.
Definition: ClpModel.hpp:1133
double * rowReducedCost_
Reduced costs of slacks not same as duals (or - duals)
double & solutionAddress(int sequence)
Return address of row or column values.
void gutsOfCopy(const ClpSimplex &rhs)
Does most of copying.
double lowerIn_
Lower Bound on In variable.
bool active(int iRow) const
To flag a variable (not inline to allow for column generation)
CoinIndexedVector * columnArray_[6]
Useful column length arrays.
void getBasics(int *index)
Get basic indices (order of indices corresponds to the order of elements in a vector retured by getBI...
ClpNonLinearCost * nonLinearCost_
Very wasteful way of dealing with infeasibilities in primal.
double solution(int sequence)
Return row or column values.
int dualDebug(int ifValuesPass=0, int startFinishOptions=0)
General solve algorithm which can do presolve.
void defaultFactorizationFrequency()
If user left factorization frequency then compute.
ClpSimplex & operator=(const ClpSimplex &rhs)
Assignment operator. This copies the data.
void setCurrentPrimalTolerance(double value)
If problem is primal feasible.
Definition: ClpSimplex.hpp:820
double sumDualInfeasibilities_
Sum of dual infeasibilities.
bool flagged(int sequence) const
To flag a variable (not inline to allow for column generation)
int primal(int ifValuesPass=0, int startFinishOptions=0)
Primal algorithm - see ClpSimplexPrimal.hpp for method.
bool automaticScaling() const
If automatic scaling on.
Definition: ClpSimplex.hpp:803
void setSumOfRelaxedPrimalInfeasibilities(double value)
If problem is primal feasible.
Definition: ClpSimplex.hpp:581
int numberRows() const
Number of rows.
Definition: ClpModel.hpp:309
int reducedGradient(int phase=0)
Solves non-linear using reduced gradient.
double largeValue() const
Large bound value (for complementarity etc)
Definition: ClpSimplex.hpp:770
int numberChanged_
Can be used for count of changed costs (dual) or changed bounds (primal)
void setColumnBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
int firstFree_
First free/super-basic variable (-1 if none)
int numberRefinements_
How many iterative refinements to do.
double * lowerRegion(int section) const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:902
ClpEventHandler * eventHandler() const
Event handler.
Definition: ClpModel.hpp:850
double * rowActivityWork_
Row activities - working copy.
void setValueOut(double value)
Set value of out variable.
Definition: ClpSimplex.hpp:979
For saving extra information to see if looping.
Definition: ClpSolve.hpp:244
void forceFactorization(int value)
Force re-factorization early.
void setValuesPassAction(double incomingInfeasibility, double allowedInfeasibility)
For advanced use.
int columnPrimalSequence_
Sequence of worst (-1 if feasible)
double alpha_
Alpha (pivot element)
Primal Column Pivot Abstract Base Class.
double * lowerRegion() const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:921
void checkPrimalSolution(const double *rowActivities=NULL, const double *columnActivies=NULL)
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Primal) ...
int directionOut() const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:964
double * reducedCostWork_
Possible scaled reduced costs.
double originalUpper(int iSequence) const
Return original lower bound.
double * columnUpper_
Column Upper.
Definition: ClpModel.hpp:1106
void checkBothSolutions()
This sets sum and number of infeasibilities (Dual and Primal)
void setInfeasibilityCost(double value)
If problem is primal feasible.
int isColumn(int sequence) const
Returns 1 if sequence indicates column.
Definition: ClpSimplex.hpp:995
double bestObjectiveValue_
"Best" objective value
int readMps(const char *filename, bool keepNames=false, bool ignoreErrors=false)
Read an mps file from the given filename.
void gutsOfDelete(int type)
Does most of deletion (0 = all, 1 = most, 2 most + factorization)
void setPivoted(int sequence)
To flag a variable (not inline to allow for column generation)
int cleanup(int cleanupScaling)
When scaling is on it is possible that the scaled problem is feasible but the unscaled is not...
void returnModel(ClpSimplex &otherModel)
Return model - updates any scalars.
int barrier(bool crossover=true)
Solves using barrier (assumes you have good cholesky factor code).
int * pivotVariable() const
Basic variables pivoting on which rows.
Definition: ClpSimplex.hpp:799
double sumOfRelaxedPrimalInfeasibilities_
Sum of Primal infeasibilities using tolerance based on error in primals.
double * rowObjective() const
Row Objective.
Definition: ClpModel.hpp:663
double * columnActivityWork_
Column activities - working copy.
ClpDisasterHandler * disasterHandler() const
Get disaster handler.
Definition: ClpSimplex.hpp:766
void computePrimals(const double *rowActivities, const double *columnActivities)
Computes primals from scratch.
double cost(int sequence)
Return row or column sections - not as much needed as it once was.
int dontFactorizePivots_
If may skip final factorize then allow up to this pivots (default 20)
ClpSimplex(bool emptyMessages=false)
Default constructor.
void checkSolutionInternal()
Just check solution (for internal use) - sets sum of infeasibilities etc.
void setCurrentDualTolerance(double value)
If problem is primal feasible.
Definition: ClpSimplex.hpp:813
double primalToleranceToGetOptimal_
Primal tolerance needed to make dual feasible (
void setToBaseModel(ClpSimplex *model=NULL)
Reset to base model (just size and arrays needed) If model NULL use internal copy.
int crash(double gap, int pivot)
Crash - at present just aimed at dual, returns -2 if dual preferred and crash basis created -1 if dua...
int algorithm() const
Current (or last) algorithm.
Definition: ClpSimplex.hpp:536
int lastBadIteration_
So we know when to be cautious.
int fastDual2(ClpNodeStuff *stuff)
Like Fast dual.
int numberPrimalInfeasibilities() const
Number of primal infeasibilities.
Definition: ClpSimplex.hpp:585
double sumPrimalInfeasibilities_
Sum of primal infeasibilities.
int baseIteration() const
Iteration when we entered dual or primal.
int numberDualInfeasibilitiesWithoutFree_
Number of dual infeasibilities (without free)
double acceptablePivot_
Acceptable pivot value just after factorization.
int numberDualInfeasibilities_
Number of dual infeasibilities.
void setUpperOut(double value)
Set upper of out variable.
Definition: ClpSimplex.hpp:987
ClpFactorization * swapFactorization(ClpFactorization *factorization)
General solve algorithm which can do presolve.
double * columnLower_
Column Lower.
Definition: ClpModel.hpp:1104
ClpDisasterHandler * disasterArea_
Disaster handler.
double * columnUpperWork_
Column upper bounds - working copy.
void setStatus(int sequence, Status newstatus)
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:933
void getBInvACol(int col, double *vec)
Get a column of the tableau.
int primalRanging(int numberCheck, const int *which, double *valueIncrease, int *sequenceIncrease, double *valueDecrease, int *sequenceDecrease)
Primal ranging.
int tightenPrimalBounds(double factor=0.0, int doTight=0, bool tightIntegers=false)
Tightens primal bounds to make dual faster.
void checkDualSolution()
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Dual) ...
void clearPivoted(int sequence)
To flag a variable (not inline to allow for column generation)
double largestDualError_
Largest error on basic duals.
double * solution_
Working copy of primal solution (Owner of arrays below)
void computeDuals(double *givenDjs)
Computes duals from scratch.
int startFastDual2(ClpNodeStuff *stuff)
Starts Fast dual2.
double valueIncomingDual() const
value of incoming variable (in Dual)
CoinIndexedVector * columnArray(int index) const
Useful column length arrays (0,1,2,3,4,5)
Definition: ClpSimplex.hpp:618
void ClpSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the ClpSimplex class.
int createPiecewiseLinearCosts(const int *starts, const double *lower, const double *gradient)
Constructs a non linear cost from list of non-linearities (columns only) First lower of each column i...
int lastFlaggedIteration_
So we know when to open up again.
void setDirectionIn(int direction)
Set directionIn or Out.
Definition: ClpSimplex.hpp:968
void setZeroTolerance(double value)
Set zero tolerance.
Definition: ClpSimplex.hpp:795
double theta() const
Theta (pivot change)
Status
enums for status of various sorts.
Definition: ClpSimplex.hpp:57
Status getColumnStatus(int sequence) const
To flag a variable (not inline to allow for column generation)
int internalFactorize(int solveType)
Factorizes using current basis.
void setLargestDualError(double value)
Largest error on basic duals.
Definition: ClpSimplex.hpp:787
void setFactorization(ClpFactorization &factorization)
Passes in factorization.
void generateCpp(FILE *fp, bool defaultFactor=false)
Create C++ lines to get to current state.
void setSequenceIn(int sequence)
Set sequenceIn or Out.
Definition: ClpSimplex.hpp:954
ClpSimplex * baseModel_
A copy of model with certain state - normally without cuts.
double * rowObjectiveWork_
Row objective - working copy.
double sumDualInfeasibilities() const
Sum of dual infeasibilities.
Definition: ClpSimplex.hpp:546
int numberColumns() const
Number of rows.
Definition: ClpModel.hpp:319
void setNumberPrimalInfeasibilities(int value)
If problem is primal feasible.
Definition: ClpSimplex.hpp:588
void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -DBL_MAX for -infinity.
double largeValue_
Large bound value (for complementarity etc)
bool initialDenseFactorization() const
Return row or column sections - not as much needed as it once was.
Status getStatus(int sequence) const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:930
ClpSimplex * baseModel() const
See if we have base model.
Definition: ClpSimplex.hpp:129
int sequenceWithin(int sequence) const
Returns sequence number within section.
Definition: ClpSimplex.hpp:999
double * rowUpperWork_
Row upper bounds - working copy.
void borrowModel(ClpModel &otherModel)
Borrow model.
double lowerOut_
Lower Bound on Out variable.
double dualIn_
Reduced cost of In variable.
int initialDualSolve()
Dual initial solve.
int maximumPerturbationSize_
Maximum perturbation array size (take out when code rewritten)
void setColumnLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
double bestPossibleImprovement() const
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
double valueIn_
Value of In variable.
Base class for Clp disaster handling.
void setTheta(double value)
Set theta of out variable.
Definition: ClpSimplex.hpp:991
int numberRefinements() const
How many iterative refinements to do.
Definition: ClpSimplex.hpp:824
void deleteBaseModel()
Switch off base model.
void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use DBL_MAX for infinity.
double * solutionRegion() const
Return region as single array.
Definition: ClpSimplex.hpp:915
void setNumberDualInfeasibilities(int value)
If problem is primal feasible.
Definition: ClpSimplex.hpp:563
int progressFlag() const
Progress flag - at present 0 bit says artificials out.
void setFlagged(int sequence)
To flag a variable (not inline to allow for column generation)
int getSolution()
Given an existing factorization computes and checks primal and dual solutions.
int saveModel(const char *fileName)
Save model to file, returns 0 if success.
ClpDualRowPivot * dualRowPivot() const
dual row pivot choice
Definition: ClpSimplex.hpp:644
void setActive(int iRow)
To say row active in primal pivot row choice.
double objectiveValue_
Objective value.
Definition: ClpModel.hpp:1076
int numberFake_
Can be used for count of fake bounds (dual) or fake costs (primal)
void setDirectionOut(int direction)
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:971
int sequenceIn_
Sequence of In variable.
double * upper_
Working copy of upper bounds (Owner of arrays below)
void setFakeBound(int sequence, FakeBound fakeBound)
To flag a variable (not inline to allow for column generation)
void setMoreSpecialOptions(int value)
Set more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolved ...
int readLp(const char *filename, const double epsilon=1e-5)
Read file in LP format from file with name filename.
int fathomMany(void *stuff)
Do up to N deep - returns -1 - no solution nNodes_ valid nodes >= if solution and that node gives sol...
int initialBarrierSolve()
Barrier initial solve.
int directionIn() const
Return direction In or Out.
Definition: ClpSimplex.hpp:961
int dual(int ifValuesPass=0, int startFinishOptions=0)
Dual algorithm - see ClpSimplexDual.hpp for method.
ClpSimplexProgress progress_
For dealing with all issues of cycling etc.
double * solutionRegion(int section) const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:894
bool statusOfProblem(bool initial=false)
Factorizes and returns true if optimal.
void setRowSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of rows simultaneously
int initialSolve()
Default initial solve.
double computeInternalObjectiveValue()
Compute minimization objective value from internal solution without perturbation. ...
double sumOfRelaxedPrimalInfeasibilities() const
Sum of relaxed primal infeasibilities.
Definition: ClpSimplex.hpp:578
friend void ClpSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the ClpSimplex class.
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:49
void setObjectiveCoefficient(int elementIndex, double elementValue)
Set an objective function coefficient.
int startup(int ifValuesPass, int startFinishOptions=0)
Common bits of coding for dual and primal.
double dualBound_
Dual bound.
double * upperRegion() const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:924
int automaticScale_
Automatic scaling of objective and rhs and bounds.
void checkSolution(int setToBounds=0)
Just check solution (for external use) - sets sum of infeasibilities etc.
void finish(int startFinishOptions=0)
Pivot in a variable and out a variable.
void createRim1(bool initial)
Does rows and columns.
double spareDoubleArray_[4]
Spare double array for passing information [0]!=0 switches on.
Base class for Clp event handling.
void moveInfo(const ClpSimplex &rhs, bool justStatus=false)
Move status and solution across.
void setAlgorithm(int value)
Set algorithm.
Definition: ClpSimplex.hpp:540
ClpPrimalColumnPivot * primalColumnPivot() const
primal column pivot choice
Definition: ClpSimplex.hpp:648
int dualRanging(int numberCheck, const int *which, double *costIncrease, int *sequenceIncrease, double *costDecrease, int *sequenceDecrease, double *valueIncrease=NULL, double *valueDecrease=NULL)
Dual ranging.
Abstract base class for Clp Matrices.
double sumOfRelaxedDualInfeasibilities_
Sum of Dual infeasibilities using tolerance based on error in duals.
int initialBarrierNoCrossSolve()
Barrier initial solve, not to be followed by crossover.
int moreSpecialOptions() const
Return more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolv...
Status getRowStatus(int sequence) const
To flag a variable (not inline to allow for column generation)
void originalModel(ClpSimplex *miniModel)
This copies back stuff from miniModel and then deletes miniModel.
double alphaAccuracy_
For computing whether to re-factorize.
int directionOut_
Direction of Out, 1 to upper bound, -1 to lower bound, 0 - superbasic.
int progressFlag_
Progress flag - at present 0 bit says artificials out, 1 free in.
double doubleCheck()
Double checks OK.
void setDualBound(double value)
If problem is primal feasible.
void passInEventHandler(const ClpEventHandler *eventHandler)
Pass in Event handler (cloned and deleted at end)
void setInitialDenseFactorization(bool onOff)
Normally the first factorization does sparse coding because the factorization could be singular...
int dualPivotResult()
Pivot out a variable and choose an incoing one.
void unpackPacked(CoinIndexedVector *rowArray)
Unpacks one column of the matrix into indexed array as packed vector Uses sequenceIn_ Also applies sc...
int spareIntArray_[4]
Spare int array for passing information [0]!=0 switches on.
double upperOut_
Upper Bound on Out variable.
bool primalFeasible() const
If problem is primal feasible.
Definition: ClpSimplex.hpp:488
void copyFactorization(ClpFactorization &factorization)
Copies in factorization to existing one.
double dualIn() const
Reduced cost of last incoming for use by classes e.g. steepestedge.
Definition: ClpSimplex.hpp:836
bool sparseFactorization() const
Sparsity on or off.
double * objectiveWork_
Column objective - working copy.
int solveDW(CoinStructuredModel *model)
Solve using Dantzig-Wolfe decomposition and maybe in parallel.
double * upperRegion(int section) const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:906
void getBInvCol(int col, double *vec)
Get a column of the basis inverse.
void setPivotRow(int value)
If problem is primal feasible.
Definition: ClpSimplex.hpp:843
double valueOut() const
Value of Out variable.
Definition: ClpSimplex.hpp:975
void setColSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of columns simultaneously
void getBInvRow(int row, double *z)
Get a row of the basis inverse.
double theta_
Theta (pivot change)
void resize(int newNumberRows, int newNumberColumns)
Resizes rim part of model.
void deleteRim(int getRidOfFactorizationData=2)
releases above arrays and does solution scaling out.
double dualBound() const
Dual bound.
Definition: ClpSimplex.hpp:506
double reducedCost(int sequence)
Return row or column sections - not as much needed as it once was.
bool goodAccuracy() const
Returns true if model looks OK.
Definition: ClpSimplex.hpp:652
int pivotRow_
Pivot Row.
double upper(int sequence)
Return row or column sections - not as much needed as it once was.
int factorizationFrequency() const
Factorization frequency.
double * costRegion(int section) const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:910
void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
ClpFactorization * getEmptyFactorization()
Gets clean and emptyish factorization.
void makeBaseModel()
Save a copy of model with certain state - normally without cuts.
void setColBounds(int elementIndex, double newlower, double newupper)
Set a single column lower and upper bound.
double * rowLowerWork_
Row lower bounds - working copy.
void setPerturbation(int value)
If problem is primal feasible.
int directionIn_
Direction of In, 1 going up, -1 going down, 0 not a clude.
void dropNames()
Drops names - makes lengthnames 0 and names empty.
double * rowLower_
Row lower.
Definition: ClpModel.hpp:1096
void computeObjectiveValue(bool useWorkingSolution=false)
Compute objective value from solution and put in objectiveValue_.
CoinIndexedVector * rowArray(int index) const
Useful row length arrays (0,1,2,3,4,5)
Definition: ClpSimplex.hpp:614
double * lower_
Working copy of lower bounds (Owner of arrays below)
void setColumnStatus(int sequence, Status newstatus)
To flag a variable (not inline to allow for column generation)
int factorize()
Factorizes using current basis. For external use.
int lastGoodIteration_
Last good iteration (immediately after a re-factorization)
int pivotRow() const
Pivot Row for use by classes e.g. steepestedge.
Definition: ClpSimplex.hpp:840
int solve(CoinStructuredModel *model)
Solve using structure of model and maybe in parallel.
int algorithm_
Algorithm >0 == Primal, <0 == Dual.
double alpha() const
Alpha (pivot element) for use by classes e.g. steepestedge.
Definition: ClpSimplex.hpp:829
double upperIn_
Upper Bound on In variable.
bool dualFeasible() const
If problem is dual feasible.
Definition: ClpSimplex.hpp:492
double sumOfRelaxedDualInfeasibilities() const
Sum of relaxed dual infeasibilities.
Definition: ClpSimplex.hpp:553
int sequenceOut_
Sequence of Out variable.
int sequenceIn() const
Return sequence In or Out.
Definition: ClpSimplex.hpp:947
int perturbation() const
Amount of print out: 0 - none 1 - just final 2 - just factorizations 3 - as 2 plus a bit more 4 - ver...
Definition: ClpSimplex.hpp:531
void setDisasterHandler(ClpDisasterHandler *handler)
Objective value.
Definition: ClpSimplex.hpp:762
int numberDualInfeasibilitiesWithoutFree() const
Number of dual infeasibilities (without free)
Definition: ClpSimplex.hpp:567
double bestPossibleImprovement_
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
void cleanStatus()
Clean up status.
void allSlackBasis(bool resetSolution=false)
Sets up all slack basis and resets solution to as it was after initial load or readMps.
~ClpSimplex()
Destructor.
int numberDualInfeasibilities() const
Number of dual infeasibilities.
Definition: ClpSimplex.hpp:560
void setLargeValue(double value)
If problem is primal feasible.
int maximumBasic_
Maximum number of basic variables - can be more than number of rows if GUB.
bool createRim(int what, bool makeRowCopy=false, int startFinishOptions=0)
puts in format I like (rowLower,rowUpper) also see StandardMatrix 1 bit does rows (now and columns)...
double & costAddress(int sequence)
Return address of row or column cost.
void getbackSolution(const ClpSimplex &smallModel, const int *whichRow, const int *whichColumn)
Puts solution back into small model.
double dualTolerance_
Current dual tolerance for algorithm.
int perturbation_
Perturbation: -50 to +50 - perturb by this power of ten (-6 sounds good) 100 - auto perturb if takes ...
ClpDualRowPivot * dualRowPivot_
dual row pivot choice
CoinIndexedVector * rowArray_[6]
Useful row length arrays.
int * pivotVariable_
Basic variables pivoting on which rows.
double currentPrimalTolerance() const
Current primal tolerance.
Definition: ClpSimplex.hpp:817
bool isObjectiveLimitTestValid() const
Return true if the objective limit test can be relied upon.
int numberExtraRows() const
Number of extra rows.
int nonlinearSLP(int numberPasses, double deltaTolerance)
Solves nonlinear problem using SLP - may be used as crash for other algorithms when number of iterati...
int primalPivotResult()
Pivot in a variable and choose an outgoing one.
int loadNonLinear(void *info, int &numberConstraints, ClpConstraint **&constraints)
Load nonlinear part of problem from AMPL info Returns 0 if linear 1 if quadratic objective 2 if quadr...
double infeasibilityCost_
Weight assigned to being infeasible in primal.
double lower(int sequence)
Return row or column sections - not as much needed as it once was.
void unpack(CoinIndexedVector *rowArray) const
Unpacks one column of the matrix into indexed array Uses sequenceIn_ Also applies scaling if needed...
void createRim5(bool initial)
Does rows and columns and objective.
int solveBenders(CoinStructuredModel *model)
Solve using Benders decomposition and maybe in parallel.
ClpFactorization * factorization() const
factorization
Definition: ClpSimplex.hpp:496
double & lowerAddress(int sequence)
Return address of row or column lower bound.
This just implements CoinFactorization when an ClpMatrixBase object is passed.
unsigned char * saveStatus_
Saved status regions.
void getBInvARow(int row, double *z, double *slack=NULL)
Get a row of the tableau (slack part in slack if not NULL)
int numberTimesOptimal_
Number of times code has tentatively thought optimal.
int sequenceOut() const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:950
ClpPrimalColumnPivot * primalColumnPivot_
primal column pivot choice
double alphaAccuracy() const
Initial value for alpha accuracy calculation (-1.0 off)
Definition: ClpSimplex.hpp:750
void setSumPrimalInfeasibilities(double value)
If problem is primal feasible.
Definition: ClpSimplex.hpp:574
void clearFlagged(int sequence)
To flag a variable (not inline to allow for column generation)
int restoreModel(const char *fileName)
Restore model from file, returns 0 if success, deletes current model.
double infeasibilityCost() const
Infeasibility cost.
Definition: ClpSimplex.hpp:511
double primalTolerance_
Current primal tolerance for algorithm.
void setEmptyFactorization()
May delete or may make clean and emptyish factorization.
double * djRegion() const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:918
int initialPrimalSolve()
Primal initial solve.
void setAutomaticScaling(bool onOff)
If problem is primal feasible.
Definition: ClpSimplex.hpp:806
void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
double * dj_
Working copy of reduced costs (Owner of arrays below)