AbcSimplex.hpp
Go to the documentation of this file.
1 /* $Id: AbcSimplex.hpp 2070 2014-11-18 11:12:54Z forrest $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others, Copyright (C) 2012, FasterCoin. 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 AbcSimplex_H
12 #define AbcSimplex_H
13 
14 #include <iostream>
15 #include <cfloat>
16 #include "ClpModel.hpp"
17 #include "ClpMatrixBase.hpp"
18 #include "CoinIndexedVector.hpp"
19 #include "AbcCommon.hpp"
20 class AbcSimplex;
21 #include "ClpSolve.hpp"
22 #include "CoinAbcCommon.hpp"
23 #include "ClpSimplex.hpp"
24 class AbcDualRowPivot;
27 class AbcNonLinearCost;
28 class OsiAbcSolverInterface;
29 class CoinWarmStartBasis;
30 class ClpDisasterHandler;
31 class AbcSimplexProgress;
32 class AbcMatrix;
33 class AbcTolerancesEtc;
34 
52 #define PAN
53 #if ABC_NORMAL_DEBUG>0
54 #define PRINT_PAN 1
55 #endif
56 #define TRY_ABC_GUS
57 #define HEAVY_PERTURBATION 57
58 #if ABC_PARALLEL==1
59 // Use pthreads
60 #include <pthread.h>
61 #endif
62 class AbcSimplex : public ClpSimplex {
63  friend void AbcSimplexUnitTest(const std::string & mpsDir);
64 
65 public:
74  enum Status {
75  atLowerBound = 0x00, // so we can use bottom two bits to sort and swap signs
76  atUpperBound = 0x01,
77  isFree = 0x04,
78  superBasic = 0x05,
79  basic = 0x06,
80  isFixed = 0x07
81  };
82  // For Dual
83  enum FakeBound {
84  noFake = 0x00,
85  lowerFake = 0x01,
86  upperFake = 0x02,
87  bothFake = 0x03
88  };
89 
92  AbcSimplex (bool emptyMessages = false );
94 
97  AbcSimplex(const AbcSimplex & rhs);
100  AbcSimplex(const ClpSimplex & rhs);
107  AbcSimplex (const ClpSimplex * wholeModel,
108  int numberRows, const int * whichRows,
109  int numberColumns, const int * whichColumns,
110  bool dropNames = true, bool dropIntegers = true,
111  bool fixOthers = false);
118  AbcSimplex (const AbcSimplex * wholeModel,
119  int numberRows, const int * whichRows,
120  int numberColumns, const int * whichColumns,
121  bool dropNames = true, bool dropIntegers = true,
122  bool fixOthers = false);
126  AbcSimplex (AbcSimplex * wholeModel,
127  int numberColumns, const int * whichColumns);
130  void originalModel(AbcSimplex * miniModel);
132  AbcSimplex (const ClpSimplex * clpSimplex);
134  void putBackSolution(ClpSimplex * simplex);
140  //void setPersistenceFlag(int value);
142  void makeBaseModel();
144  void deleteBaseModel();
146  inline AbcSimplex * baseModel() const {
147  return abcBaseModel_;
148  }
152  void setToBaseModel(AbcSimplex * model = NULL);
154  AbcSimplex & operator=(const AbcSimplex & rhs);
156  ~AbcSimplex ( );
158 
163  int dual();
164  int doAbcDual();
167  int primal(int ifValuesPass);
168  int doAbcPrimal(int ifValuesPass);
170  CoinWarmStartBasis * getBasis() const;
186  int tightenPrimalBounds();
195 
198  inline AbcSimplexFactorization * factorization() const {
200  return reinterpret_cast<AbcSimplexFactorization *>(abcFactorization_);
201  }
202 #ifdef EARLY_FACTORIZE
203  inline AbcSimplexFactorization * earlyFactorization() const {
205  return reinterpret_cast<AbcSimplexFactorization *>(abcEarlyFactorization_);
206  }
207 #endif
208  int factorizationFrequency() const;
210  void setFactorizationFrequency(int value);
212  inline int maximumAbcNumberRows() const
213  { return maximumAbcNumberRows_;}
215  inline int maximumNumberTotal() const
216  { return maximumNumberTotal_;}
217  inline int maximumTotal() const
218  { return maximumNumberTotal_;}
220  bool isObjectiveLimitTestValid() const ;
222  inline int numberTotal() const
223  { return numberTotal_;}
225  inline int numberTotalWithoutFixed() const
226  { return numberTotalWithoutFixed_;}
228  inline CoinPartitionedVector * usefulArray(int index) {
229  return & usefulArray_[index];
230  }
231  inline CoinPartitionedVector * usefulArray(int index) const {
232  return const_cast<CoinPartitionedVector *>(&usefulArray_[index]);
233  }
235 
236  /******************** End of most useful part **************/
242  int getSolution ();
250  void setupDualValuesPass(const double * fakeDuals,
251  const double * fakePrimals,
252  int type);
254  inline double minimizationObjectiveValue() const
257  inline double currentDualTolerance() const
258  { return currentDualTolerance_;}
259  inline void setCurrentDualTolerance(double value) {
260  currentDualTolerance_ = value;
261  }
264  return abcNonLinearCost_;
265  }
267  double * perturbationSaved() const
268  { return perturbationSaved_;}
270  inline double acceptablePivot() const
271  { return acceptablePivot_;}
273  inline int ordinaryVariables() const
274  { return ordinaryVariables_;}
276  inline int numberOrdinary() const
277  { return numberOrdinary_;}
279  inline void setNumberOrdinary(int number)
280  { numberOrdinary_=number;}
282  inline double currentDualBound() const
283  { return currentDualBound_;}
285  inline AbcDualRowPivot * dualRowPivot() const {
286  return abcDualRowPivot_;
287  }
290  return abcPrimalColumnPivot_;
291  }
293  inline AbcMatrix * abcMatrix() const {
294  return abcMatrix_;
295  }
305  int internalFactorize(int solveType);
321  void permuteIn();
323  void permuteBasis();
325  void permuteOut(int whatsWanted);
329  void restoreData(ClpDataSave saved);
331  void cleanStatus(bool valuesPass=false);
334  int computeDuals(double * givenDjs, CoinIndexedVector * array1, CoinIndexedVector * array2);
336  int computePrimals (CoinIndexedVector * array1, CoinIndexedVector * array2);
338  void computeObjective ();
340  void setMultipleSequenceIn(int sequenceIn[4]);
345  inline void unpack(CoinIndexedVector & rowArray) const
346  {unpack(rowArray,sequenceIn_);}
350  void unpack(CoinIndexedVector & rowArray, int sequence) const;
355  int housekeeping(/*double objectiveChange*/);
358  void checkPrimalSolution(bool justBasic);
361  void checkDualSolution();
366  void checkBothSolutions();
368  int gutsOfSolution(int type);
370  int gutsOfPrimalSolution(int type);
372  void saveGoodStatus();
374  void restoreGoodStatus(int type);
375 #define rowUseScale_ scaleFromExternal_
376 #define inverseRowUseScale_ scaleToExternal_
377  void refreshCosts();
379  void refreshLower(unsigned int type=~(ROW_LOWER_SAME|COLUMN_UPPER_SAME));
380  void refreshUpper(unsigned int type=~(ROW_LOWER_SAME|COLUMN_LOWER_SAME));
382  void setupPointers(int maxRows,int maxColumns);
384  void copyFromSaved(int type=31);
386  void fillPerturbation(int start, int number);
388  void checkArrays(int ignoreEmpty=0) const;
390  void checkDjs(int type=1) const;
392  void checkSolutionBasic() const;
394  void checkMoveBack(bool checkDuals);
395 public:
406  void setValuesPassAction(double incomingInfeasibility,
407  double allowedInfeasibility);
410  int cleanFactorization(int ifValuesPass);
412  void moveStatusToClp(ClpSimplex * clpModel);
414  void moveStatusFromClp(ClpSimplex * clpModel);
416 
418 public:
419 
421  inline double clpObjectiveValue() const {
423  }
426  inline int * pivotVariable() const {
427  return abcPivotVariable_;
428  }
430  inline int stateOfProblem() const
431  { return stateOfProblem_;}
433  inline void setStateOfProblem(int value)
434  { stateOfProblem_=value;}
436  //inline int * fromExternal() const
437  //{ return fromExternal_;}
439  //inline int * toExternal() const
440  //{return toExternal_;}
443  inline double * scaleFromExternal() const
444  {return scaleFromExternal_;}
447  inline double * scaleToExternal() const
448  {return scaleToExternal_;}
450  inline double * rowScale2() const
451  {return rowUseScale_;}
452  inline double * inverseRowScale2() const
453  {return inverseRowUseScale_;}
454  inline double * inverseColumnScale2() const
455  {return inverseColumnUseScale_;}
456  inline double * columnScale2() const
457  {return columnUseScale_;}
458  inline int arrayForDualColumn() const
459  {return arrayForDualColumn_;}
461  inline double upperTheta() const
462  {return upperTheta_;}
463  inline int arrayForReplaceColumn() const
464  { return arrayForReplaceColumn_;}
465  inline int arrayForFlipBounds() const
466  { return arrayForFlipBounds_;}
467  inline int arrayForFlipRhs() const
468  { return arrayForFlipRhs_;}
469  inline int arrayForBtran() const
470  { return arrayForBtran_;}
471  inline int arrayForFtran() const
472  { return arrayForFtran_;}
473  inline int arrayForTableauRow() const
474  { return arrayForTableauRow_;}
476  double valueIncomingDual() const;
478  const double * getColSolution() const;
479 
481  const double * getRowPrice() const;
482 
484  const double * getReducedCost() const;
485 
488  const double * getRowActivity() const;
490 
496  int gutsOfSolution ( double * givenDuals,
497  const double * givenPrimals,
498  bool valuesPass = false);
500  void gutsOfDelete(int type);
502  void gutsOfCopy(const AbcSimplex & rhs);
504  void gutsOfInitialize(int numberRows,int numberColumns,bool doMore);
506  void gutsOfResize(int numberRows,int numberColumns);
510  void translate(int type);
512  void moveToBasic(int which=15);
514 public:
517  inline double * solutionRegion() const {
519  return abcSolution_;
520  }
521  inline double * djRegion() const {
522  return abcDj_;
523  }
524  inline double * lowerRegion() const {
525  return abcLower_;
526  }
527  inline double * upperRegion() const {
528  return abcUpper_;
529  }
530  inline double * costRegion() const {
531  return abcCost_;
532  }
534  inline double * solutionRegion(int which) const {
535  return abcSolution_+which*maximumAbcNumberRows_;
536  }
537  inline double * djRegion(int which) const {
538  return abcDj_+which*maximumAbcNumberRows_;
539  }
540  inline double * lowerRegion(int which) const {
541  return abcLower_+which*maximumAbcNumberRows_;
542  }
543  inline double * upperRegion(int which) const {
544  return abcUpper_+which*maximumAbcNumberRows_;
545  }
546  inline double * costRegion(int which) const {
547  return abcCost_+which*maximumAbcNumberRows_;
548  }
550  inline double * solutionBasic() const {
551  return solutionBasic_;
552  }
553  inline double * djBasic() const {
554  return djBasic_;
555  }
556  inline double * lowerBasic() const {
557  return lowerBasic_;
558  }
559  inline double * upperBasic() const {
560  return upperBasic_;
561  }
562  inline double * costBasic() const {
563  return costBasic_;
564  }
566  inline double * abcPerturbation() const
567  { return abcPerturbation_;}
569  inline double * fakeDjs() const
570  { return djSaved_;}
571  inline unsigned char * internalStatus() const
572  { return internalStatus_;}
573  inline AbcSimplex::Status getInternalStatus(int sequence) const {
574  return static_cast<Status> (internalStatus_[sequence] & 7);
575  }
576  inline AbcSimplex::Status getInternalColumnStatus(int sequence) const {
577  return static_cast<Status> (internalStatus_[sequence+maximumAbcNumberRows_] & 7);
578  }
579  inline void setInternalStatus(int sequence, AbcSimplex::Status newstatus) {
580  unsigned char & st_byte = internalStatus_[sequence];
581  st_byte = static_cast<unsigned char>(st_byte & ~7);
582  st_byte = static_cast<unsigned char>(st_byte | newstatus);
583  }
584  inline void setInternalColumnStatus(int sequence, AbcSimplex::Status newstatus) {
585  unsigned char & st_byte = internalStatus_[sequence+maximumAbcNumberRows_];
586  st_byte = static_cast<unsigned char>(st_byte & ~7);
587  st_byte = static_cast<unsigned char>(st_byte | newstatus);
588  }
593  void setInitialDenseFactorization(bool onOff);
594  bool initialDenseFactorization() const;
596  inline int sequenceIn() const {
597  return sequenceIn_;
598  }
599  inline int sequenceOut() const {
600  return sequenceOut_;
601  }
603  inline void setSequenceIn(int sequence) {
604  sequenceIn_ = sequence;
605  }
606  inline void setSequenceOut(int sequence) {
607  sequenceOut_ = sequence;
608  }
609 #if 0
610 
611  inline int sequenceInternalIn() const {
612  return sequenceInternalIn_;
613  }
614  inline int sequenceInternalOut() const {
615  return sequenceInternalOut_;
616  }
618  inline void setSequenceInternalIn(int sequence) {
619  sequenceInternalIn_ = sequence;
620  }
621  inline void setSequenceInternalOut(int sequence) {
622  sequenceInternalOut_ = sequence;
623  }
624 #endif
625  inline int isColumn(int sequence) const {
627  return sequence >= maximumAbcNumberRows_ ? 1 : 0;
628  }
630  inline int sequenceWithin(int sequence) const {
631  return sequence < maximumAbcNumberRows_ ? sequence : sequence - maximumAbcNumberRows_;
632  }
634  inline int lastPivotRow() const
635  { return lastPivotRow_;}
637  inline int firstFree() const
638  { return firstFree_;}
640  inline int lastFirstFree() const
641  { return lastFirstFree_;}
643  inline int freeSequenceIn() const
644  { return freeSequenceIn_;}
646  inline double currentAcceptablePivot() const
647  { return currentAcceptablePivot_;}
648 #ifdef PAN
649 
655  inline int fakeSuperBasic(int iSequence) {
656  if ((internalStatus_[iSequence]&7)==4)
657  return 0; // free
658  if ((internalStatus_[iSequence]&7)!=5)
659  return -2;
660  double value=abcSolution_[iSequence];
661  if (value<abcLower_[iSequence]+primalTolerance_) {
662  if(abcDj_[iSequence]>=-currentDualTolerance_) {
663  setInternalStatus(iSequence,atLowerBound);
664 #if PRINT_PAN>1
665  printf("Pansetting %d to lb\n",iSequence);
666 #endif
667  return -1;
668  } else {
669  return 1;
670  }
671  } else if (value>abcUpper_[iSequence]-primalTolerance_) {
672  if (abcDj_[iSequence]<=currentDualTolerance_) {
673  setInternalStatus(iSequence,atUpperBound);
674 #if PRINT_PAN>1
675  printf("Pansetting %d to ub\n",iSequence);
676 #endif
677  return -1;
678  } else {
679  return 1;
680  }
681  } else {
682  return 0;
683  }
684  }
685 #endif
686  inline double solution(int sequence) {
688  return abcSolution_[sequence];
689  }
691  inline double & solutionAddress(int sequence) {
692  return abcSolution_[sequence];
693  }
694  inline double reducedCost(int sequence) {
695  return abcDj_[sequence];
696  }
697  inline double & reducedCostAddress(int sequence) {
698  return abcDj_[sequence];
699  }
700  inline double lower(int sequence) {
701  return abcLower_[sequence];
702  }
704  inline double & lowerAddress(int sequence) {
705  return abcLower_[sequence];
706  }
707  inline double upper(int sequence) {
708  return abcUpper_[sequence];
709  }
711  inline double & upperAddress(int sequence) {
712  return abcUpper_[sequence];
713  }
714  inline double cost(int sequence) {
715  return abcCost_[sequence];
716  }
718  inline double & costAddress(int sequence) {
719  return abcCost_[sequence];
720  }
722  inline double originalLower(int iSequence) const {
723  if (iSequence < numberColumns_) return columnLower_[iSequence];
724  else
725  return rowLower_[iSequence-numberColumns_];
726  }
728  inline double originalUpper(int iSequence) const {
729  if (iSequence < numberColumns_) return columnUpper_[iSequence];
730  else
731  return rowUpper_[iSequence-numberColumns_];
732  }
734  inline AbcSimplexProgress * abcProgress()
735  { return &abcProgress_;}
736 #ifdef ABC_SPRINT
737  AbcSimplex * createSubProblem(int numberColumns,const int * whichColumn);
740  void restoreFromSubProblem(AbcSimplex * fullProblem, const int * whichColumn);
741 #endif
742 public:
745  inline void clearArraysPublic(int which)
746  { clearArrays(which);}
749  inline int getAvailableArrayPublic() const
750  { return getAvailableArray();}
751 #if ABC_PARALLEL
752  inline int parallelMode() const
754  { return parallelMode_;}
756  inline void setParallelMode(int value)
757  { parallelMode_=value;}
759  inline int numberCpus() const
760  { return parallelMode_+1;}
761 #if ABC_PARALLEL==1
762  inline void setStopStart(int value)
764  { stopStart_=value;}
765 #endif
766 #endif
767  //protected:
769  void clearArrays(int which);
771  void clearArrays(CoinPartitionedVector * which);
773  int getAvailableArray() const;
775  inline void setUsedArray(int which) const
776  {int check=1<<which;assert ((stateOfProblem_&check)==0);stateOfProblem_|=check;}
778  inline void setAvailableArray(int which) const
779  {int check=1<<which;assert ((stateOfProblem_&check)!=0);
780  assert (!usefulArray_[which].getNumElements());stateOfProblem_&=~check;}
782  void swapPrimalStuff();
784  void swapDualStuff(int lastSequenceOut,int lastDirectionOut);
785 protected:
787 
789  void swap(int pivotRow,int nonBasicPosition,Status newStatus);
791  inline void setFakeBound(int sequence, FakeBound fakeBound) {
792  unsigned char & st_byte = internalStatus_[sequence];
793  st_byte = static_cast<unsigned char>(st_byte & ~24);
794  st_byte = static_cast<unsigned char>(st_byte | (fakeBound << 3));
795  }
796  inline FakeBound getFakeBound(int sequence) const {
797  return static_cast<FakeBound> ((internalStatus_[sequence] >> 3) & 3);
798  }
799  bool atFakeBound(int sequence) const;
800  inline void setPivoted( int sequence) {
801  internalStatus_[sequence] = static_cast<unsigned char>(internalStatus_[sequence] | 32);
802  }
803  inline void clearPivoted( int sequence) {
804  internalStatus_[sequence] = static_cast<unsigned char>(internalStatus_[sequence] & ~32);
805  }
806  inline bool pivoted(int sequence) const {
807  return (((internalStatus_[sequence] >> 5) & 1) != 0);
808  }
809 public:
811  void swap(int pivotRow,int nonBasicPosition);
813  void setFlagged( int sequence);
814  inline void clearFlagged( int sequence) {
815  internalStatus_[sequence] = static_cast<unsigned char>(internalStatus_[sequence] & ~64);
816  }
817  inline bool flagged(int sequence) const {
818  return ((internalStatus_[sequence] & 64) != 0);
819  }
820 protected:
822  inline void setActive( int iRow) {
823  internalStatus_[iRow] = static_cast<unsigned char>(internalStatus_[iRow] | 128);
824  }
825  inline void clearActive( int iRow) {
826  internalStatus_[iRow] = static_cast<unsigned char>(internalStatus_[iRow] & ~128);
827  }
828  inline bool active(int iRow) const {
829  return ((internalStatus_[iRow] & 128) != 0);
830  }
831 public:
834  void createStatus() ;
836  void crash(int type);
841  void putStuffInBasis(int type);
844  void allSlackBasis();
846  void checkConsistentPivots() const;
848  void printStuff() const;
850  int startup(int ifValuesPass);
851 
853  inline double rawObjectiveValue() const {
854  return objectiveValue_;
855  }
857  void computeObjectiveValue(bool useWorkingSolution = false);
861  void moveInfo(const AbcSimplex & rhs, bool justStatus = false);
862 #ifndef NUMBER_THREADS
863 #define NUMBER_THREADS 3
864 #endif
865 #if ABC_PARALLEL==1
866  // For waking up thread
867  inline pthread_mutex_t * mutexPointer(int which,int thread=0)
868  { return mutex_+which+3*thread;}
869  inline pthread_barrier_t * barrierPointer()
870  { return &barrier_;}
871  inline int whichLocked(int thread=0) const
872  { return locked_[thread];}
873  inline CoinThreadInfo * threadInfoPointer(int thread=0)
874  { return threadInfo_+thread;}
875  void startParallelStuff(int type);
876  int stopParallelStuff(int type);
878  int whichThread() const;
879 #elif ABC_PARALLEL==2
880  //inline CoinThreadInfo * threadInfoPointer(int thread=0)
881  //{ return threadInfo_+thread;}
882 #endif
883 
884 
885  //-------------------------------------------------------------------------
889  void setObjectiveCoefficient( int elementIndex, double elementValue );
891  inline void setObjCoeff( int elementIndex, double elementValue ) {
892  setObjectiveCoefficient( elementIndex, elementValue);
893  }
894 
897  void setColumnLower( int elementIndex, double elementValue );
898 
901  void setColumnUpper( int elementIndex, double elementValue );
902 
904  void setColumnBounds( int elementIndex,
905  double lower, double upper );
906 
915  void setColumnSetBounds(const int* indexFirst,
916  const int* indexLast,
917  const double* boundList);
918 
921  inline void setColLower( int elementIndex, double elementValue ) {
922  setColumnLower(elementIndex, elementValue);
923  }
926  inline void setColUpper( int elementIndex, double elementValue ) {
927  setColumnUpper(elementIndex, elementValue);
928  }
929 
931  inline void setColBounds( int elementIndex,
932  double newlower, double newupper ) {
933  setColumnBounds(elementIndex, newlower, newupper);
934  }
935 
942  inline void setColSetBounds(const int* indexFirst,
943  const int* indexLast,
944  const double* boundList) {
945  setColumnSetBounds(indexFirst, indexLast, boundList);
946  }
947 
950  void setRowLower( int elementIndex, double elementValue );
951 
954  void setRowUpper( int elementIndex, double elementValue ) ;
955 
957  void setRowBounds( int elementIndex,
958  double lower, double upper ) ;
959 
966  void setRowSetBounds(const int* indexFirst,
967  const int* indexLast,
968  const double* boundList);
970  void resize (int newNumberRows, int newNumberColumns);
971 
973 
975 protected:
976 
983  double sumNonBasicCosts_;
999  double largestGap_;
1011  double movement_;
1015  double btranAlpha_;
1017 #ifdef ABC_LONG_FACTORIZATION
1018  long
1019 #endif
1020  double ftAlpha_;
1025 public:
1028 protected:
1049  /*
1050  May want to put some arrays into struct
1051  Two arrays point to/from external
1052  Order is basic,unused basic, at lower, at upper, superbasic, free, fixed with starts
1053  */
1059 #define startAtLowerNoOther_ maximumAbcNumberRows_
1060  int startAtLowerOther_;
1070 #ifdef EARLY_FACTORIZE
1071  int numberEarly_;
1073 #endif
1074 
1091 #define ALL_STATUS_OK 2048
1092 #define ROW_PRIMAL_OK 4096
1093 #define ROW_DUAL_OK 8192
1094 #define COLUMN_PRIMAL_OK 16384
1095 #define COLUMN_DUAL_OK 32768
1096 #define PESSIMISTIC 65536
1097 #define ADD_A_BIT 131072
1098 #define DO_SCALE_AND_MATRIX 262144
1099 #define DO_BASIS_AND_ORDER 524288
1100 #define DO_STATUS 1048576
1101 #define DO_SOLUTION 2097152
1102 #define DO_JUST_BOUNDS 0x400000
1103 #define NEED_BASIS_SORT 0x800000
1104 #define FAKE_SUPERBASIC 0x1000000
1105 #define VALUES_PASS 0x2000000
1106 #define VALUES_PASS2 0x4000000
1107  mutable int stateOfProblem_;
1108 #if ABC_PARALLEL
1109 public:
1111  int parallelMode_;
1112 protected:
1113 #endif
1114  int numberOrdinary_;
1129  //int * fromExternal_;
1131  //int * toExternal_;
1145  double * offset_;
1147  double * offsetRhs_;
1149  double * tempArray_;
1154  unsigned char * internalStatus_;
1156  unsigned char * internalStatusSaved_;
1168  double * abcLower_;
1171  double * abcUpper_;
1177  double * abcCost_;
1180  double * abcSolution_;
1183  double * abcDj_;
1185  double * lowerSaved_;
1187  double * upperSaved_;
1189  double * costSaved_;
1191  double * solutionSaved_;
1193  double * djSaved_;
1195  double * lowerBasic_;
1197  double * upperBasic_;
1199  double * costBasic_;
1201  double * solutionBasic_;
1203  double * djBasic_;
1216 #ifdef EARLY_FACTORIZE
1217  AbcSimplexFactorization * abcEarlyFactorization_;
1219 #endif
1220 #ifdef TEMPORARY_FACTORIZATION
1221  AbcSimplexFactorization * abcOtherFactorization_;
1223 #endif
1224  //double * savedSolution_;
1236  /* has secondary offset and counts so row goes first then column
1237  Probably back to CoinPartitionedVector as AbcMatrix has slacks
1238  also says if in use - so we can just get next available one */
1239 #define ABC_NUMBER_USEFUL 8
1242  AbcSimplexProgress abcProgress_;
1246  double upperTheta_;
1249 public:
1253  int arrayForFlipRhs_; // if sequential can re-use
1254  int arrayForBtran_; // 0
1255  int arrayForFtran_; // 1
1257 protected:
1260  //int nextCleanNonBasicIteration_;
1261 #if ABC_PARALLEL==1
1262  // For waking up thread
1263  pthread_mutex_t mutex_[3*NUMBER_THREADS];
1264  pthread_barrier_t barrier_;
1265  CoinThreadInfo threadInfo_[NUMBER_THREADS];
1266  pthread_t abcThread_[NUMBER_THREADS];
1267  int locked_[NUMBER_THREADS];
1268  int stopStart_;
1269 #elif ABC_PARALLEL==2
1270  //CoinThreadInfo threadInfo_[NUMBER_THREADS];
1271 #endif
1272 
1273 };
1274 //#############################################################################
1283 void
1284 AbcSimplexUnitTest(const std::string & mpsDir);
1285 #endif
int numberTotal() const
Number of variables (includes spare rows)
Definition: AbcSimplex.hpp:222
double objectiveChange_
Objective change.
int maximumNumberTotal() const
Maximum Total.
Definition: AbcSimplex.hpp:215
AbcDualRowPivot * abcDualRowPivot_
dual row pivot choice
#define ROW_LOWER_SAME
Whats changed since last solve.
Definition: ClpModel.hpp:1206
double solution(int sequence)
Return row or column values.
Definition: AbcSimplex.hpp:687
int computePrimals(CoinIndexedVector *array1, CoinIndexedVector *array2)
Computes primals from scratch. Returns number of refinements.
double & solutionAddress(int sequence)
Return address of row or column values.
Definition: AbcSimplex.hpp:691
CoinPartitionedVector * usefulArray(int index) const
factorization
Definition: AbcSimplex.hpp:231
double sumNonBasicCosts_
Sum of nonbasic costs.
Definition: AbcSimplex.hpp:984
void defaultFactorizationFrequency()
If user left factorization frequency then compute.
double * lowerRegion(int which) const
Return region.
Definition: AbcSimplex.hpp:540
~AbcSimplex()
Destructor.
void setRowSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of rows simultaneously
const double * getRowPrice() const
Get pointer to array[getNumRows()] of dual prices.
double acceptablePivot() const
Acceptable pivot for this iteration.
Definition: AbcSimplex.hpp:270
CoinPartitionedVector * usefulArray(int index)
Useful arrays (0,1,2,3,4,5,6,7)
Definition: AbcSimplex.hpp:228
double valueIncomingDual() const
value of incoming variable (in Dual)
void refreshLower(unsigned int type=~(ROW_LOWER_SAME|COLUMN_UPPER_SAME))
Given an existing factorization computes and checks primal and dual solutions.
int arrayForBtran() const
factorization
Definition: AbcSimplex.hpp:469
int ordinaryVariables() const
Set to 1 if no free or super basic.
Definition: AbcSimplex.hpp:273
int arrayForFtran_
Sum of nonbasic costs.
void setClpSimplexObjectiveValue()
Sets objectiveValue_ from rawObjectiveValue_.
void clearArraysPublic(int which)
Clears an array and says available (-1 does all) when no possibility of going parallel.
Definition: AbcSimplex.hpp:745
double * scaleToExternal_
Scale from primal internal to external (in external order) Or other way for dual. ...
int arrayForFlipBounds() const
factorization
Definition: AbcSimplex.hpp:465
int freeSequenceIn_
Free chosen vector.
int numberOrdinary_
Number of ordinary (lo/up) in tableau row.
void moveStatusToClp(ClpSimplex *clpModel)
Move status and solution to ClpSimplex.
int startAtLowerOther_
Start of variables at lower bound with upper.
AbcPrimalColumnPivot * abcPrimalColumnPivot_
primal column pivot choice
AbcNonLinearCost * abcNonLinearCost_
Very wasteful way of dealing with infeasibilities in primal.
void computeObjective()
Computes nonbasic cost and total cost.
This is a tiny class where data can be saved round calls.
Definition: ClpModel.hpp:1269
void setFakeBound(int sequence, FakeBound fakeBound)
Swaps two variables.
Definition: AbcSimplex.hpp:791
int numberColumns_
Number of columns.
Definition: ClpModel.hpp:1126
int numberFlagged_
Current number of variables flagged.
double * rowUpper_
Row upper.
Definition: ClpModel.hpp:1138
friend void AbcSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the AbcSimplex class.
void checkDualSolutionPlusFake()
This sets largest infeasibility and most infeasible and sum and number of infeasibilities AND sumFake...
double * solutionBasic() const
Return region.
Definition: AbcSimplex.hpp:550
double * perturbationBasic_
basic perturbation
double * lowerBasic() const
Return region.
Definition: AbcSimplex.hpp:556
double originalLower(int iSequence) const
Return original lower bound.
Definition: AbcSimplex.hpp:722
void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use DBL_MAX for infinity.
double * abcPerturbation() const
Perturbation.
Definition: AbcSimplex.hpp:566
double * upperRegion(int which) const
Return region.
Definition: AbcSimplex.hpp:543
void deleteBaseModel()
Switch off base model.
double lastDualBound_
Last dual bound.
int arrayForFlipRhs() const
factorization
Definition: AbcSimplex.hpp:467
bool atFakeBound(int sequence) const
Swaps two variables.
AbcMatrix * abcMatrix() const
Abc Matrix.
Definition: AbcSimplex.hpp:293
double * upperBasic() const
Return region.
Definition: AbcSimplex.hpp:559
void setFactorization(AbcSimplexFactorization &factorization)
Passes in factorization.
int solveType() const
Solve type - 1 simplex, 2 simplex interface, 3 Interior.
Definition: ClpModel.hpp:373
bool initialDenseFactorization() const
Return region.
int numberTotalWithoutFixed() const
Number of variables without fixed to zero (includes spare rows)
Definition: AbcSimplex.hpp:225
int arrayForTableauRow_
Sum of nonbasic costs.
double currentDualBound() const
Current dualBound (will end up as dualBound_)
Definition: AbcSimplex.hpp:282
int maximumAbcNumberColumns_
Maximum number columns.
unsigned char * internalStatus_
Working status ? may be signed ? link pi_ to an indexed array? may have saved from last factorization...
const double * getRowActivity() const
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vecto...
int numberDisasters_
Sum of nonbasic costs.
void saveGoodStatus()
Saves good status etc.
int tightenPrimalBounds()
Tightens primal bounds to make dual faster.
int doAbcDual()
Dual algorithm - see AbcSimplexDual.hpp for method.
int * reversePivotVariable_
Reverse abcPivotVariable_ for moving around.
AbcSimplex * baseModel() const
See if we have base model.
Definition: AbcSimplex.hpp:146
double * solutionSaved_
Saved scaled primal solution.
double * inverseRowScale2() const
factorization
Definition: AbcSimplex.hpp:452
double reducedCost(int sequence)
Return region.
Definition: AbcSimplex.hpp:694
AbcMatrix * abcMatrix_
Working matrix.
double rawObjectiveValue() const
Raw objective value (so always minimize in primal)
Definition: AbcSimplex.hpp:853
double currentDualBound_
Current dualBound (will end up as dualBound_)
Definition: AbcSimplex.hpp:997
void putBackSolution(ClpSimplex *simplex)
Put back solution into ClpSimplex.
AbcSimplex::Status getInternalStatus(int sequence) const
Return region.
Definition: AbcSimplex.hpp:573
void setPrimalColumnPivotAlgorithm(AbcPrimalColumnPivot &choice)
Sets column pivot choice algorithm in primal.
double * costBasic_
Working scaled copy of basic objective.
double * scaleFromExternal() const
Points from external to internal.
Definition: AbcSimplex.hpp:443
double * costRegion() const
Return region.
Definition: AbcSimplex.hpp:530
int numberRows() const
Number of rows.
Definition: ClpModel.hpp:315
void restoreData(ClpDataSave saved)
Restore data.
double * abcDj_
Working scaled dual solution may have saved from last factorization at end.
FakeBound getFakeBound(int sequence) const
Swaps two variables.
Definition: AbcSimplex.hpp:796
const double * getReducedCost() const
Get a pointer to array[getNumCols()] of reduced costs.
double * inverseColumnUseScale_
use this instead of inverseColumnScale
int initialNumberInfeasibilities_
Initial number of infeasibilities.
int getAvailableArray() const
Returns first available empty array (and sets flag)
double optimizationDirection_
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore.
Definition: ClpModel.hpp:1112
int lastFirstFree_
Last firstFree_.
double & lowerAddress(int sequence)
Return address of row or column lower bound.
Definition: AbcSimplex.hpp:704
double * costRegion(int which) const
Return region.
Definition: AbcSimplex.hpp:546
int housekeeping()
This does basis housekeeping and does values for in/out variables.
int firstFree_
First free/super-basic variable (-1 if none)
AbcSimplex::Status getInternalColumnStatus(int sequence) const
Return region.
Definition: AbcSimplex.hpp:576
bool isObjectiveLimitTestValid() const
Return true if the objective limit test can be relied upon.
AbcPrimalColumnPivot * primalColumnPivot() const
primal column pivot choice
Definition: AbcSimplex.hpp:289
void permuteIn()
Permutes in from ClpModel data - assumes scale factors done and AbcMatrix exists but is in original o...
ClpSimplex * clpModel_
A copy of model as ClpSimplex with certain state.
double * solutionRegion(int which) const
Return region.
Definition: AbcSimplex.hpp:534
void setPivoted(int sequence)
Swaps two variables.
Definition: AbcSimplex.hpp:800
void setDualRowPivotAlgorithm(AbcDualRowPivot &choice)
Sets row pivot choice algorithm in dual.
void setActive(int iRow)
To say row active in primal pivot row choice.
Definition: AbcSimplex.hpp:822
int doAbcPrimal(int ifValuesPass)
Dual algorithm - see AbcSimplexDual.hpp for method.
void clearPivoted(int sequence)
Swaps two variables.
Definition: AbcSimplex.hpp:803
double * abcLower_
Working scaled copy of lower bounds has original scaled copy at end.
int fakeSuperBasic(int iSequence)
Returns 1 if fake superbasic 0 if free or true superbasic -1 if was fake but has cleaned itself up (s...
Definition: AbcSimplex.hpp:655
void checkArrays(int ignoreEmpty=0) const
For debug - prints summary of arrays which are out of kilter.
double * columnUpper_
Column Upper.
Definition: ClpModel.hpp:1146
void refreshCosts()
After modifying first copy refreshes second copy and marks as updated.
AbcSimplexProgress * abcProgress()
For dealing with all issues of cycling etc.
Definition: AbcSimplex.hpp:734
void setStateOfProblem(int value)
State of problem.
Definition: AbcSimplex.hpp:433
double * scaleToExternal() const
Scale from primal internal to external (in external order) Or other way for dual. ...
Definition: AbcSimplex.hpp:447
int numberFreeNonBasic_
Number of free nonbasic variables.
double * djBasic_
Working scaled basic dual solution (want it to be zero)
void checkBothSolutions()
This sets sum and number of infeasibilities (Dual and Primal)
AbcSimplexProgress abcProgress_
For dealing with all issues of cycling etc.
double * perturbationSaved() const
Perturbation (fixed) - is just scaled random numbers.
Definition: AbcSimplex.hpp:267
int startAtUpperOther_
Start of variables at upper bound with lower.
double * offset_
Primal offset (in external order) So internal value is (external-offset)*scaleFromExternal.
int arrayForFlipRhs_
Sum of nonbasic costs.
int arrayForFlipBounds_
Sum of nonbasic costs.
AbcSimplexFactorization * swapFactorization(AbcSimplexFactorization *factorization)
Swaps factorization.
void swap(int pivotRow, int nonBasicPosition, Status newStatus)
Swaps two variables and does status.
double currentDualTolerance() const
Current dualTolerance (will end up as dualTolerance_)
Definition: AbcSimplex.hpp:257
double minimumThetaMovement_
Minimum theta movement.
void setSequenceOut(int sequence)
Return region.
Definition: AbcSimplex.hpp:606
double largestGap_
Largest gap.
Definition: AbcSimplex.hpp:999
void setColumnUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
int arrayForFtran() const
factorization
Definition: AbcSimplex.hpp:471
double acceptablePivot_
Acceptable pivot value just after factorization.
double cost(int sequence)
Return region.
Definition: AbcSimplex.hpp:714
double * tempArray_
Useful array of numberTotal length.
double * columnLower_
Column Lower.
Definition: ClpModel.hpp:1144
double * upperSaved_
Saved scaled copy of upper bounds.
AbcSimplex & operator=(const AbcSimplex &rhs)
Assignment operator. This copies the data.
double * abcPerturbation_
Perturbation (fixed) - is just scaled random numbers If perturbationFactor_&lt;0 then virtual perturbati...
ClpDataSave saveData()
Save data.
void restoreGoodStatus(int type)
Restores previous good status and says trouble.
int sequenceOut() const
Return region.
Definition: AbcSimplex.hpp:599
void setAvailableArray(int which) const
Say array going available.
Definition: AbcSimplex.hpp:778
void setupDualValuesPass(const double *fakeDuals, const double *fakePrimals, int type)
Sets dual values pass djs using unscaled duals type 1 - values pass type 2 - just use as infeasibilit...
void permuteBasis()
deals with new basis and puts in abcPivotVariable_
int arrayForDualColumn_
Sum of nonbasic costs.
double movement_
Movement of variable.
int stateOfProblem() const
State of problem.
Definition: AbcSimplex.hpp:430
double & reducedCostAddress(int sequence)
Return region.
Definition: AbcSimplex.hpp:697
int getAvailableArrayPublic() const
Returns first available empty array (and sets flag) when no possibility of going parallel.
Definition: AbcSimplex.hpp:749
int gutsOfSolution(int type)
Computes solutions - 1 do duals, 2 do primals, 3 both (returns number of refinements) ...
void setInternalColumnStatus(int sequence, AbcSimplex::Status newstatus)
Return region.
Definition: AbcSimplex.hpp:584
void setupPointers(int maxRows, int maxColumns)
Sets up all extra pointers.
double * abcCost_
Working scaled copy of objective ? where perturbed copy or can we always work with perturbed copy (in...
int numberColumns() const
Number of rows.
Definition: ClpModel.hpp:325
double & costAddress(int sequence)
Return address of row or column cost.
Definition: AbcSimplex.hpp:718
void translate(int type)
Translates ClpModel to AbcSimplex See DO_ bits in stateOfProblem_ for type e.g.
double rawObjectiveValue_
Sum of costs (raw objective value)
Definition: AbcSimplex.hpp:986
double * columnUseScale_
use this instead of columnScale
void gutsOfResize(int numberRows, int numberColumns)
resizes arrays
void moveStatusFromClp(ClpSimplex *clpModel)
Move status and solution from ClpSimplex.
void setToBaseModel(AbcSimplex *model=NULL)
Reset to base model (just size and arrays needed) If model NULL use internal copy.
double * columnScale2() const
factorization
Definition: AbcSimplex.hpp:456
void setCurrentDualTolerance(double value)
Given an existing factorization computes and checks primal and dual solutions.
Definition: AbcSimplex.hpp:259
void clearArrays(int which)
Clears an array and says available (-1 does all)
int maximumAbcNumberRows() const
Maximum rows.
Definition: AbcSimplex.hpp:212
int maximumTotal() const
factorization
Definition: AbcSimplex.hpp:217
double * abcSolution_
Working scaled primal solution may have saved from last factorization at end.
int startAtUpperNoOther_
Start of variables at upper bound with no lower.
Primal Column Pivot Abstract Base Class.
void clearActive(int iRow)
Swaps two variables.
Definition: AbcSimplex.hpp:825
Base class for Clp disaster handling.
void checkSolutionBasic() const
For debug - checks solutionBasic.
void allSlackBasis()
Sets up all slack basis and resets solution to as it was after initial load or readMps.
int * abcPivotVariable_
Basic variables pivoting on which rows followed by atLo/atUp then free/superbasic then fixed...
unsigned char * internalStatusSaved_
Saved status.
const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
int getNumElements() const
Number of elements in matrix.
Definition: ClpModel.hpp:702
AbcNonLinearCost * abcNonLinearCost() const
Return pointer to details of costs.
Definition: AbcSimplex.hpp:263
double objectiveValue_
Objective value.
Definition: ClpModel.hpp:1116
int arrayForReplaceColumn_
Sum of nonbasic costs.
int sequenceIn_
Sequence of In variable.
void checkPrimalSolution(bool justBasic)
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Primal) ...
#define COLUMN_UPPER_SAME
Whats changed since last solve.
Definition: ClpModel.hpp:1210
void clearFlagged(int sequence)
Swaps two variables.
Definition: AbcSimplex.hpp:814
Indexed Vector.
ClpDataSave saveData_
For saving stuff at beginning.
int multipleSequenceIn_[4]
Multiple sequence in.
void checkDjs(int type=1) const
For debug - summarizes dj situation (1 recomputes duals first, 2 checks duals as well) ...
void copyFromSaved(int type=31)
Copies all saved versions to working versions and may do something for perturbation.
double btranAlpha_
Btran alpha.
int normalDualColumnIteration_
Iteration at which to do relaxed dualColumn.
double perturbationFactor_
Perturbation factor If &lt;0.0 then virtual if 0.0 none if &gt;0.0 use this as factor.
Definition: AbcSimplex.hpp:993
unsigned char * internalStatus() const
Return region.
Definition: AbcSimplex.hpp:571
#define rowUseScale_
Definition: AbcSimplex.hpp:375
int ordinaryVariables_
Set to 1 if no free or super basic.
double * scaleFromExternal_
Points from external to internal.
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
double * offsetRhs_
Offset for accumulated offsets*matrix.
double lower(int sequence)
Return region.
Definition: AbcSimplex.hpp:700
void gutsOfCopy(const AbcSimplex &rhs)
Does most of copying.
int numberTotalWithoutFixed_
Number of variables without fixed to zero (includes spare rows)
void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
Definition: AbcSimplex.hpp:926
int arrayForDualColumn() const
factorization
Definition: AbcSimplex.hpp:458
void permuteOut(int whatsWanted)
Permutes out - bit settings same as stateOfProblem.
int lastPivotRow() const
Current/last pivot row (set after END of choosing pivot row in dual)
Definition: AbcSimplex.hpp:634
int dual()
Dual algorithm - see AbcSimplexDual.hpp for method.
double * inverseColumnScale2() const
factorization
Definition: AbcSimplex.hpp:454
CoinWarmStartBasis * getBasis() const
Returns a basis (to be deleted by user)
int primal(int ifValuesPass)
Primal algorithm - see AbcSimplexPrimal.hpp for method.
int numberFlipped_
Sum of nonbasic costs.
int computeDuals(double *givenDjs, CoinIndexedVector *array1, CoinIndexedVector *array2)
Computes duals from scratch.
void crash(int type)
Does sort of crash.
Status
enums for status of various sorts.
Definition: AbcSimplex.hpp:74
double upperTheta_
upper theta from dual column
double initialSumInfeasibilities_
Initial sum of infeasibilities.
void createStatus()
Set up status array (can be used by OsiAbc).
int numberOrdinary() const
Number of ordinary (lo/up) in tableau row.
Definition: AbcSimplex.hpp:276
Dual Row Pivot Abstract Base Class.
double objectiveOffset_
Objective offset (from offset_)
Definition: AbcSimplex.hpp:988
int factorizationFrequency() const
Factorization frequency.
bool active(int iRow) const
Swaps two variables.
Definition: AbcSimplex.hpp:828
void setValuesPassAction(double incomingInfeasibility, double allowedInfeasibility)
For advanced use.
int isColumn(int sequence) const
Returns 1 if sequence indicates column.
Definition: AbcSimplex.hpp:626
void setFlagged(int sequence)
To flag a variable.
double * upperRegion() const
Return region.
Definition: AbcSimplex.hpp:527
double originalUpper(int iSequence) const
Return original lower bound.
Definition: AbcSimplex.hpp:728
This just implements AbcFactorization when an AbcMatrix object is passed.
void setColSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of columns simultaneously
Definition: AbcSimplex.hpp:942
void unpack(CoinIndexedVector &rowArray) const
Unpacks one column of the matrix into indexed array Uses sequenceIn_.
Definition: AbcSimplex.hpp:345
void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
Definition: AbcSimplex.hpp:891
double upperTheta() const
upper theta from dual column
Definition: AbcSimplex.hpp:461
double * djSaved_
Saved scaled dual solution.
void gutsOfDelete(int type)
Does most of deletion for arrays etc(0 just null arrays, 1 delete first)
void checkMoveBack(bool checkDuals)
For debug - moves solution back to external and computes stuff (always checks djs) ...
int * pivotVariable() const
Basic variables pivoting on which rows may be same as toExternal but may be as at invert...
Definition: AbcSimplex.hpp:426
AbcSimplexFactorization * abcFactorization_
factorization
double * djBasic() const
Return region.
Definition: AbcSimplex.hpp:553
bool pivoted(int sequence) const
Swaps two variables.
Definition: AbcSimplex.hpp:806
void dropNames()
Drops names - makes lengthnames 0 and names empty.
double * rowLower_
Row lower.
Definition: ClpModel.hpp:1136
AbcDualRowPivot * dualRowPivot() const
dual row pivot choice
Definition: AbcSimplex.hpp:285
void setUsedArray(int which) const
Say array going to be used.
Definition: AbcSimplex.hpp:775
int lastFirstFree() const
Last firstFree_.
Definition: AbcSimplex.hpp:640
void setNumberOrdinary(int number)
Set number of ordinary (lo/up) in tableau row.
Definition: AbcSimplex.hpp:279
CoinIndexedVector * rowArray(int index) const
Useful row length arrays (0,1,2,3,4,5)
Definition: ClpSimplex.hpp:727
double upper(int sequence)
Return region.
Definition: AbcSimplex.hpp:707
double & upperAddress(int sequence)
Return address of row or column upper bound.
Definition: AbcSimplex.hpp:711
void AbcSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the AbcSimplex class.
void resize(int newNumberRows, int newNumberColumns)
Resizes rim part of model.
void makeBaseModel()
Array persistence flag If 0 then as now (delete/new) 1 then only do arrays if bigger needed 2 as 1 bu...
void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
Definition: AbcSimplex.hpp:921
void refreshUpper(unsigned int type=~(ROW_LOWER_SAME|COLUMN_LOWER_SAME))
Given an existing factorization computes and checks primal and dual solutions.
void setMultipleSequenceIn(int sequenceIn[4])
set multiple sequence in
void checkConsistentPivots() const
For debug - check pivotVariable consistent.
int pivotRow() const
Pivot Row for use by classes e.g. steepestedge.
Definition: ClpSimplex.hpp:962
AbcSimplexFactorization * getEmptyFactorization()
Gets clean and emptyish factorization.
double * fakeDjs() const
Fake djs.
Definition: AbcSimplex.hpp:569
void setSequenceIn(int sequence)
Set sequenceIn or Out.
Definition: AbcSimplex.hpp:603
int startFixed_
Start of fixed variables.
void printStuff() const
Print stuff.
void moveInfo(const AbcSimplex &rhs, bool justStatus=false)
Move status and solution across.
int arrayForReplaceColumn() const
factorization
Definition: AbcSimplex.hpp:463
CoinPartitionedVector usefulArray_[ABC_NUMBER_USEFUL]
Sum of nonbasic costs.
void originalModel(AbcSimplex *miniModel)
This copies back stuff from miniModel and then deletes miniModel.
AbcSimplexFactorization * factorization() const
factorization
Definition: AbcSimplex.hpp:199
double * solutionBasic_
Working scaled basic primal solution.
int firstFree() const
First Free_.
Definition: AbcSimplex.hpp:637
int sequenceOut_
Sequence of Out variable.
int stateDualColumn_
State of dual waffle -2 - in initial large tolerance phase -1 - in medium tolerance phase n - in corr...
int startup(int ifValuesPass)
Common bits of coding for dual and primal.
void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -DBL_MAX for -infinity.
int cleanFactorization(int ifValuesPass)
Get a clean factorization - i.e.
double currentDualTolerance_
Current dualTolerance (will end up as dualTolerance_)
Definition: AbcSimplex.hpp:995
#define COLUMN_LOWER_SAME
Whats changed since last solve.
Definition: ClpModel.hpp:1209
double bestPossibleImprovement_
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
int stateOfIteration_
Where we are in iteration.
Objective function constant.
void cleanStatus()
Clean up status.
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...
void setColumnLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
#define ABC_NUMBER_USEFUL
Useful arrays (all of row+column+2 length)
double * lowerRegion() const
Return region.
Definition: AbcSimplex.hpp:524
int internalFactorize(int solveType)
Factorizes using current basis.
void swapDualStuff(int lastSequenceOut, int lastDirectionOut)
Swaps dual stuff.
double dblParam_[ClpLastDblParam]
Array of double parameters.
Definition: ClpModel.hpp:1114
int maximumAbcNumberRows_
Maximum number rows.
double ftAlpha_
FT alpha.
void setInternalStatus(int sequence, AbcSimplex::Status newstatus)
Return region.
Definition: AbcSimplex.hpp:579
double * djRegion(int which) const
Return region.
Definition: AbcSimplex.hpp:537
void putStuffInBasis(int type)
Puts more stuff in basis 1 bit set - do even if basis exists 2 bit set - don&#39;t bother staying triangu...
int arrayForBtran_
Sum of nonbasic costs.
#define inverseRowUseScale_
Definition: AbcSimplex.hpp:376
double computeInternalObjectiveValue()
Compute minimization objective value from internal solution without perturbation. ...
double * costBasic() const
Return region.
Definition: AbcSimplex.hpp:562
int numberTotal_
Number of variables (includes spare rows)
double * solutionRegion() const
Return region.
Definition: AbcSimplex.hpp:518
int freeSequenceIn() const
Free chosen vector.
Definition: AbcSimplex.hpp:643
double * perturbationSaved_
saved perturbation
AbcSimplex * abcBaseModel_
Saved version of solution.
void computeObjectiveValue(bool useWorkingSolution=false)
Compute objective value from solution and put in objectiveValue_.
int lastCleaned_
Last time cleaned up.
void gutsOfInitialize(int numberRows, int numberColumns, bool doMore)
Initializes arrays.
double * abcUpper_
Working scaled copy of upper bounds has original scaled copy at end.
double * lowerBasic_
Working scaled copy of basic lower bounds.
void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
double sumFakeInfeasibilities_
Sum of infeasibilities when using fake perturbation tolerance.
AbcSimplex(bool emptyMessages=false)
Default constructor.
int stateOfProblem_
Sum of nonbasic costs.
void setFactorizationFrequency(int value)
factorization
int swappedAlgorithm_
Nonzero (probably 10) if swapped algorithms.
void fillPerturbation(int start, int number)
fills in perturbationSaved_ from start with 0.5+random
void swapPrimalStuff()
Swaps primal stuff.
int sequenceIn() const
Return sequence In or Out.
Definition: AbcSimplex.hpp:596
double lastPrimalError_
Last primal error.
#define NUMBER_THREADS
Definition: AbcSimplex.hpp:863
int startOther_
Start of superBasic, free or awkward bounds variables.
double * rowScale2() const
corresponds to rowScale etc
Definition: AbcSimplex.hpp:450
The default COIN simplex (basis-oriented) warm start class.
int sequenceWithin(int sequence) const
Returns sequence number within section.
Definition: AbcSimplex.hpp:630
void setColumnBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
double * costSaved_
Saved scaled copy of objective.
double currentAcceptablePivot() const
Acceptable pivot for this iteration.
Definition: AbcSimplex.hpp:646
void setColBounds(int elementIndex, double newlower, double newupper)
Set a single column lower and upper bound.
Definition: AbcSimplex.hpp:931
int arrayForTableauRow() const
factorization
Definition: AbcSimplex.hpp:473
double clpObjectiveValue() const
Objective value.
Definition: AbcSimplex.hpp:421
int lastPivotRow_
Current/last pivot row (set after END of choosing pivot row in dual)
double minimizationObjectiveValue() const
Gets objective value with all offsets but as for minimization.
Definition: AbcSimplex.hpp:254
void checkDualSolution()
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Dual) ...
int getSolution()
Given an existing factorization computes and checks primal and dual solutions.
double * lowerSaved_
Saved scaled copy of lower bounds.
void moveToBasic(int which=15)
Moves basic stuff to basic area.
double lastDualError_
Last dual error.
double * upperBasic_
Working scaled copy of basic upper bounds.
void setInitialDenseFactorization(bool onOff)
Normally the first factorization does sparse coding because the factorization could be singular...
double * djRegion() const
Return region.
Definition: AbcSimplex.hpp:521
void setObjectiveCoefficient(int elementIndex, double elementValue)
Set an objective function coefficient.
double primalTolerance_
Current primal tolerance for algorithm.
int maximumNumberTotal_
Maximum numberTotal.
double currentAcceptablePivot_
Acceptable pivot for this iteration.
bool flagged(int sequence) const
Swaps two variables.
Definition: AbcSimplex.hpp:817
int gutsOfPrimalSolution(int type)
Computes solutions - 1 do duals, 2 do primals, 3 both (returns number of refinements) ...