Clp  1.17.8
ClpSimplex.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  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 #include "ClpConfig.h"
20 #include "CoinIndexedVector.hpp"
21 class ClpDualRowPivot;
23 class ClpFactorization;
24 class CoinFactorization;
25 class CoinIndexedVector;
26 class ClpNonLinearCost;
27 class ClpNodeStuff;
28 class CoinStructuredModel;
30 class CoinWarmStartBasis;
31 class ClpDisasterHandler;
32 class ClpConstraint;
33 /*
34  May want to use Clp defaults so that with ABC defined but not used
35  it behaves as Clp (and ABC used will be different than if not defined)
36  */
37 #ifdef ABC_INHERIT
38 #ifndef CLP_INHERIT_MODE
39 #define CLP_INHERIT_MODE 1
40 #endif
41 #ifndef ABC_CLP_DEFAULTS
42 #define ABC_CLP_DEFAULTS 0
43 #endif
44 #else
45 #undef ABC_CLP_DEFAULTS
46 #define ABC_CLP_DEFAULTS 1
47 #endif
48 #ifdef CLP_HAS_ABC
49 #include "AbcCommon.hpp"
50 class AbcTolerancesEtc;
51 class AbcSimplex;
52 #include "CoinAbcCommon.hpp"
53 #endif
54 #ifndef ABC_INHERIT
55 #if ABOCA_LITE
56 #ifndef FAKE_CILK
57 #include <cilk/cilk.h>
58 #else
59 #undef cilk_for
60 #undef cilk_spawn
61 #undef cilk_sync
62 #define cilk_for for
63 #define cilk_spawn
64 #define cilk_sync
65 #endif
66 #ifndef LONG_REGION_2
67 #define LONG_REGION_2 1
68 #endif
69 #define SHORT_REGION 1
70 #else
71 #define cilk_spawn
72 #define cilk_sync
73 #endif
74 #ifdef LONG_REGION_2
75 #define SHORT_REGION 1
76 #else
77 #define SHORT_REGION 2
78 #endif
79 // for now keep simple
80 #undef LONG_REGION_2
81 #undef SHORT_REGION
82 #define SHORT_REGION 2
83 #else
84 //ABC_INHERIT
85 #define LONG_REGION_2 1
86 #define SHORT_REGION 1
87 #endif
88 
106 class ClpSimplex : public ClpModel {
107  friend void ClpSimplexUnitTest(const std::string &mpsDir);
108 
109 public:
114  enum Status {
115  isFree = 0x00,
116  basic = 0x01,
117  atUpperBound = 0x02,
118  atLowerBound = 0x03,
119  superBasic = 0x04,
120  isFixed = 0x05
121  };
122  // For Dual
123  enum FakeBound {
124  noFake = 0x00,
125  lowerFake = 0x01,
126  upperFake = 0x02,
127  bothFake = 0x03
128  };
129 
132  ClpSimplex(bool emptyMessages = false);
134 
139  ClpSimplex(const ClpSimplex &rhs, int scalingMode = -1);
144  ClpSimplex(const ClpModel &rhs, int scalingMode = -1);
151  ClpSimplex(const ClpModel *wholeModel,
152  int numberRows, const int *whichRows,
153  int numberColumns, const int *whichColumns,
154  bool dropNames = true, bool dropIntegers = true,
155  bool fixOthers = false);
162  ClpSimplex(const ClpSimplex *wholeModel,
163  int numberRows, const int *whichRows,
164  int numberColumns, const int *whichColumns,
165  bool dropNames = true, bool dropIntegers = true,
166  bool fixOthers = false);
170  ClpSimplex(ClpSimplex *wholeModel,
171  int numberColumns, const int *whichColumns);
174  void originalModel(ClpSimplex *miniModel);
175 #ifdef ABC_INHERIT
176  inline int abcState() const
177  {
178  return abcState_;
179  }
180  inline void setAbcState(int state)
181  {
182  abcState_ = state;
183  }
184  inline AbcSimplex *abcSimplex() const
185  {
186  return abcSimplex_;
187  }
188  inline void setAbcSimplex(AbcSimplex *simplex)
189  {
190  abcSimplex_ = simplex;
191  }
193  int doAbcDual();
195  int doAbcPrimal(int ifValuesPass);
196 #endif
197 
202  void setPersistenceFlag(int value);
204  void makeBaseModel();
206  void deleteBaseModel();
208  inline ClpSimplex *baseModel() const
209  {
210  return baseModel_;
211  }
215  void setToBaseModel(ClpSimplex *model = NULL);
217  ClpSimplex &operator=(const ClpSimplex &rhs);
219  ~ClpSimplex();
220  // Ones below are just ClpModel with some changes
232  void loadProblem(const ClpMatrixBase &matrix,
233  const double *collb, const double *colub,
234  const double *obj,
235  const double *rowlb, const double *rowub,
236  const double *rowObjective = NULL);
237  void loadProblem(const CoinPackedMatrix &matrix,
238  const double *collb, const double *colub,
239  const double *obj,
240  const double *rowlb, const double *rowub,
241  const double *rowObjective = NULL);
242 
245  void loadProblem(const int numcols, const int numrows,
246  const CoinBigIndex *start, const int *index,
247  const double *value,
248  const double *collb, const double *colub,
249  const double *obj,
250  const double *rowlb, const double *rowub,
251  const double *rowObjective = NULL);
253  void loadProblem(const int numcols, const int numrows,
254  const CoinBigIndex *start, const int *index,
255  const double *value, const int *length,
256  const double *collb, const double *colub,
257  const double *obj,
258  const double *rowlb, const double *rowub,
259  const double *rowObjective = NULL);
264  int loadProblem(CoinModel &modelObject, bool keepSolution = false);
266  int readMps(const char *filename,
267  bool keepNames = false,
268  bool ignoreErrors = false);
270  int readGMPL(const char *filename, const char *dataName,
271  bool keepNames = false);
274  int readLp(const char *filename, const double epsilon = 1e-5);
279  void writeLp(const char *filename,
280  const char *extension = "lp",
281  double epsilon = 1e-5,
282  int numberAcross = 10,
283  int decimals = 5,
284  double objSense = 0.0,
285  bool useRowNames = true) const;
290  void borrowModel(ClpModel &otherModel);
291  void borrowModel(ClpSimplex &otherModel);
295  void getbackSolution(const ClpSimplex &smallModel, const int *whichRow, const int *whichColumn);
304  int loadNonLinear(void *info, int &numberConstraints,
305  ClpConstraint **&constraints);
306 #ifdef ABC_INHERIT
307  void loadTolerancesEtc(const AbcTolerancesEtc &data);
310  void unloadTolerancesEtc(AbcTolerancesEtc &data);
311 #endif
312 
313 
319  int initialSolve(ClpSolve &options);
321  int initialSolve();
323  int initialDualSolve();
325  int initialPrimalSolve();
327  int initialBarrierSolve();
340  int dual(int ifValuesPass = 0, int startFinishOptions = 0);
341  // If using Debug
342  int dualDebug(int ifValuesPass = 0, int startFinishOptions = 0);
353  int primal(int ifValuesPass = 0, int startFinishOptions = 0);
359  int nonlinearSLP(int numberPasses, double deltaTolerance);
365  int nonlinearSLP(int numberConstraints, ClpConstraint **constraints,
366  int numberPasses, double deltaTolerance);
369  int barrier(bool crossover = true);
372  int reducedGradient(int phase = 0);
374  int solve(CoinStructuredModel *model);
375 #ifdef ABC_INHERIT
376 
381  AbcSimplex *dealWithAbc(int solveType, int startUp, bool interrupt = false);
382  //void dealWithAbc(int solveType,int startUp,bool interrupt=false);
383 #endif
384 
390  int loadProblem(CoinStructuredModel &modelObject,
391  bool originalOrder = true, bool keepSolution = false);
406  int cleanup(int cleanupScaling);
417  int cleanPrimalSolution(double exactMultiple);
438  int dualRanging(int numberCheck, const int *which,
439  double *costIncrease, int *sequenceIncrease,
440  double *costDecrease, int *sequenceDecrease,
441  double *valueIncrease = NULL, double *valueDecrease = NULL);
456  int primalRanging(int numberCheck, const int *which,
457  double *valueIncrease, int *sequenceIncrease,
458  double *valueDecrease, int *sequenceDecrease);
468  int modifyCoefficientsAndPivot(int number,
469  const int *which,
470  const CoinBigIndex *start,
471  const int *row,
472  const double *newCoefficient,
473  const unsigned char *newStatus = NULL,
474  const double *newLower = NULL,
475  const double *newUpper = NULL,
476  const double *newObjective = NULL);
484  int outDuplicateRows(int numberLook, int *whichRows, bool noOverlaps = false, double tolerance = -1.0,
485  double cleanUp = 0.0);
488  double moveTowardsPrimalFeasible();
491  void removeSuperBasicSlacks(int threshold = 0);
504  ClpSimplex *miniPresolve(char *rowType, char *columnType, void **info);
506  void miniPostsolve(const ClpSimplex *presolvedModel, void *info);
508  void miniSolve(char *rowType, char *columnType, int algorithm, int startUp);
523  int writeBasis(const char *filename,
524  bool writeValues = false,
525  int formatType = 0) const;
528  int readBasis(const char *filename);
530  CoinWarmStartBasis *getBasis() const;
533  // Swaps factorization
546  int tightenPrimalBounds(double factor = 0.0, int doTight = 0, bool tightIntegers = false);
563  int crash(double gap, int pivot);
569  void markHotStart(void *&saveStuff);
571  void solveFromHotStart(void *saveStuff);
573  void unmarkHotStart(void *saveStuff);
582  int strongBranching(int numberVariables, const int *variables,
583  double *newLower, double *newUpper,
584  double **outputSolution,
585  int *outputStatus, int *outputIterations,
586  bool stopOnFirstInfeasible = true,
587  bool alwaysFinish = false,
588  int startFinishOptions = 0);
590  int fathom(void *stuff);
596  int fathomMany(void *stuff);
598  double doubleCheck();
600  int startFastDual2(ClpNodeStuff *stuff);
602  int fastDual2(ClpNodeStuff *stuff);
604  void stopFastDual2(ClpNodeStuff *stuff);
611  ClpSimplex *fastCrunch(ClpNodeStuff *stuff, int mode);
613 
621  int pivot();
622 
628  int primalPivotResult();
629 
635  int dualPivotResultPart1();
639  int pivotResultPart2(int algorithm, int state);
640 
652  int startup(int ifValuesPass, int startFinishOptions = 0);
653  void finish(int startFinishOptions = 0);
654 
656  bool statusOfProblem(bool initial = false);
660  void copyEnabledStuff(const ClpSimplex *rhs);
662 
665  inline bool primalFeasible() const
667  {
668  return (numberPrimalInfeasibilities_ == 0);
669  }
671  inline bool dualFeasible() const
672  {
673  return (numberDualInfeasibilities_ == 0);
674  }
677  {
678  return factorization_;
679  }
681  bool sparseFactorization() const;
682  void setSparseFactorization(bool value);
684  int factorizationFrequency() const;
685  void setFactorizationFrequency(int value);
687  inline double dualBound() const
688  {
689  return dualBound_;
690  }
691  void setDualBound(double value);
693  inline double infeasibilityCost() const
694  {
695  return infeasibilityCost_;
696  }
697  void setInfeasibilityCost(double value);
714  inline int perturbation() const
715  {
716  return perturbation_;
717  }
718  void setPerturbation(int value);
720  inline int algorithm() const
721  {
722  return algorithm_;
723  }
725  inline void setAlgorithm(int value)
726  {
727  algorithm_ = value;
728  }
730  bool isObjectiveLimitTestValid() const;
732  inline double sumDualInfeasibilities() const
733  {
735  }
736  inline void setSumDualInfeasibilities(double value)
737  {
738  sumDualInfeasibilities_ = value;
739  }
741  inline double sumOfRelaxedDualInfeasibilities() const
742  {
744  }
745  inline void setSumOfRelaxedDualInfeasibilities(double value)
746  {
748  }
750  inline int numberDualInfeasibilities() const
751  {
753  }
754  inline void setNumberDualInfeasibilities(int value)
755  {
757  }
760  {
762  }
764  inline double sumPrimalInfeasibilities() const
765  {
767  }
768  inline void setSumPrimalInfeasibilities(double value)
769  {
771  }
773  inline double sumOfRelaxedPrimalInfeasibilities() const
774  {
776  }
777  inline void setSumOfRelaxedPrimalInfeasibilities(double value)
778  {
780  }
782  inline int numberPrimalInfeasibilities() const
783  {
785  }
786  inline void setNumberPrimalInfeasibilities(int value)
787  {
789  }
796  int saveModel(const char *fileName);
799  int restoreModel(const char *fileName);
800 
808  void checkSolution(int setToBounds = 0);
811  void checkSolutionInternal();
813  void checkUnscaledSolution();
815  inline CoinIndexedVector *rowArray(int index) const
816  {
817  return rowArray_[index];
818  }
820  inline CoinIndexedVector *columnArray(int index) const
821  {
822  return columnArray_[index];
823  }
825 
826  /******************** End of most useful part **************/
832  int getSolution(const double *rowActivities,
833  const double *columnActivities);
837  int getSolution();
844  int createPiecewiseLinearCosts(const int *starts,
845  const double *lower, const double *gradient);
848  {
849  return dualRowPivot_;
850  }
853  {
854  return primalColumnPivot_;
855  }
857  inline bool goodAccuracy() const
858  {
859  return (largestPrimalError_ < 1.0e-7 && largestDualError_ < 1.0e-7);
860  }
862  void returnModel(ClpSimplex &otherModel);
870  int internalFactorize(int solveType);
874  void restoreData(ClpDataSave saved);
876  void cleanStatus();
878  int factorize();
881  void computeDuals(double *givenDjs);
883  void computePrimals(const double *rowActivities,
884  const double *columnActivities);
886  void add(double *array,
887  int column, double multiplier) const;
893  void unpack(CoinIndexedVector *rowArray) const;
899  void unpack(CoinIndexedVector *rowArray, int sequence) const;
906  void unpackPacked(CoinIndexedVector *rowArray);
913  void unpackPacked(CoinIndexedVector *rowArray, int sequence);
914 #ifndef CLP_USER_DRIVEN
915 protected:
916 #endif
917 
921  int housekeeping(double objectiveChange);
924  void checkPrimalSolution(const double *rowActivities = NULL,
925  const double *columnActivies = NULL);
928  void checkDualSolution();
930  void checkBothSolutions();
935  double scaleObjective(double value);
937  int solveDW(CoinStructuredModel *model, ClpSolve &options);
939  int solveBenders(CoinStructuredModel *model, ClpSolve &options);
940 
941 public:
952  void setValuesPassAction(double incomingInfeasibility,
953  double allowedInfeasibility);
956  int cleanFactorization(int ifValuesPass);
958 
960 public:
962  inline double alphaAccuracy() const
963  {
964  return alphaAccuracy_;
965  }
966  inline void setAlphaAccuracy(double value)
967  {
968  alphaAccuracy_ = value;
969  }
970 
971 public:
973  //inline double objectiveValue() const {
974  //return (objectiveValue_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset];
975  //}
978  {
979  disasterArea_ = handler;
980  }
983  {
984  return disasterArea_;
985  }
987  inline double largeValue() const
988  {
989  return largeValue_;
990  }
991  void setLargeValue(double value);
993  inline double largestPrimalError() const
994  {
995  return largestPrimalError_;
996  }
998  inline double largestDualError() const
999  {
1000  return largestDualError_;
1001  }
1003  inline void setLargestPrimalError(double value)
1004  {
1005  largestPrimalError_ = value;
1006  }
1008  inline void setLargestDualError(double value)
1009  {
1010  largestDualError_ = value;
1011  }
1013  inline double zeroTolerance() const
1014  {
1015  return zeroTolerance_; /*factorization_->zeroTolerance();*/
1016  }
1018  inline void setZeroTolerance(double value)
1019  {
1020  zeroTolerance_ = value;
1021  }
1023  inline int *pivotVariable() const
1024  {
1025  return pivotVariable_;
1026  }
1028  inline bool automaticScaling() const
1029  {
1030  return automaticScale_ != 0;
1031  }
1032  inline void setAutomaticScaling(bool onOff)
1033  {
1034  automaticScale_ = onOff ? 1 : 0;
1035  }
1037  inline double currentDualTolerance() const
1038  {
1039  return dualTolerance_;
1040  }
1041  inline void setCurrentDualTolerance(double value)
1042  {
1043  dualTolerance_ = value;
1044  }
1046  inline double currentPrimalTolerance() const
1047  {
1048  return primalTolerance_;
1049  }
1050  inline void setCurrentPrimalTolerance(double value)
1051  {
1052  primalTolerance_ = value;
1053  }
1055  inline int numberRefinements() const
1056  {
1057  return numberRefinements_;
1058  }
1059  void setNumberRefinements(int value);
1061  inline double alpha() const
1062  {
1063  return alpha_;
1064  }
1065  inline void setAlpha(double value)
1066  {
1067  alpha_ = value;
1068  }
1070  inline double dualIn() const
1071  {
1072  return dualIn_;
1073  }
1075  inline void setDualIn(double value)
1076  {
1077  dualIn_ = value;
1078  }
1080  inline int pivotRow() const
1081  {
1082  return pivotRow_;
1083  }
1084  inline void setPivotRow(int value)
1085  {
1086  pivotRow_ = value;
1087  }
1089  double valueIncomingDual() const;
1091 
1092 #ifndef CLP_USER_DRIVEN
1093 protected:
1094 #endif
1095 
1100  int gutsOfSolution(double *givenDuals,
1101  const double *givenPrimals,
1102  bool valuesPass = false);
1104  void gutsOfDelete(int type);
1106  void gutsOfCopy(const ClpSimplex &rhs);
1118  bool createRim(int what, bool makeRowCopy = false, int startFinishOptions = 0);
1120  void createRim1(bool initial);
1122  void createRim4(bool initial);
1124  void createRim5(bool initial);
1129  void deleteRim(int getRidOfFactorizationData = 2);
1131  bool sanityCheck();
1133 public:
1138  inline double *solutionRegion(int section) const
1139  {
1140  if (!section)
1141  return rowActivityWork_;
1142  else
1143  return columnActivityWork_;
1144  }
1145  inline double *djRegion(int section) const
1146  {
1147  if (!section)
1148  return rowReducedCost_;
1149  else
1150  return reducedCostWork_;
1151  }
1152  inline double *lowerRegion(int section) const
1153  {
1154  if (!section)
1155  return rowLowerWork_;
1156  else
1157  return columnLowerWork_;
1158  }
1159  inline double *upperRegion(int section) const
1160  {
1161  if (!section)
1162  return rowUpperWork_;
1163  else
1164  return columnUpperWork_;
1165  }
1166  inline double *costRegion(int section) const
1167  {
1168  if (!section)
1169  return rowObjectiveWork_;
1170  else
1171  return objectiveWork_;
1172  }
1174  inline double *solutionRegion() const
1175  {
1176  return solution_;
1177  }
1178  inline double *djRegion() const
1179  {
1180  return dj_;
1181  }
1182  inline double *lowerRegion() const
1183  {
1184  return lower_;
1185  }
1186  inline double *upperRegion() const
1187  {
1188  return upper_;
1189  }
1190  inline double *costRegion() const
1191  {
1192  return cost_;
1193  }
1194  inline Status getStatus(int sequence) const
1195  {
1196  return static_cast< Status >(status_[sequence] & 7);
1197  }
1198  inline void setStatus(int sequence, Status newstatus)
1199  {
1200  unsigned char &st_byte = status_[sequence];
1201  st_byte = static_cast< unsigned char >(st_byte & ~7);
1202  st_byte = static_cast< unsigned char >(st_byte | newstatus);
1203  }
1205  bool startPermanentArrays();
1210  void setInitialDenseFactorization(bool onOff);
1211  bool initialDenseFactorization() const;
1213  inline int sequenceIn() const
1214  {
1215  return sequenceIn_;
1216  }
1217  inline int sequenceOut() const
1218  {
1219  return sequenceOut_;
1220  }
1222  inline void setSequenceIn(int sequence)
1223  {
1224  sequenceIn_ = sequence;
1225  }
1226  inline void setSequenceOut(int sequence)
1227  {
1228  sequenceOut_ = sequence;
1229  }
1231  inline int directionIn() const
1232  {
1233  return directionIn_;
1234  }
1235  inline int directionOut() const
1236  {
1237  return directionOut_;
1238  }
1240  inline void setDirectionIn(int direction)
1241  {
1242  directionIn_ = direction;
1243  }
1244  inline void setDirectionOut(int direction)
1245  {
1246  directionOut_ = direction;
1247  }
1249  inline double valueOut() const
1250  {
1251  return valueOut_;
1252  }
1254  inline double lowerOut() const
1255  {
1256  return lowerOut_;
1257  }
1259  inline double upperOut() const
1260  {
1261  return upperOut_;
1262  }
1264  inline void setValueOut(double value)
1265  {
1266  valueOut_ = value;
1267  }
1269  inline double dualOut() const
1270  {
1271  return dualOut_;
1272  }
1274  inline void setDualOut(double value)
1275  {
1276  dualOut_ = value;
1277  }
1279  inline void setLowerOut(double value)
1280  {
1281  lowerOut_ = value;
1282  }
1284  inline void setUpperOut(double value)
1285  {
1286  upperOut_ = value;
1287  }
1289  inline void setTheta(double value)
1290  {
1291  theta_ = value;
1292  }
1294  inline int isColumn(int sequence) const
1295  {
1296  return sequence < numberColumns_ ? 1 : 0;
1297  }
1299  inline int sequenceWithin(int sequence) const
1300  {
1301  return sequence < numberColumns_ ? sequence : sequence - numberColumns_;
1302  }
1304  inline double solution(int sequence)
1305  {
1306  return solution_[sequence];
1307  }
1309  inline double &solutionAddress(int sequence)
1310  {
1311  return solution_[sequence];
1312  }
1313  inline double reducedCost(int sequence)
1314  {
1315  return dj_[sequence];
1316  }
1317  inline double &reducedCostAddress(int sequence)
1318  {
1319  return dj_[sequence];
1320  }
1321  inline double lower(int sequence)
1322  {
1323  return lower_[sequence];
1324  }
1326  inline double &lowerAddress(int sequence)
1327  {
1328  return lower_[sequence];
1329  }
1330  inline double upper(int sequence)
1331  {
1332  return upper_[sequence];
1333  }
1335  inline double &upperAddress(int sequence)
1336  {
1337  return upper_[sequence];
1338  }
1339  inline double cost(int sequence)
1340  {
1341  return cost_[sequence];
1342  }
1344  inline double &costAddress(int sequence)
1345  {
1346  return cost_[sequence];
1347  }
1349  inline double originalLower(int iSequence) const
1350  {
1351  if (iSequence < numberColumns_)
1352  return columnLower_[iSequence];
1353  else
1354  return rowLower_[iSequence - numberColumns_];
1355  }
1357  inline double originalUpper(int iSequence) const
1358  {
1359  if (iSequence < numberColumns_)
1360  return columnUpper_[iSequence];
1361  else
1362  return rowUpper_[iSequence - numberColumns_];
1363  }
1365  inline double theta() const
1366  {
1367  return theta_;
1368  }
1370  inline double lowerIn() const
1371  {
1372  return lowerIn_;
1373  }
1375  inline double valueIn() const
1376  {
1377  return valueIn_;
1378  }
1380  inline double upperIn() const
1381  {
1382  return upperIn_;
1383  }
1386  inline double bestPossibleImprovement() const
1387  {
1388  return bestPossibleImprovement_;
1389  }
1392  {
1393  return nonLinearCost_;
1394  }
1423  inline int moreSpecialOptions() const
1424  {
1425  return moreSpecialOptions_;
1426  }
1428  inline int vectorMode() const
1429  {
1430  return vectorMode_;
1431  }
1458  inline void setMoreSpecialOptions(int value)
1459  {
1460  moreSpecialOptions_ = value;
1461  }
1463  inline void setVectorMode(int value)
1464  {
1465  vectorMode_ = value;
1466  }
1468 
1470  inline void setFakeBound(int sequence, FakeBound fakeBound)
1471  {
1472  unsigned char &st_byte = status_[sequence];
1473  st_byte = static_cast< unsigned char >(st_byte & ~24);
1474  st_byte = static_cast< unsigned char >(st_byte | (fakeBound << 3));
1475  }
1476  inline FakeBound getFakeBound(int sequence) const
1477  {
1478  return static_cast< FakeBound >((status_[sequence] >> 3) & 3);
1479  }
1480  inline void setRowStatus(int sequence, Status newstatus)
1481  {
1482  unsigned char &st_byte = status_[sequence + numberColumns_];
1483  st_byte = static_cast< unsigned char >(st_byte & ~7);
1484  st_byte = static_cast< unsigned char >(st_byte | newstatus);
1485  }
1486  inline Status getRowStatus(int sequence) const
1487  {
1488  return static_cast< Status >(status_[sequence + numberColumns_] & 7);
1489  }
1490  inline void setColumnStatus(int sequence, Status newstatus)
1491  {
1492  unsigned char &st_byte = status_[sequence];
1493  st_byte = static_cast< unsigned char >(st_byte & ~7);
1494  st_byte = static_cast< unsigned char >(st_byte | newstatus);
1495  }
1496  inline Status getColumnStatus(int sequence) const
1497  {
1498  return static_cast< Status >(status_[sequence] & 7);
1499  }
1500  inline void setPivoted(int sequence)
1501  {
1502  status_[sequence] = static_cast< unsigned char >(status_[sequence] | 32);
1503  }
1504  inline void clearPivoted(int sequence)
1505  {
1506  status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~32);
1507  }
1508  inline bool pivoted(int sequence) const
1509  {
1510  return (((status_[sequence] >> 5) & 1) != 0);
1511  }
1513  void setFlagged(int sequence);
1514  inline void clearFlagged(int sequence)
1515  {
1516  status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~64);
1517  }
1518  inline bool flagged(int sequence) const
1519  {
1520  return ((status_[sequence] & 64) != 0);
1521  }
1523  inline void setActive(int iRow)
1524  {
1525  status_[iRow] = static_cast< unsigned char >(status_[iRow] | 128);
1526  }
1527  inline void clearActive(int iRow)
1528  {
1529  status_[iRow] = static_cast< unsigned char >(status_[iRow] & ~128);
1530  }
1531  inline bool active(int iRow) const
1532  {
1533  return ((status_[iRow] & 128) != 0);
1534  }
1536  inline void setPerturbed(int iSequence)
1537  {
1538  status_[iSequence] = static_cast< unsigned char >(status_[iSequence] | 128);
1539  }
1540  inline void clearPerturbed(int iSequence)
1541  {
1542  status_[iSequence] = static_cast< unsigned char >(status_[iSequence] & ~128);
1543  }
1544  inline bool perturbed(int iSequence) const
1545  {
1546  return ((status_[iSequence] & 128) != 0);
1547  }
1550  void createStatus();
1553  void allSlackBasis(bool resetSolution = false);
1554 
1556  inline int lastBadIteration() const
1557  {
1558  return lastBadIteration_;
1559  }
1561  inline void setLastBadIteration(int value)
1562  {
1563  lastBadIteration_ = value;
1564  }
1566  inline int progressFlag() const
1567  {
1568  return (progressFlag_ & 3);
1569  }
1572  {
1573  return &progress_;
1574  }
1576  inline int forceFactorization() const
1577  {
1578  return forceFactorization_;
1579  }
1581  inline void forceFactorization(int value)
1582  {
1583  forceFactorization_ = value;
1584  }
1586  inline double rawObjectiveValue() const
1587  {
1588  return objectiveValue_;
1589  }
1591  void computeObjectiveValue(bool useWorkingSolution = false);
1596  double *infeasibilityRay(bool fullRay = false) const;
1600  inline int numberExtraRows() const
1601  {
1602  return numberExtraRows_;
1603  }
1606  inline int maximumBasic() const
1607  {
1608  return maximumBasic_;
1609  }
1611  inline int baseIteration() const
1612  {
1613  return baseIteration_;
1614  }
1616  void generateCpp(FILE *fp, bool defaultFactor = false);
1620  void setEmptyFactorization();
1622  void moveInfo(const ClpSimplex &rhs, bool justStatus = false);
1624 
1626  // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
1627  // *** At present only without scaling
1628  // *** Slacks havve -1.0 element (so == row activity) - take care
1630  void getBInvARow(int row, double *z, double *slack = NULL);
1631 
1633  void getBInvRow(int row, double *z);
1634 
1636  void getBInvACol(int col, double *vec);
1637 
1639  void getBInvCol(int col, double *vec);
1640 
1645  void getBasics(int *index);
1646 
1648  //-------------------------------------------------------------------------
1652  void setObjectiveCoefficient(int elementIndex, double elementValue);
1654  inline void setObjCoeff(int elementIndex, double elementValue)
1655  {
1656  setObjectiveCoefficient(elementIndex, elementValue);
1657  }
1658 
1661  void setColumnLower(int elementIndex, double elementValue);
1662 
1665  void setColumnUpper(int elementIndex, double elementValue);
1666 
1668  void setColumnBounds(int elementIndex,
1669  double lower, double upper);
1670 
1679  void setColumnSetBounds(const int *indexFirst,
1680  const int *indexLast,
1681  const double *boundList);
1682 
1685  inline void setColLower(int elementIndex, double elementValue)
1686  {
1687  setColumnLower(elementIndex, elementValue);
1688  }
1691  inline void setColUpper(int elementIndex, double elementValue)
1692  {
1693  setColumnUpper(elementIndex, elementValue);
1694  }
1695 
1697  inline void setColBounds(int elementIndex,
1698  double newlower, double newupper)
1699  {
1700  setColumnBounds(elementIndex, newlower, newupper);
1701  }
1702 
1709  inline void setColSetBounds(const int *indexFirst,
1710  const int *indexLast,
1711  const double *boundList)
1712  {
1713  setColumnSetBounds(indexFirst, indexLast, boundList);
1714  }
1715 
1718  void setRowLower(int elementIndex, double elementValue);
1719 
1722  void setRowUpper(int elementIndex, double elementValue);
1723 
1725  void setRowBounds(int elementIndex,
1726  double lower, double upper);
1727 
1734  void setRowSetBounds(const int *indexFirst,
1735  const int *indexLast,
1736  const double *boundList);
1738  void resize(int newNumberRows, int newNumberColumns);
1739 
1741 
1743 protected:
1770  double largeValue_;
1778  double dualBound_;
1780  double alpha_;
1782  double theta_;
1784  double lowerIn_;
1786  double valueIn_;
1788  double upperIn_;
1790  double dualIn_;
1792  double lowerOut_;
1794  double valueOut_;
1796  double upperOut_;
1798  double dualOut_;
1818 #define CLP_INFEAS_SAVE 5
1821  double *lower_;
1823  double *rowLowerWork_;
1827  double *upper_;
1829  double *rowUpperWork_;
1833  double *cost_;
1839  CoinIndexedVector *rowArray_[6];
1841  CoinIndexedVector *columnArray_[6];
1855  double *dj_;
1861  double *solution_;
1904  unsigned char *saveStatus_;
1952 #ifdef ABC_INHERIT
1953  AbcSimplex *abcSimplex_;
1954  int abcState_;
1955 #define CLP_ABC_WANTED 1
1956 #define CLP_ABC_WANTED_PARALLEL 2
1957 #define CLP_ABC_FULL_DONE 8
1958  // bits 256,512,1024 for crash
1959 #endif
1960 #define CLP_ABC_BEEN_FEASIBLE 65536
1963 
1964 public:
1966  mutable int spareIntArray_[4];
1968  mutable double spareDoubleArray_[4];
1969 
1970 protected:
1976 };
1977 //#############################################################################
1986 void ClpSimplexUnitTest(const std::string &mpsDir);
1987 
1988 // For Devex stuff
1989 #define DEVEX_TRY_NORM 1.0e-4
1990 #define DEVEX_ADD_ONE 1.0
1991 #if defined(ABC_INHERIT) || defined(THREADS_IN_ANALYZE)
1992 // Use pthreads
1993 #include <pthread.h>
1994 typedef struct {
1995  double result;
1996  //const CoinIndexedVector * constVector; // can get rid of
1997  //CoinIndexedVector * vectors[2]; // can get rid of
1998  void *extraInfo;
1999  void *extraInfo2;
2000  int status;
2001  int stuff[4];
2002 } CoinThreadInfo;
2003 class CoinPthreadStuff {
2004 public:
2009  CoinPthreadStuff(int numberThreads = 0,
2010  void *parallelManager(void *stuff) = NULL);
2012  CoinPthreadStuff &operator=(const CoinPthreadStuff &rhs);
2014  ~CoinPthreadStuff();
2016  inline void setStopStart(int value)
2017  {
2018  stopStart_ = value;
2019  }
2020 #ifndef NUMBER_THREADS
2021 #define NUMBER_THREADS 8
2022 #endif
2023  // For waking up thread
2024  inline pthread_mutex_t *mutexPointer(int which, int thread = 0)
2025  {
2026  return mutex_ + which + 3 * thread;
2027  }
2028 #ifdef PTHREAD_BARRIER_SERIAL_THREAD
2029  inline pthread_barrier_t *barrierPointer()
2030  {
2031  return &barrier_;
2032  }
2033 #endif
2034  inline int whichLocked(int thread = 0) const
2035  {
2036  return locked_[thread];
2037  }
2038  inline CoinThreadInfo *threadInfoPointer(int thread = 0)
2039  {
2040  return threadInfo_ + thread;
2041  }
2042  void startParallelTask(int type, int iThread, void *info = NULL);
2043  int waitParallelTask(int type, int &iThread, bool allowIdle);
2044  void waitAllTasks();
2046  int whichThread() const;
2047  void sayIdle(int iThread);
2048  //void startThreads(int numberThreads);
2049  //void stopThreads();
2050  // For waking up thread
2051  pthread_mutex_t mutex_[3 * (NUMBER_THREADS + 1)];
2052 #ifdef PTHREAD_BARRIER_SERIAL_THREAD
2053  pthread_barrier_t barrier_;
2054 #endif
2055  CoinThreadInfo threadInfo_[NUMBER_THREADS + 1];
2056  pthread_t abcThread_[NUMBER_THREADS + 1];
2057  int locked_[NUMBER_THREADS + 1];
2058  int stopStart_;
2059  int numberThreads_;
2060 };
2061 void *clp_parallelManager(void *stuff);
2062 #endif
2063 typedef struct {
2064  double upperTheta;
2067  double tolerance;
2069  double theta;
2070  double primalRatio;
2071  double changeObj;
2072  const double *COIN_RESTRICT cost;
2075  const double *COIN_RESTRICT lower;
2076  const double *COIN_RESTRICT upper;
2080  const unsigned char *COIN_RESTRICT status;
2084  const double *COIN_RESTRICT element;
2085  const CoinBigIndex *COIN_RESTRICT start;
2086  const int *COIN_RESTRICT row;
2093 } clpTempInfo;
2094 #ifndef ABC_INHERIT
2095 #if ABOCA_LITE
2096 void moveAndZero(clpTempInfo *info, int type, void *extra);
2097 // 2 is owner of abcState_
2098 #ifdef ABCSTATE_LITE
2099 #if ABCSTATE_LITE == 2
2100 int abcState_ = 0;
2101 #else
2102 extern int abcState_;
2103 #endif
2104 inline int abcState()
2105 {
2106  return abcState_;
2107 }
2108 inline void setAbcState(int state)
2109 {
2110  abcState_ = state;
2111 }
2112 #endif
2113 #else
2114 #define abcState 0
2115 #endif
2116 #endif
2117 #ifdef CLP_USER_DRIVEN
2118 // expand as needed
2119 typedef struct {
2120  double alpha;
2121  double totalThru;
2122  double rhs;
2123  double value;
2124  double lower;
2125  double upper;
2126  double cost;
2127  int type;
2128  int row;
2129  int sequence;
2130  int printing;
2131  int change;
2132 } clpUserStruct;
2133 #endif
2134 #endif
2135 
2136 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
2137 */
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106
ClpFactorization
This just implements CoinFactorization when an ClpMatrixBase object is passed.
Definition: ClpFactorization.hpp:34
ClpSimplex::theta
double theta() const
Theta (pivot change)
Definition: ClpSimplex.hpp:1365
clpTempInfo::acceptablePivot
double acceptablePivot
Definition: ClpSimplex.hpp:2066
ClpSimplex::setLargestDualError
void setLargestDualError(double value)
Largest error on basic duals.
Definition: ClpSimplex.hpp:1008
ClpSimplex::sumOfRelaxedPrimalInfeasibilities_
double sumOfRelaxedPrimalInfeasibilities_
Sum of Primal infeasibilities using tolerance based on error in primals.
Definition: ClpSimplex.hpp:1812
ClpSimplex::initialBarrierSolve
int initialBarrierSolve()
Barrier initial solve.
ClpSimplex::setActive
void setActive(int iRow)
To say row active in primal pivot row choice.
Definition: ClpSimplex.hpp:1523
ClpSimplex::noFake
@ noFake
Definition: ClpSimplex.hpp:124
ClpSimplex::getBInvARow
void getBInvARow(int row, double *z, double *slack=NULL)
Get a row of the tableau (slack part in slack if not NULL)
ClpSimplex::firstFree_
int firstFree_
First free/super-basic variable (-1 if none)
Definition: ClpSimplex.hpp:1921
ClpSimplex::readLp
int readLp(const char *filename, const double epsilon=1e-5)
Read file in LP format from file with name filename.
ClpSimplex::setStatus
void setStatus(int sequence, Status newstatus)
Definition: ClpSimplex.hpp:1198
ClpSimplex::checkDualSolution
void checkDualSolution()
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Dual)
ClpSimplex::numberTimesOptimal_
int numberTimesOptimal_
Number of times code has tentatively thought optimal.
Definition: ClpSimplex.hpp:1885
ClpModel::columnUpper_
double * columnUpper_
Column Upper.
Definition: ClpModel.hpp:1279
ClpSimplex::alphaAccuracy
double alphaAccuracy() const
Initial value for alpha accuracy calculation (-1.0 off)
Definition: ClpSimplex.hpp:962
ClpSimplex::modifyCoefficientsAndPivot
int modifyCoefficientsAndPivot(int number, const int *which, const CoinBigIndex *start, const int *row, const double *newCoefficient, const unsigned char *newStatus=NULL, const double *newLower=NULL, const double *newUpper=NULL, const double *newObjective=NULL)
Modifies coefficients etc and if necessary pivots in and out.
ClpSimplex::moveInfo
void moveInfo(const ClpSimplex &rhs, bool justStatus=false)
Move status and solution across.
ClpSimplex::initialPrimalSolve
int initialPrimalSolve()
Primal initial solve.
ClpSimplex::setDualRowPivotAlgorithm
void setDualRowPivotAlgorithm(ClpDualRowPivot &choice)
Sets row pivot choice algorithm in dual.
ClpSimplex::setColLower
void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
Definition: ClpSimplex.hpp:1685
ClpSimplex::lastBadIteration
int lastBadIteration() const
So we know when to be cautious.
Definition: ClpSimplex.hpp:1556
ClpSimplex::progressFlag_
int progressFlag_
Progress flag - at present 0 bit says artificials out, 1 free in.
Definition: ClpSimplex.hpp:1919
ClpSolve
This is a very simple class to guide algorithms.
Definition: ClpSolve.hpp:20
ClpSimplex::algorithm_
int algorithm_
Algorithm >0 == Primal, <0 == Dual.
Definition: ClpSimplex.hpp:1891
ClpSimplex::rowArray
CoinIndexedVector * rowArray(int index) const
Useful row length arrays (0,1,2,3,4,5)
Definition: ClpSimplex.hpp:815
ClpSimplex::initialBarrierNoCrossSolve
int initialBarrierNoCrossSolve()
Barrier initial solve, not to be followed by crossover.
ClpSimplex::getRowStatus
Status getRowStatus(int sequence) const
Definition: ClpSimplex.hpp:1486
ClpSimplex::isColumn
int isColumn(int sequence) const
Returns 1 if sequence indicates column.
Definition: ClpSimplex.hpp:1294
ClpModel::solveType
int solveType() const
Solve type - 1 simplex, 2 simplex interface, 3 Interior.
Definition: ClpModel.hpp:391
ClpSimplex::primalFeasible
bool primalFeasible() const
If problem is primal feasible.
Definition: ClpSimplex.hpp:666
ClpSimplex::doubleCheck
double doubleCheck()
Double checks OK.
ClpSimplex::setDirectionOut
void setDirectionOut(int direction)
Definition: ClpSimplex.hpp:1244
OsiClpSolverInterface
Clp Solver Interface.
Definition: OsiClpSolverInterface.hpp:37
ClpSimplex::add
void add(double *array, int column, double multiplier) const
Adds multiple of a column into an array.
clpTempInfo::status
const unsigned char *COIN_RESTRICT status
Definition: ClpSimplex.hpp:2080
ClpSimplex::saveStatus_
unsigned char * saveStatus_
Saved status regions.
Definition: ClpSimplex.hpp:1904
ClpSimplex::factorization_
ClpFactorization * factorization_
factorization
Definition: ClpSimplex.hpp:1881
abcState
#define abcState
Definition: ClpSimplex.hpp:2114
ClpSimplex::setDisasterHandler
void setDisasterHandler(ClpDisasterHandler *handler)
Objective value.
Definition: ClpSimplex.hpp:977
clpTempInfo::which
int *COIN_RESTRICT which
Definition: ClpSimplex.hpp:2081
ClpSimplex::automaticScaling
bool automaticScaling() const
If automatic scaling on.
Definition: ClpSimplex.hpp:1028
ClpSimplex::automaticScale_
int automaticScale_
Automatic scaling of objective and rhs and bounds.
Definition: ClpSimplex.hpp:1943
ClpSimplex::numberPrimalInfeasibilities_
int numberPrimalInfeasibilities_
Number of primal infeasibilities.
Definition: ClpSimplex.hpp:1871
ClpSimplex::nonLinearCost
ClpNonLinearCost * nonLinearCost() const
Return pointer to details of costs.
Definition: ClpSimplex.hpp:1391
ClpSimplex::computeInternalObjectiveValue
double computeInternalObjectiveValue()
Compute minimization objective value from internal solution without perturbation.
ClpSimplex::dualBound_
double dualBound_
Dual bound.
Definition: ClpSimplex.hpp:1778
ClpSimplex::setSumDualInfeasibilities
void setSumDualInfeasibilities(double value)
Definition: ClpSimplex.hpp:736
ClpSimplex::passInEventHandler
void passInEventHandler(const ClpEventHandler *eventHandler)
Pass in Event handler (cloned and deleted at end)
ClpSimplex::setAlphaAccuracy
void setAlphaAccuracy(double value)
Definition: ClpSimplex.hpp:966
ClpSimplex::setColumnLower
void setColumnLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
ClpSimplex::dualOut
double dualOut() const
Dual value of Out variable.
Definition: ClpSimplex.hpp:1269
ClpSimplex::getStatus
Status getStatus(int sequence) const
Definition: ClpSimplex.hpp:1194
ClpSimplex::rowPrimalSequence_
int rowPrimalSequence_
Sequence of worst (-1 if feasible)
Definition: ClpSimplex.hpp:1758
ClpSimplex::directionOut_
int directionOut_
Direction of Out, 1 to upper bound, -1 to lower bound, 0 - superbasic.
Definition: ClpSimplex.hpp:1849
ClpModel::rowObjective
double * rowObjective() const
Row Objective.
Definition: ClpModel.hpp:746
ClpModel::columnLower_
double * columnLower_
Column Lower.
Definition: ClpModel.hpp:1277
ClpSimplex::borrowModel
void borrowModel(ClpModel &otherModel)
Borrow model.
ClpSimplex::writeBasis
int writeBasis(const char *filename, bool writeValues=false, int formatType=0) const
Write the basis in MPS format to the specified file.
ClpSimplex::loadNonLinear
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...
ClpSimplex::columnArray
CoinIndexedVector * columnArray(int index) const
Useful column length arrays (0,1,2,3,4,5)
Definition: ClpSimplex.hpp:820
ClpSimplex::readBasis
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::initialDualSolve
int initialDualSolve()
Dual initial solve.
clpTempInfo::numberColumns
int numberColumns
Definition: ClpSimplex.hpp:2092
clpTempInfo::changeObj
double changeObj
Definition: ClpSimplex.hpp:2071
ClpSimplex::fathomMany
int fathomMany(void *stuff)
Do up to N deep - returns -1 - no solution nNodes_ valid nodes >= if solution and that node gives sol...
ClpSimplex::costAddress
double & costAddress(int sequence)
Return address of row or column cost.
Definition: ClpSimplex.hpp:1344
ClpSimplex::setColBounds
void setColBounds(int elementIndex, double newlower, double newupper)
Set a single column lower and upper bound.
Definition: ClpSimplex.hpp:1697
ClpSimplex::dualOut_
double dualOut_
Infeasibility (dual) or ? (primal) of Out variable.
Definition: ClpSimplex.hpp:1798
ClpSimplex::solveDW
int solveDW(CoinStructuredModel *model, ClpSolve &options)
Solve using Dantzig-Wolfe decomposition and maybe in parallel.
ClpSimplex::perturbation
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:714
ClpDataSave
This is a tiny class where data can be saved round calls.
Definition: ClpModel.hpp:1402
ClpSimplex::numberDualInfeasibilitiesWithoutFree
int numberDualInfeasibilitiesWithoutFree() const
Number of dual infeasibilities (without free)
Definition: ClpSimplex.hpp:759
ClpSimplex::setSequenceOut
void setSequenceOut(int sequence)
Definition: ClpSimplex.hpp:1226
clpTempInfo::solution
double *COIN_RESTRICT solution
Definition: ClpSimplex.hpp:2073
ClpSimplex::solve
int solve(CoinStructuredModel *model)
Solve using structure of model and maybe in parallel.
ClpSimplex::solutionRegion
double * solutionRegion(int section) const
Return row or column sections - not as much needed as it once was.
Definition: ClpSimplex.hpp:1138
ClpSimplex::spareIntArray_
int spareIntArray_[4]
Spare int array for passing information [0]!=0 switches on.
Definition: ClpSimplex.hpp:1966
ClpSimplex::perturbation_
int perturbation_
Perturbation: -50 to +50 - perturb by this power of ten (-6 sounds good) 100 - auto perturb if takes ...
Definition: ClpSimplex.hpp:1902
ClpSimplex::valueIncomingDual
double valueIncomingDual() const
value of incoming variable (in Dual)
ClpSimplex::columnArray_
CoinIndexedVector * columnArray_[6]
Useful column length arrays.
Definition: ClpSimplex.hpp:1841
ClpSimplex::solutionRegion
double * solutionRegion() const
Return region as single array.
Definition: ClpSimplex.hpp:1174
ClpSimplex::operator=
ClpSimplex & operator=(const ClpSimplex &rhs)
Assignment operator. This copies the data.
ClpSimplex::columnUpperWork_
double * columnUpperWork_
Column upper bounds - working copy.
Definition: ClpSimplex.hpp:1831
ClpSimplex::deleteBaseModel
void deleteBaseModel()
Switch off base model.
ClpSimplex::clearPivoted
void clearPivoted(int sequence)
Definition: ClpSimplex.hpp:1504
ClpSimplex::currentDualTolerance
double currentDualTolerance() const
Current dual tolerance.
Definition: ClpSimplex.hpp:1037
ClpSimplex::setColSetBounds
void setColSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of columns simultaneously
Definition: ClpSimplex.hpp:1709
ClpSimplex::startFastDual2
int startFastDual2(ClpNodeStuff *stuff)
Starts Fast dual2.
ClpSimplex::getBasis
CoinWarmStartBasis * getBasis() const
Returns a basis (to be deleted by user)
CLP_INFEAS_SAVE
#define CLP_INFEAS_SAVE
Last few infeasibilities.
Definition: ClpSimplex.hpp:1818
clpTempInfo::startColumn
int startColumn
Definition: ClpSimplex.hpp:2090
ClpSimplex::lowerAddress
double & lowerAddress(int sequence)
Return address of row or column lower bound.
Definition: ClpSimplex.hpp:1326
ClpSimplex::saveModel
int saveModel(const char *fileName)
Save model to file, returns 0 if success.
ClpSimplex::lastBadIteration_
int lastBadIteration_
So we know when to be cautious.
Definition: ClpSimplex.hpp:1911
ClpSimplex::reducedCost
double reducedCost(int sequence)
Definition: ClpSimplex.hpp:1313
ClpSimplex::sumOfRelaxedDualInfeasibilities_
double sumOfRelaxedDualInfeasibilities_
Sum of Dual infeasibilities using tolerance based on error in duals.
Definition: ClpSimplex.hpp:1810
ClpSimplex::pivoted
bool pivoted(int sequence) const
Definition: ClpSimplex.hpp:1508
ClpMatrixBase.hpp
ClpSimplex::pivotVariable
int * pivotVariable() const
Basic variables pivoting on which rows.
Definition: ClpSimplex.hpp:1023
ClpSimplex::sanityCheck
bool sanityCheck()
Sanity check on input rim data (after scaling) - returns true if okay.
ClpSimplex::superBasic
@ superBasic
Definition: ClpSimplex.hpp:119
ClpSimplex::readGMPL
int readGMPL(const char *filename, const char *dataName, bool keepNames=false)
Read GMPL files from the given filenames.
ClpSimplex::baseIteration
int baseIteration() const
Iteration when we entered dual or primal.
Definition: ClpSimplex.hpp:1611
ClpSimplexUnitTest
void ClpSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the ClpSimplex class.
ClpSimplex::setSumPrimalInfeasibilities
void setSumPrimalInfeasibilities(double value)
Definition: ClpSimplex.hpp:768
ClpSimplex::checkSolution
void checkSolution(int setToBounds=0)
Just check solution (for external use) - sets sum of infeasibilities etc.
ClpSimplex::upperRegion
double * upperRegion() const
Definition: ClpSimplex.hpp:1186
ClpSimplex::sequenceOut
int sequenceOut() const
Definition: ClpSimplex.hpp:1217
ClpSimplex::lowerIn_
double lowerIn_
Lower Bound on In variable.
Definition: ClpSimplex.hpp:1784
ClpSimplex::sparseFactorization
bool sparseFactorization() const
Sparsity on or off.
clpTempInfo::lower
const double *COIN_RESTRICT lower
Definition: ClpSimplex.hpp:2075
ClpSimplex::bestPossibleImprovement
double bestPossibleImprovement() const
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
Definition: ClpSimplex.hpp:1386
ClpSimplex::bothFake
@ bothFake
Definition: ClpSimplex.hpp:127
ClpSimplex::directionOut
int directionOut() const
Definition: ClpSimplex.hpp:1235
clpTempInfo::upper
const double *COIN_RESTRICT upper
Definition: ClpSimplex.hpp:2076
ClpSimplex::setInfeasibilityCost
void setInfeasibilityCost(double value)
ClpSimplex::lowerOut
double lowerOut() const
Lower of out variable.
Definition: ClpSimplex.hpp:1254
ClpModel::matrix
CoinPackedMatrix * matrix() const
Matrix (if not ClpPackedmatrix be careful about memory leak.
Definition: ClpModel.hpp:773
ClpSimplex::createRim4
void createRim4(bool initial)
Does objective.
ClpSimplex::numberDualInfeasibilitiesWithoutFree_
int numberDualInfeasibilitiesWithoutFree_
Number of dual infeasibilities (without free)
Definition: ClpSimplex.hpp:1869
ClpModel.hpp
ClpSimplex::setMoreSpecialOptions
void setMoreSpecialOptions(int value)
Set more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolved ...
Definition: ClpSimplex.hpp:1458
ClpSimplex::columnPrimalSequence_
int columnPrimalSequence_
Sequence of worst (-1 if feasible)
Definition: ClpSimplex.hpp:1756
ClpSimplex::zeroTolerance_
double zeroTolerance_
Zero tolerance.
Definition: ClpSimplex.hpp:1754
ClpSimplex::averageInfeasibility_
double averageInfeasibility_[CLP_INFEAS_SAVE]
Definition: ClpSimplex.hpp:1819
ClpSimplex::djRegion
double * djRegion() const
Definition: ClpSimplex.hpp:1178
ClpSimplex::setAlpha
void setAlpha(double value)
Definition: ClpSimplex.hpp:1065
ClpModel
Definition: ClpModel.hpp:38
ClpSimplex::setLargeValue
void setLargeValue(double value)
ClpSimplex::getColumnStatus
Status getColumnStatus(int sequence) const
Definition: ClpSimplex.hpp:1496
clpTempInfo::dualTolerance
double dualTolerance
Definition: ClpSimplex.hpp:2068
ClpSimplex::maximumBasic
int maximumBasic() const
Maximum number of basic variables - can be more than number of rows if GUB.
Definition: ClpSimplex.hpp:1606
ClpSimplex::primalToleranceToGetOptimal_
double primalToleranceToGetOptimal_
Primal tolerance needed to make dual feasible (<largeTolerance)
Definition: ClpSimplex.hpp:1768
ClpSimplex::moreSpecialOptions_
int moreSpecialOptions_
More special options - see set for details.
Definition: ClpSimplex.hpp:1762
ClpSimplex::setNonLinearCost
void setNonLinearCost(ClpNonLinearCost &nonLinearCost)
Set pointer to details of costs.
ClpSimplex::restoreModel
int restoreModel(const char *fileName)
Restore model from file, returns 0 if success, deletes current model.
ClpSimplex::readMps
int readMps(const char *filename, bool keepNames=false, bool ignoreErrors=false)
Read an mps file from the given filename.
ClpSimplex::bestPossibleImprovement_
double bestPossibleImprovement_
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
Definition: ClpSimplex.hpp:1752
ClpSimplex::directionIn
int directionIn() const
Return direction In or Out.
Definition: ClpSimplex.hpp:1231
ClpSimplex::baseIteration_
int baseIteration_
Iteration when we entered dual or primal.
Definition: ClpSimplex.hpp:1764
ClpSimplex::setPerturbation
void setPerturbation(int value)
ClpSimplex::miniSolve
void miniSolve(char *rowType, char *columnType, int algorithm, int startUp)
mini presolve and solve
ClpSimplex::gutsOfCopy
void gutsOfCopy(const ClpSimplex &rhs)
Does most of copying.
clpTempInfo::pivotVariable
const int *COIN_RESTRICT pivotVariable
Definition: ClpSimplex.hpp:2083
ClpSimplex::primalColumnPivot_
ClpPrimalColumnPivot * primalColumnPivot_
primal column pivot choice
Definition: ClpSimplex.hpp:1877
ClpSimplex::alpha_
double alpha_
Alpha (pivot element)
Definition: ClpSimplex.hpp:1780
ClpSimplex::solveBenders
int solveBenders(CoinStructuredModel *model, ClpSolve &options)
Solve using Benders decomposition and maybe in parallel.
ClpSimplex::setColumnUpper
void setColumnUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
ClpSimplex::setValuesPassAction
void setValuesPassAction(double incomingInfeasibility, double allowedInfeasibility)
For advanced use.
ClpSimplex::columnActivityWork_
double * columnActivityWork_
Column activities - working copy.
Definition: ClpSimplex.hpp:1865
ClpSimplex::maximumBasic_
int maximumBasic_
Maximum number of basic variables - can be more than number of rows if GUB.
Definition: ClpSimplex.hpp:1928
clpTempInfo::upperTheta
double upperTheta
Definition: ClpSimplex.hpp:2064
ClpSimplex::maximumPerturbationSize_
int maximumPerturbationSize_
Maximum perturbation array size (take out when code rewritten)
Definition: ClpSimplex.hpp:1945
ClpSimplex::primal
int primal(int ifValuesPass=0, int startFinishOptions=0)
Primal algorithm - see ClpSimplexPrimal.hpp for method.
ClpSimplexProgress
For saving extra information to see if looping.
Definition: ClpSolve.hpp:310
ClpSimplex::setFactorization
void setFactorization(ClpFactorization &factorization)
Passes in factorization.
ClpSimplex::upperIn_
double upperIn_
Upper Bound on In variable.
Definition: ClpSimplex.hpp:1788
ClpSimplex::sumPrimalInfeasibilities
double sumPrimalInfeasibilities() const
Sum of primal infeasibilities.
Definition: ClpSimplex.hpp:764
ClpSimplex::largeValue_
double largeValue_
Large bound value (for complementarity etc)
Definition: ClpSimplex.hpp:1770
ClpSimplex::fastDual2
int fastDual2(ClpNodeStuff *stuff)
Like Fast dual.
ClpSimplex::getBasics
void getBasics(int *index)
Get basic indices (order of indices corresponds to the order of elements in a vector retured by getBI...
ClpSimplex::clearActive
void clearActive(int iRow)
Definition: ClpSimplex.hpp:1527
ClpSimplex::sequenceIn_
int sequenceIn_
Sequence of In variable.
Definition: ClpSimplex.hpp:1843
ClpSimplex::deleteRim
void deleteRim(int getRidOfFactorizationData=2)
releases above arrays and does solution scaling out.
ClpSimplex::pivotRow_
int pivotRow_
Pivot Row.
Definition: ClpSimplex.hpp:1851
ClpSimplex::minimumPrimalTolerance_
double minimumPrimalTolerance_
Minimum primal tolerance.
Definition: ClpSimplex.hpp:1816
ClpSimplex::returnModel
void returnModel(ClpSimplex &otherModel)
Return model - updates any scalars.
ClpSimplex::allSlackBasis
void allSlackBasis(bool resetSolution=false)
Sets up all slack basis and resets solution to as it was after initial load or readMps.
ClpSimplex::writeLp
void writeLp(const char *filename, const char *extension="lp", double epsilon=1e-5, int numberAcross=10, int decimals=5, double objSense=0.0, bool useRowNames=true) const
Write the problem into an Lp file of the given filename.
ClpSimplex::tightenPrimalBounds
int tightenPrimalBounds(double factor=0.0, int doTight=0, bool tightIntegers=false)
Tightens primal bounds to make dual faster.
ClpSimplex::unpack
void unpack(CoinIndexedVector *rowArray) const
Unpacks one column of the matrix into indexed array Uses sequenceIn_ Also applies scaling if needed.
ClpSimplex::vectorMode
int vectorMode() const
Get vector mode.
Definition: ClpSimplex.hpp:1428
ClpSimplex::copyFactorization
void copyFactorization(ClpFactorization &factorization)
Copies in factorization to existing one.
ClpSimplex::sequenceIn
int sequenceIn() const
Return sequence In or Out.
Definition: ClpSimplex.hpp:1213
ClpSimplex::valueIn_
double valueIn_
Value of In variable.
Definition: ClpSimplex.hpp:1786
ClpSimplex::upperOut_
double upperOut_
Upper Bound on Out variable.
Definition: ClpSimplex.hpp:1796
ClpSimplex::computePrimals
void computePrimals(const double *rowActivities, const double *columnActivities)
Computes primals from scratch.
ClpConstraint
Constraint Abstract Base Class.
Definition: ClpConstraint.hpp:18
AbcCommon.hpp
ClpDisasterHandler
Base class for Clp disaster handling.
Definition: ClpEventHandler.hpp:138
ClpSimplex::dj_
double * dj_
Working copy of reduced costs (Owner of arrays below)
Definition: ClpSimplex.hpp:1855
ClpSimplex::FakeBound
FakeBound
Definition: ClpSimplex.hpp:123
ClpSimplex::dualRanging
int dualRanging(int numberCheck, const int *which, double *costIncrease, int *sequenceIncrease, double *costDecrease, int *sequenceDecrease, double *valueIncrease=NULL, double *valueDecrease=NULL)
Dual ranging.
ClpSimplex::rowUpperWork_
double * rowUpperWork_
Row upper bounds - working copy.
Definition: ClpSimplex.hpp:1829
ClpSimplex::barrier
int barrier(bool crossover=true)
Solves using barrier (assumes you have good cholesky factor code).
ClpSimplex::nonlinearSLP
int nonlinearSLP(int numberPasses, double deltaTolerance)
Solves nonlinear problem using SLP - may be used as crash for other algorithms when number of iterati...
ClpSimplex::startPermanentArrays
bool startPermanentArrays()
Start or reset using maximumRows_ and Columns_ - true if change.
ClpSimplex::theta_
double theta_
Theta (pivot change)
Definition: ClpSimplex.hpp:1782
ClpSimplex::atLowerBound
@ atLowerBound
Definition: ClpSimplex.hpp:118
ClpSimplex::setPerturbed
void setPerturbed(int iSequence)
To say perturbed.
Definition: ClpSimplex.hpp:1536
ClpSimplex::numberChanged_
int numberChanged_
Can be used for count of changed costs (dual) or changed bounds (primal)
Definition: ClpSimplex.hpp:1917
ClpSimplex::sumDualInfeasibilities_
double sumDualInfeasibilities_
Sum of dual infeasibilities.
Definition: ClpSimplex.hpp:1804
ClpSimplex::pivot
int pivot()
Pivot in a variable and out a variable.
ClpSimplex::setRowLower
void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -DBL_MAX for -infinity.
ClpSimplex::setPivoted
void setPivoted(int sequence)
Definition: ClpSimplex.hpp:1500
clpTempInfo::numberInfeasibilities
int numberInfeasibilities
Definition: ClpSimplex.hpp:2088
ClpSimplex::setSparseFactorization
void setSparseFactorization(bool value)
ClpSimplex::factorizationFrequency
int factorizationFrequency() const
Factorization frequency.
ClpSimplex::lastGoodIteration_
int lastGoodIteration_
Last good iteration (immediately after a re-factorization)
Definition: ClpSimplex.hpp:1853
ClpSimplex::factorization
ClpFactorization * factorization() const
factorization
Definition: ClpSimplex.hpp:676
ClpSimplex::primalColumnPivot
ClpPrimalColumnPivot * primalColumnPivot() const
primal column pivot choice
Definition: ClpSimplex.hpp:852
ClpModel::numberColumns_
int numberColumns_
Number of columns.
Definition: ClpModel.hpp:1259
ClpSimplex::largestDualError
double largestDualError() const
Largest error on basic duals.
Definition: ClpSimplex.hpp:998
ClpSimplex::loadProblem
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).
ClpSimplex::solveFromHotStart
void solveFromHotStart(void *saveStuff)
Optimize starting from the hotstart.
ClpSimplex::costRegion
double * costRegion() const
Definition: ClpSimplex.hpp:1190
ClpSimplex::progressFlag
int progressFlag() const
Progress flag - at present 0 bit says artificials out.
Definition: ClpSimplex.hpp:1566
ClpSimplex::checkPrimalSolution
void checkPrimalSolution(const double *rowActivities=NULL, const double *columnActivies=NULL)
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Primal)
ClpMatrixBase
Abstract base class for Clp Matrices.
Definition: ClpMatrixBase.hpp:38
ClpSimplex::lowerRegion
double * lowerRegion() const
Definition: ClpSimplex.hpp:1182
ClpSimplex::fathom
int fathom(void *stuff)
Fathom - 1 if solution.
ClpSimplex::infeasibilityCost
double infeasibilityCost() const
Infeasibility cost.
Definition: ClpSimplex.hpp:693
ClpSimplex::dualBound
double dualBound() const
Dual bound.
Definition: ClpSimplex.hpp:687
ClpSimplex::setFactorizationFrequency
void setFactorizationFrequency(int value)
ClpSimplex::upperRegion
double * upperRegion(int section) const
Definition: ClpSimplex.hpp:1159
ClpSimplex::markHotStart
void markHotStart(void *&saveStuff)
Create a hotstart point of the optimization process.
clpTempInfo::row
const int *COIN_RESTRICT row
Definition: ClpSimplex.hpp:2086
ClpSimplex::acceptablePivot_
double acceptablePivot_
Acceptable pivot value just after factorization.
Definition: ClpSimplex.hpp:1814
ClpSimplex::costRegion
double * costRegion(int section) const
Definition: ClpSimplex.hpp:1166
ClpSimplex::cleanFactorization
int cleanFactorization(int ifValuesPass)
Get a clean factorization - i.e.
ClpSimplex::isFree
@ isFree
Definition: ClpSimplex.hpp:115
ClpSimplex::moveTowardsPrimalFeasible
double moveTowardsPrimalFeasible()
Try simple crash like techniques to get closer to primal feasibility returns final sum of infeasibili...
ClpSimplex::clearPerturbed
void clearPerturbed(int iSequence)
Definition: ClpSimplex.hpp:1540
ClpSimplex::pivotVariable_
int * pivotVariable_
Basic variables pivoting on which rows.
Definition: ClpSimplex.hpp:1879
ClpNodeStuff
Definition: ClpNode.hpp:188
ClpSimplex::setInitialDenseFactorization
void setInitialDenseFactorization(bool onOff)
Normally the first factorization does sparse coding because the factorization could be singular.
ClpSimplex::perturbationArray_
double * perturbationArray_
Perturbation array (maximumPerturbationSize_)
Definition: ClpSimplex.hpp:1947
clpTempInfo::theta
double theta
Definition: ClpSimplex.hpp:2069
ClpSimplex::cost_
double * cost_
Working copy of objective (Owner of arrays below)
Definition: ClpSimplex.hpp:1833
ClpSimplex::upper_
double * upper_
Working copy of upper bounds (Owner of arrays below)
Definition: ClpSimplex.hpp:1827
ClpSimplex::setPersistenceFlag
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...
ClpSimplex::copyEnabledStuff
void copyEnabledStuff(const ClpSimplex *rhs)
Copy across enabled stuff from one solver to another.
ClpSimplex::goodAccuracy
bool goodAccuracy() const
Returns true if model looks OK.
Definition: ClpSimplex.hpp:857
ClpSimplex::numberDualInfeasibilities_
int numberDualInfeasibilities_
Number of dual infeasibilities.
Definition: ClpSimplex.hpp:1867
ClpSimplex::setTheta
void setTheta(double value)
Set theta of out variable.
Definition: ClpSimplex.hpp:1289
ClpPrimalColumnPivot
Primal Column Pivot Abstract Base Class.
Definition: ClpPrimalColumnPivot.hpp:25
clpTempInfo::infeas
double *COIN_RESTRICT infeas
Definition: ClpSimplex.hpp:2082
ClpSimplex::setUpperOut
void setUpperOut(double value)
Set upper of out variable.
Definition: ClpSimplex.hpp:1284
ClpSimplex::setVectorMode
void setVectorMode(int value)
Set vector mode.
Definition: ClpSimplex.hpp:1463
ClpSimplex::rowActivityWork_
double * rowActivityWork_
Row activities - working copy.
Definition: ClpSimplex.hpp:1863
ClpSimplex::primalTolerance_
double primalTolerance_
Current primal tolerance for algorithm.
Definition: ClpSimplex.hpp:1802
ClpSimplex::statusOfProblem
bool statusOfProblem(bool initial=false)
Factorizes and returns true if optimal.
ClpSimplex::getEmptyFactorization
ClpFactorization * getEmptyFactorization()
Gets clean and emptyish factorization.
ClpSimplex::cleanStatus
void cleanStatus()
Clean up status.
ClpModel::objectiveValue_
double objectiveValue_
Objective value.
Definition: ClpModel.hpp:1249
ClpSimplex::strongBranching
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.
clpTempInfo::numberAdded
int numberAdded
Definition: ClpSimplex.hpp:2087
ClpSimplex::dualDebug
int dualDebug(int ifValuesPass=0, int startFinishOptions=0)
ClpSimplex::setColumnBounds
void setColumnBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
ClpSimplex::originalLower
double originalLower(int iSequence) const
Return original lower bound.
Definition: ClpSimplex.hpp:1349
ClpSimplex::reducedCostWork_
double * reducedCostWork_
Possible scaled reduced costs.
Definition: ClpSimplex.hpp:1859
ClpSimplex::moreSpecialOptions
int moreSpecialOptions() const
Return more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolv...
Definition: ClpSimplex.hpp:1423
ClpSimplex::getBInvCol
void getBInvCol(int col, double *vec)
Get a column of the basis inverse.
ClpSimplex::active
bool active(int iRow) const
Definition: ClpSimplex.hpp:1531
ClpSimplex::rowObjectiveWork_
double * rowObjectiveWork_
Row objective - working copy.
Definition: ClpSimplex.hpp:1835
ClpSimplex::startup
int startup(int ifValuesPass, int startFinishOptions=0)
Common bits of coding for dual and primal.
ClpSimplex::outDuplicateRows
int outDuplicateRows(int numberLook, int *whichRows, bool noOverlaps=false, double tolerance=-1.0, double cleanUp=0.0)
Take out duplicate rows (includes scaled rows and intersections).
AbcSimplex
Definition: AbcSimplex.hpp:62
ClpSimplex::rawObjectiveValue
double rawObjectiveValue() const
Raw objective value (so always minimize in primal)
Definition: ClpSimplex.hpp:1586
ClpSimplex::baseModel_
ClpSimplex * baseModel_
A copy of model with certain state - normally without cuts.
Definition: ClpSimplex.hpp:1949
clpTempInfo::element
const double *COIN_RESTRICT element
Definition: ClpSimplex.hpp:2084
ClpSimplex::dualIn_
double dualIn_
Reduced cost of In variable.
Definition: ClpSimplex.hpp:1790
ClpSimplex::cleanPrimalSolution
int cleanPrimalSolution(double exactMultiple)
Clean primal solution If you expect solution to only have exact multiples of "exactMultiple" then thi...
ClpSolve.hpp
COIN_RESTRICT
#define COIN_RESTRICT
Definition: ClpMatrixBase.hpp:21
ClpSimplex::ClpSimplexUnitTest
friend void ClpSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the ClpSimplex class.
ClpSimplex::numberRefinements_
int numberRefinements_
How many iterative refinements to do.
Definition: ClpSimplex.hpp:1873
clpTempInfo::tolerance
double tolerance
Definition: ClpSimplex.hpp:2067
ClpSimplex::columnLowerWork_
double * columnLowerWork_
Column lower bounds - working copy.
Definition: ClpSimplex.hpp:1825
ClpSimplex::numberExtraRows
int numberExtraRows() const
Number of extra rows.
Definition: ClpSimplex.hpp:1600
ClpSimplex::infeasibilityRay
double * infeasibilityRay(bool fullRay=false) const
Infeasibility/unbounded ray (NULL returned if none/wrong) Up to user to use delete [] on these arrays...
ClpSimplex::setFlagged
void setFlagged(int sequence)
To flag a variable (not inline to allow for column generation)
ClpSimplex::createRim1
void createRim1(bool initial)
Does rows and columns.
ClpSimplex::pivotRow
int pivotRow() const
Pivot Row for use by classes e.g. steepestedge.
Definition: ClpSimplex.hpp:1080
ClpSimplex::setZeroTolerance
void setZeroTolerance(double value)
Set zero tolerance.
Definition: ClpSimplex.hpp:1018
ClpSimplex::unpackPacked
void unpackPacked(CoinIndexedVector *rowArray)
Unpacks one column of the matrix into indexed array as packed vector Uses sequenceIn_ Also applies sc...
ClpSimplex::createRim
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),...
ClpSimplex::sumDualInfeasibilities
double sumDualInfeasibilities() const
Sum of dual infeasibilities.
Definition: ClpSimplex.hpp:732
ClpSimplex::disasterHandler
ClpDisasterHandler * disasterHandler() const
Get disaster handler.
Definition: ClpSimplex.hpp:982
ClpSimplex::swapFactorization
ClpFactorization * swapFactorization(ClpFactorization *factorization)
ClpSimplex::sequenceWithin
int sequenceWithin(int sequence) const
Returns sequence number within section.
Definition: ClpSimplex.hpp:1299
ClpSimplex::dualPivotResultPart1
int dualPivotResultPart1()
Pivot out a variable and choose an incoing one.
ClpSimplex::lowerIn
double lowerIn() const
Lower Bound on In variable.
Definition: ClpSimplex.hpp:1370
clpTempInfo::bestPossible
double bestPossible
Definition: ClpSimplex.hpp:2065
ClpSimplex::objectiveWork_
double * objectiveWork_
Column objective - working copy.
Definition: ClpSimplex.hpp:1837
ClpSimplex::algorithm
int algorithm() const
Current (or last) algorithm.
Definition: ClpSimplex.hpp:720
ClpSimplex::setFakeBound
void setFakeBound(int sequence, FakeBound fakeBound)
Definition: ClpSimplex.hpp:1470
ClpSimplex::sumOfRelaxedPrimalInfeasibilities
double sumOfRelaxedPrimalInfeasibilities() const
Sum of relaxed primal infeasibilities.
Definition: ClpSimplex.hpp:773
ClpSimplex::createPiecewiseLinearCosts
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...
ClpSimplex::setPivotRow
void setPivotRow(int value)
Definition: ClpSimplex.hpp:1084
ClpSimplex::solution
double solution(int sequence)
Return row or column values.
Definition: ClpSimplex.hpp:1304
ClpSimplex::bestObjectiveValue_
double bestObjectiveValue_
"Best" objective value
Definition: ClpSimplex.hpp:1760
ClpSimplex::dual
int dual(int ifValuesPass=0, int startFinishOptions=0)
Dual algorithm - see ClpSimplexDual.hpp for method.
ClpSimplex::generateCpp
void generateCpp(FILE *fp, bool defaultFactor=false)
Create C++ lines to get to current state.
ClpSimplex::directionIn_
int directionIn_
Direction of In, 1 going up, -1 going down, 0 not a clue.
Definition: ClpSimplex.hpp:1845
ClpSimplex::upper
double upper(int sequence)
Definition: ClpSimplex.hpp:1330
ClpSimplex::largestDualError_
double largestDualError_
Largest error on basic duals.
Definition: ClpSimplex.hpp:1774
ClpSimplex::initialDenseFactorization
bool initialDenseFactorization() const
ClpSimplex::disasterArea_
ClpDisasterHandler * disasterArea_
Disaster handler.
Definition: ClpSimplex.hpp:1887
ClpSimplex::OsiCLPSolverInterface
friend class OsiCLPSolverInterface
And OsiCLP.
Definition: ClpSimplex.hpp:1974
ClpSimplex::djRegion
double * djRegion(int section) const
Definition: ClpSimplex.hpp:1145
ClpSimplex::setObjectiveCoefficient
void setObjectiveCoefficient(int elementIndex, double elementValue)
Set an objective function coefficient.
ClpSimplex::sumPrimalInfeasibilities_
double sumPrimalInfeasibilities_
Sum of primal infeasibilities.
Definition: ClpSimplex.hpp:1806
ClpSimplex::setLastBadIteration
void setLastBadIteration(int value)
Set so we know when to be cautious.
Definition: ClpSimplex.hpp:1561
ClpConfig.h
ClpSimplex::progress_
ClpSimplexProgress progress_
For dealing with all issues of cycling etc.
Definition: ClpSimplex.hpp:1951
ClpSimplex::setValueOut
void setValueOut(double value)
Set value of out variable.
Definition: ClpSimplex.hpp:1264
ClpSimplex::setRowSetBounds
void setRowSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of rows simultaneously
ClpSimplex::dontFactorizePivots_
int dontFactorizePivots_
If may skip final factorize then allow up to this pivots (default 20)
Definition: ClpSimplex.hpp:1930
ClpSimplex::setAutomaticScaling
void setAutomaticScaling(bool onOff)
Definition: ClpSimplex.hpp:1032
clpTempInfo::work
double *COIN_RESTRICT work
Definition: ClpSimplex.hpp:2077
ClpSimplex::setSequenceIn
void setSequenceIn(int sequence)
Set sequenceIn or Out.
Definition: ClpSimplex.hpp:1222
ClpSimplex::perturbed
bool perturbed(int iSequence) const
Definition: ClpSimplex.hpp:1544
ClpSimplex::setObjCoeff
void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
Definition: ClpSimplex.hpp:1654
ClpSimplex::setAlgorithm
void setAlgorithm(int value)
Set algorithm.
Definition: ClpSimplex.hpp:725
ClpSimplex::numberFake_
int numberFake_
Can be used for count of fake bounds (dual) or fake costs (primal)
Definition: ClpSimplex.hpp:1915
ClpSimplex::valueOut_
double valueOut_
Value of Out variable.
Definition: ClpSimplex.hpp:1794
ClpSimplex::setDualOut
void setDualOut(double value)
Set dual value of out variable.
Definition: ClpSimplex.hpp:1274
clpTempInfo::cost
const double *COIN_RESTRICT cost
Definition: ClpSimplex.hpp:2072
clpTempInfo::start
const CoinBigIndex *COIN_RESTRICT start
Definition: ClpSimplex.hpp:2085
ClpSimplex::ClpSimplex
ClpSimplex(bool emptyMessages=false)
Default constructor.
ClpSimplex::saveData
ClpDataSave saveData()
Save data.
ClpSimplex::~ClpSimplex
~ClpSimplex()
Destructor.
ClpSimplex::numberRefinements
int numberRefinements() const
How many iterative refinements to do.
Definition: ClpSimplex.hpp:1055
ClpSimplex::isObjectiveLimitTestValid
bool isObjectiveLimitTestValid() const
Return true if the objective limit test can be relied upon.
clpTempInfo::numberRemaining
int numberRemaining
Definition: ClpSimplex.hpp:2089
ClpModel::rowLower_
double * rowLower_
Row lower.
Definition: ClpModel.hpp:1269
ClpSimplex::dualRowPivot
ClpDualRowPivot * dualRowPivot() const
dual row pivot choice
Definition: ClpSimplex.hpp:847
ClpSimplex::numberPrimalInfeasibilities
int numberPrimalInfeasibilities() const
Number of primal infeasibilities.
Definition: ClpSimplex.hpp:782
ClpSimplex::setColumnSetBounds
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...
ClpSimplex::dualFeasible
bool dualFeasible() const
If problem is dual feasible.
Definition: ClpSimplex.hpp:671
ClpSimplex::dualIn
double dualIn() const
Reduced cost of last incoming for use by classes e.g. steepestedge.
Definition: ClpSimplex.hpp:1070
ClpModel::status_
unsigned char * status_
Status (i.e.
Definition: ClpModel.hpp:1306
ClpSimplex::setDualIn
void setDualIn(double value)
Set reduced cost of last incoming to force error.
Definition: ClpSimplex.hpp:1075
ClpSimplex::alpha
double alpha() const
Alpha (pivot element) for use by classes e.g. steepestedge.
Definition: ClpSimplex.hpp:1061
ClpSimplex::housekeeping
int housekeeping(double objectiveChange)
This does basis housekeeping and does values for in/out variables.
ClpSimplex::lower
double lower(int sequence)
Definition: ClpSimplex.hpp:1321
ClpSimplex::setNumberDualInfeasibilities
void setNumberDualInfeasibilities(int value)
Definition: ClpSimplex.hpp:754
ClpSimplex::createRim5
void createRim5(bool initial)
Does rows and columns and objective.
ClpSimplex::setToBaseModel
void setToBaseModel(ClpSimplex *model=NULL)
Reset to base model (just size and arrays needed) If model NULL use internal copy.
ClpSimplex::setColumnStatus
void setColumnStatus(int sequence, Status newstatus)
Definition: ClpSimplex.hpp:1490
ClpSimplex::gutsOfDelete
void gutsOfDelete(int type)
Does most of deletion (0 = all, 1 = most, 2 most + factorization)
ClpSimplex::checkSolutionInternal
void checkSolutionInternal()
Just check solution (for internal use) - sets sum of infeasibilities etc.
ClpSimplex::getBInvRow
void getBInvRow(int row, double *z)
Get a row of the basis inverse.
ClpSimplex::sumOfRelaxedDualInfeasibilities
double sumOfRelaxedDualInfeasibilities() const
Sum of relaxed dual infeasibilities.
Definition: ClpSimplex.hpp:741
ClpDualRowPivot
Dual Row Pivot Abstract Base Class.
Definition: ClpDualRowPivot.hpp:22
clpTempInfo
Definition: ClpSimplex.hpp:2063
ClpSimplex::currentPrimalTolerance
double currentPrimalTolerance() const
Current primal tolerance.
Definition: ClpSimplex.hpp:1046
ClpSimplex::dualTolerance_
double dualTolerance_
Current dual tolerance for algorithm.
Definition: ClpSimplex.hpp:1800
ClpSimplex::setEmptyFactorization
void setEmptyFactorization()
May delete or may make clean and emptyish factorization.
ClpSimplex::cost
double cost(int sequence)
Definition: ClpSimplex.hpp:1339
ClpSimplex::forceFactorization
void forceFactorization(int value)
Force re-factorization early.
Definition: ClpSimplex.hpp:1581
ClpSimplex::getSolution
int getSolution()
Given an existing factorization computes and checks primal and dual solutions.
ClpSimplex::finish
void finish(int startFinishOptions=0)
ClpSimplex::fastCrunch
ClpSimplex * fastCrunch(ClpNodeStuff *stuff, int mode)
Deals with crunch aspects mode 0 - in 1 - out with solution 2 - out without solution returns small mo...
ClpSimplex::primalRanging
int primalRanging(int numberCheck, const int *which, double *valueIncrease, int *sequenceIncrease, double *valueDecrease, int *sequenceDecrease)
Primal ranging.
ClpSimplex::miniPostsolve
void miniPostsolve(const ClpSimplex *presolvedModel, void *info)
After mini presolve.
ClpSimplex::isFixed
@ isFixed
Definition: ClpSimplex.hpp:120
ClpSimplex::primalPivotResult
int primalPivotResult()
Pivot in a variable and choose an outgoing one.
ClpSimplex::restoreData
void restoreData(ClpDataSave saved)
Restore data.
ClpSimplex::valueOut
double valueOut() const
Value of Out variable.
Definition: ClpSimplex.hpp:1249
ClpSimplex::upperFake
@ upperFake
Definition: ClpSimplex.hpp:126
ClpSimplex::computeObjectiveValue
void computeObjectiveValue(bool useWorkingSolution=false)
Compute objective value from solution and put in objectiveValue_.
ClpModel::eventHandler
ClpEventHandler * eventHandler() const
Event handler.
Definition: ClpModel.hpp:1003
ClpEventHandler
Base class for Clp event handling.
Definition: ClpEventHandler.hpp:27
ClpModel::numberColumns
int numberColumns() const
Definition: ClpModel.hpp:332
ClpSimplex::numberDualInfeasibilities
int numberDualInfeasibilities() const
Number of dual infeasibilities.
Definition: ClpSimplex.hpp:750
ClpSimplex::atUpperBound
@ atUpperBound
Definition: ClpSimplex.hpp:117
clpTempInfo::index
int *COIN_RESTRICT index
Definition: ClpSimplex.hpp:2078
ClpSimplex::setColUpper
void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
Definition: ClpSimplex.hpp:1691
ClpSimplex::dualRowPivot_
ClpDualRowPivot * dualRowPivot_
dual row pivot choice
Definition: ClpSimplex.hpp:1875
ClpSimplex::checkBothSolutions
void checkBothSolutions()
This sets sum and number of infeasibilities (Dual and Primal)
ClpSimplex::solution_
double * solution_
Working copy of primal solution (Owner of arrays below)
Definition: ClpSimplex.hpp:1861
ClpSimplex::createStatus
void createStatus()
Set up status array (can be used by OsiClp).
ClpSimplex::miniPresolve
ClpSimplex * miniPresolve(char *rowType, char *columnType, void **info)
Mini presolve (faster) Char arrays must be numberRows and numberColumns long on entry second part mus...
ClpSimplex::allowedInfeasibility_
double allowedInfeasibility_
Definition: ClpSimplex.hpp:1941
ClpSimplex::setLowerOut
void setLowerOut(double value)
Set lower of out variable.
Definition: ClpSimplex.hpp:1279
ClpSimplex::reducedCostAddress
double & reducedCostAddress(int sequence)
Definition: ClpSimplex.hpp:1317
ClpSimplex::stopFastDual2
void stopFastDual2(ClpNodeStuff *stuff)
Stops Fast dual2.
ClpSimplex::cleanup
int cleanup(int cleanupScaling)
When scaling is on it is possible that the scaled problem is feasible but the unscaled is not.
ClpSimplex::gutsOfSolution
int gutsOfSolution(double *givenDuals, const double *givenPrimals, bool valuesPass=false)
May change basis and then returns number changed.
ClpSimplex::sequenceOut_
int sequenceOut_
Sequence of Out variable.
Definition: ClpSimplex.hpp:1847
ClpSimplex::rowReducedCost_
double * rowReducedCost_
Reduced costs of slacks not same as duals (or - duals)
Definition: ClpSimplex.hpp:1857
ClpSimplex::setDualBound
void setDualBound(double value)
ClpSimplex::defaultFactorizationFrequency
void defaultFactorizationFrequency()
If user left factorization frequency then compute.
ClpSimplex::largestPrimalError
double largestPrimalError() const
Largest error on Ax-b.
Definition: ClpSimplex.hpp:993
ClpSimplex::setRowUpper
void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use DBL_MAX for infinity.
ClpSimplex::computeDuals
void computeDuals(double *givenDjs)
Computes duals from scratch.
ClpSimplex::originalModel
void originalModel(ClpSimplex *miniModel)
This copies back stuff from miniModel and then deletes miniModel.
ClpSimplex::internalFactorize
int internalFactorize(int solveType)
Factorizes using current basis.
ClpSimplex::reducedGradient
int reducedGradient(int phase=0)
Solves non-linear using reduced gradient.
ClpSimplex::originalUpper
double originalUpper(int iSequence) const
Return original lower bound.
Definition: ClpSimplex.hpp:1357
ClpSimplex::initialSolve
int initialSolve()
Default initial solve.
ClpSimplex::upperOut
double upperOut() const
Upper of out variable.
Definition: ClpSimplex.hpp:1259
ClpSimplex::lowerRegion
double * lowerRegion(int section) const
Definition: ClpSimplex.hpp:1152
CoinAbcCommon.hpp
clpTempInfo::primalRatio
double primalRatio
Definition: ClpSimplex.hpp:2070
ClpSimplex::setRowStatus
void setRowStatus(int sequence, Status newstatus)
Definition: ClpSimplex.hpp:1480
ClpSimplex::crash
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...
ClpSimplex::numberExtraRows_
int numberExtraRows_
Number of extra rows.
Definition: ClpSimplex.hpp:1925
ClpSimplex::valueIn
double valueIn() const
Value of In variable.
Definition: ClpSimplex.hpp:1375
ClpSimplex::nonLinearCost_
ClpNonLinearCost * nonLinearCost_
Very wasteful way of dealing with infeasibilities in primal.
Definition: ClpSimplex.hpp:1909
ClpSimplex::largeValue
double largeValue() const
Large bound value (for complementarity etc)
Definition: ClpSimplex.hpp:987
ClpSimplex::largestPrimalError_
double largestPrimalError_
Largest error on Ax-b.
Definition: ClpSimplex.hpp:1772
ClpSimplex::infeasibilityCost_
double infeasibilityCost_
Weight assigned to being infeasible in primal.
Definition: ClpSimplex.hpp:1808
ClpSimplex::scaleObjective
double scaleObjective(double value)
If input negative scales objective so maximum <= -value and returns scale factor used.
ClpSimplex::clearFlagged
void clearFlagged(int sequence)
Definition: ClpSimplex.hpp:1514
ClpSimplex::numberDegeneratePivots_
int numberDegeneratePivots_
Number of degenerate pivots since last perturbed.
Definition: ClpSimplex.hpp:1962
ClpSimplex::setNumberPrimalInfeasibilities
void setNumberPrimalInfeasibilities(int value)
Definition: ClpSimplex.hpp:786
AbcTolerancesEtc
Definition: CoinAbcCommon.hpp:254
ClpSimplex::setRowBounds
void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
ClpSimplex::incomingInfeasibility_
double incomingInfeasibility_
For advanced use.
Definition: ClpSimplex.hpp:1940
clpTempInfo::reducedCost
double *COIN_RESTRICT reducedCost
Definition: ClpSimplex.hpp:2074
ClpSimplex::factorize
int factorize()
Factorizes using current basis. For external use.
NUMBER_THREADS
#define NUMBER_THREADS
Definition: AbcSimplex.hpp:1028
clpTempInfo::numberToDo
int numberToDo
Definition: ClpSimplex.hpp:2091
ClpSimplex::setDirectionIn
void setDirectionIn(int direction)
Set directionIn or Out.
Definition: ClpSimplex.hpp:1240
ClpSimplex::rowArray_
CoinIndexedVector * rowArray_[6]
Useful row length arrays.
Definition: ClpSimplex.hpp:1839
ClpSimplex::getBInvACol
void getBInvACol(int col, double *vec)
Get a column of the tableau.
ClpSimplex::forceFactorization
int forceFactorization() const
Force re-factorization early value.
Definition: ClpSimplex.hpp:1576
ClpSimplex::setSumOfRelaxedDualInfeasibilities
void setSumOfRelaxedDualInfeasibilities(double value)
Definition: ClpSimplex.hpp:745
ClpSimplex::removeSuperBasicSlacks
void removeSuperBasicSlacks(int threshold=0)
Try simple crash like techniques to remove super basic slacks but only if > threshold.
ClpSimplex::lastFlaggedIteration_
int lastFlaggedIteration_
So we know when to open up again.
Definition: ClpSimplex.hpp:1913
ClpSimplex::setPrimalColumnPivotAlgorithm
void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot &choice)
Sets column pivot choice algorithm in primal.
ClpSimplex::vectorMode_
int vectorMode_
Vector mode - try and use vector instructions.
Definition: ClpSimplex.hpp:1766
ClpSimplex::baseModel
ClpSimplex * baseModel() const
See if we have base model.
Definition: ClpSimplex.hpp:208
ClpSimplex::getbackSolution
void getbackSolution(const ClpSimplex &smallModel, const int *whichRow, const int *whichColumn)
Puts solution back into small model.
ClpSimplex::getFakeBound
FakeBound getFakeBound(int sequence) const
Definition: ClpSimplex.hpp:1476
ClpSimplex::basic
@ basic
Definition: ClpSimplex.hpp:116
ClpSimplex::resize
void resize(int newNumberRows, int newNumberColumns)
Resizes rim part of model.
ClpSimplex::lowerOut_
double lowerOut_
Lower Bound on Out variable.
Definition: ClpSimplex.hpp:1792
ClpSimplex::upperIn
double upperIn() const
Upper Bound on In variable.
Definition: ClpSimplex.hpp:1380
clpTempInfo::spare
double *COIN_RESTRICT spare
Definition: ClpSimplex.hpp:2079
ClpSimplex::checkUnscaledSolution
void checkUnscaledSolution()
Check unscaled primal solution but allow for rounding error.
ClpSimplex::makeBaseModel
void makeBaseModel()
Save a copy of model with certain state - normally without cuts.
ClpSimplex::savedSolution_
double * savedSolution_
Saved version of solution.
Definition: ClpSimplex.hpp:1883
ClpSimplex::setSumOfRelaxedPrimalInfeasibilities
void setSumOfRelaxedPrimalInfeasibilities(double value)
Definition: ClpSimplex.hpp:777
ClpSimplex::setCurrentPrimalTolerance
void setCurrentPrimalTolerance(double value)
Definition: ClpSimplex.hpp:1050
ClpSimplex::flagged
bool flagged(int sequence) const
Definition: ClpSimplex.hpp:1518
ClpSimplex::setLargestPrimalError
void setLargestPrimalError(double value)
Largest error on Ax-b.
Definition: ClpSimplex.hpp:1003
ClpSimplex::rowLowerWork_
double * rowLowerWork_
Row lower bounds - working copy.
Definition: ClpSimplex.hpp:1823
ClpSimplex::zeroTolerance
double zeroTolerance() const
Get zero tolerance.
Definition: ClpSimplex.hpp:1013
ClpModel::numberRows
int numberRows() const
Number of rows.
Definition: ClpModel.hpp:319
ClpSimplex::progress
ClpSimplexProgress * progress()
For dealing with all issues of cycling etc.
Definition: ClpSimplex.hpp:1571
ClpSimplex::pivotResultPart2
int pivotResultPart2(int algorithm, int state)
Do actual pivot state is 0 if need tableau column, 1 if in rowArray_[1].
ClpModel::rowUpper_
double * rowUpper_
Row upper.
Definition: ClpModel.hpp:1271
ClpModel::dropNames
void dropNames()
Drops names - makes lengthnames 0 and names empty.
ClpSimplex::changeMade_
int changeMade_
If change has been made (first attempt at stopping looping)
Definition: ClpSimplex.hpp:1889
ClpSimplex::forceFactorization_
int forceFactorization_
Now for some reliability aids This forces re-factorization early.
Definition: ClpSimplex.hpp:1894
ClpSimplex::unmarkHotStart
void unmarkHotStart(void *saveStuff)
Delete the snapshot.
ClpSimplex::solutionAddress
double & solutionAddress(int sequence)
Return address of row or column values.
Definition: ClpSimplex.hpp:1309
ClpSimplex::Status
Status
enums for status of various sorts.
Definition: ClpSimplex.hpp:114
ClpSimplex::lower_
double * lower_
Working copy of lower bounds (Owner of arrays below)
Definition: ClpSimplex.hpp:1821
ClpSimplex::lowerFake
@ lowerFake
Definition: ClpSimplex.hpp:125
ClpSimplex::setNumberRefinements
void setNumberRefinements(int value)
ClpSimplex::setCurrentDualTolerance
void setCurrentDualTolerance(double value)
Definition: ClpSimplex.hpp:1041
ClpSimplex::alphaAccuracy_
double alphaAccuracy_
For computing whether to re-factorize.
Definition: ClpSimplex.hpp:1776
ClpSimplex::spareDoubleArray_
double spareDoubleArray_[4]
Spare double array for passing information [0]!=0 switches on.
Definition: ClpSimplex.hpp:1968
ClpSimplex::upperAddress
double & upperAddress(int sequence)
Return address of row or column upper bound.
Definition: ClpSimplex.hpp:1335
ClpNonLinearCost
Definition: ClpNonLinearCost.hpp:77