00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef AbcSimplex_H
00012 #define AbcSimplex_H
00013
00014 #include <iostream>
00015 #include <cfloat>
00016 #include "ClpModel.hpp"
00017 #include "ClpMatrixBase.hpp"
00018 #include "CoinIndexedVector.hpp"
00019 #include "AbcCommon.hpp"
00020 class AbcSimplex;
00021 #include "ClpSolve.hpp"
00022 #include "CoinAbcCommon.hpp"
00023 class ClpSimplex;
00024 class AbcDualRowPivot;
00025 class AbcPrimalColumnPivot;
00026 class AbcSimplexFactorization;
00027 class AbcNonLinearCost;
00028 class OsiAbcSolverInterface;
00029 class CoinWarmStartBasis;
00030 class ClpDisasterHandler;
00031 class AbcSimplexProgress;
00032 class AbcMatrix;
00033 class AbcTolerancesEtc;
00034
00052 #define PAN
00053 #if ABC_NORMAL_DEBUG>0
00054 #define PRINT_PAN 1
00055 #endif
00056 #define TRY_ABC_GUS
00057 #define HEAVY_PERTURBATION 57
00058 #if ABC_PARALLEL==1
00059
00060 #include <pthread.h>
00061 #endif
00062 typedef struct {
00063 double result;
00064
00065
00066 int status;
00067 int stuff[4];
00068 } CoinAbcThreadInfo;
00069 #include "ClpSimplex.hpp"
00070 class AbcSimplex : public ClpSimplex {
00071 friend void AbcSimplexUnitTest(const std::string & mpsDir);
00072
00073 public:
00082 enum Status {
00083 atLowerBound = 0x00,
00084 atUpperBound = 0x01,
00085 isFree = 0x04,
00086 superBasic = 0x05,
00087 basic = 0x06,
00088 isFixed = 0x07
00089 };
00090
00091 enum FakeBound {
00092 noFake = 0x00,
00093 lowerFake = 0x01,
00094 upperFake = 0x02,
00095 bothFake = 0x03
00096 };
00097
00100
00101 AbcSimplex (bool emptyMessages = false );
00102
00105 AbcSimplex(const AbcSimplex & rhs);
00108 AbcSimplex(const ClpSimplex & rhs);
00115 AbcSimplex (const ClpSimplex * wholeModel,
00116 int numberRows, const int * whichRows,
00117 int numberColumns, const int * whichColumns,
00118 bool dropNames = true, bool dropIntegers = true,
00119 bool fixOthers = false);
00126 AbcSimplex (const AbcSimplex * wholeModel,
00127 int numberRows, const int * whichRows,
00128 int numberColumns, const int * whichColumns,
00129 bool dropNames = true, bool dropIntegers = true,
00130 bool fixOthers = false);
00134 AbcSimplex (AbcSimplex * wholeModel,
00135 int numberColumns, const int * whichColumns);
00138 void originalModel(AbcSimplex * miniModel);
00140 AbcSimplex (const ClpSimplex * clpSimplex);
00142 void putBackSolution(ClpSimplex * simplex);
00148
00150 void makeBaseModel();
00152 void deleteBaseModel();
00154 inline AbcSimplex * baseModel() const {
00155 return abcBaseModel_;
00156 }
00160 void setToBaseModel(AbcSimplex * model = NULL);
00162 AbcSimplex & operator=(const AbcSimplex & rhs);
00164 ~AbcSimplex ( );
00166
00171 int dual();
00172 int doAbcDual();
00175 int primal(int ifValuesPass);
00176 int doAbcPrimal(int ifValuesPass);
00178 CoinWarmStartBasis * getBasis() const;
00180 void setFactorization( AbcSimplexFactorization & factorization);
00182 AbcSimplexFactorization * swapFactorization( AbcSimplexFactorization * factorization);
00184 AbcSimplexFactorization * getEmptyFactorization();
00194 int tightenPrimalBounds();
00196 void setDualRowPivotAlgorithm(AbcDualRowPivot & choice);
00198 void setPrimalColumnPivotAlgorithm(AbcPrimalColumnPivot & choice);
00200
00201 void defaultFactorizationFrequency();
00203
00206
00207 inline AbcSimplexFactorization * factorization() const {
00208 return reinterpret_cast<AbcSimplexFactorization *>(abcFactorization_);
00209 }
00210 #ifdef EARLY_FACTORIZE
00212 inline AbcSimplexFactorization * earlyFactorization() const {
00213 return reinterpret_cast<AbcSimplexFactorization *>(abcEarlyFactorization_);
00214 }
00215 #endif
00217 int factorizationFrequency() const;
00218 void setFactorizationFrequency(int value);
00220 inline int maximumAbcNumberRows() const
00221 { return maximumAbcNumberRows_;}
00223 inline int maximumNumberTotal() const
00224 { return maximumNumberTotal_;}
00225 inline int maximumTotal() const
00226 { return maximumNumberTotal_;}
00228 bool isObjectiveLimitTestValid() const ;
00230 inline int numberTotal() const
00231 { return numberTotal_;}
00233 inline int numberTotalWithoutFixed() const
00234 { return numberTotalWithoutFixed_;}
00236 inline CoinPartitionedVector * usefulArray(int index) {
00237 return & usefulArray_[index];
00238 }
00239 inline CoinPartitionedVector * usefulArray(int index) const {
00240 return const_cast<CoinPartitionedVector *>(&usefulArray_[index]);
00241 }
00243
00244
00250 int getSolution ();
00252 void setClpSimplexObjectiveValue();
00258 void setupDualValuesPass(const double * fakeDuals,
00259 const double * fakePrimals,
00260 int type);
00262 inline double minimizationObjectiveValue() const
00263 { return objectiveValue_-dblParam_[ClpObjOffset];}
00265 inline double currentDualTolerance() const
00266 { return currentDualTolerance_;}
00267 inline void setCurrentDualTolerance(double value) {
00268 currentDualTolerance_ = value;
00269 }
00271 inline AbcNonLinearCost * abcNonLinearCost() const {
00272 return abcNonLinearCost_;
00273 }
00275 double * perturbationSaved() const
00276 { return perturbationSaved_;}
00278 inline double acceptablePivot() const
00279 { return acceptablePivot_;}
00281 inline int ordinaryVariables() const
00282 { return ordinaryVariables_;}
00284 inline int numberOrdinary() const
00285 { return numberOrdinary_;}
00287 inline void setNumberOrdinary(int number)
00288 { numberOrdinary_=number;}
00290 inline double currentDualBound() const
00291 { return currentDualBound_;}
00293 inline AbcDualRowPivot * dualRowPivot() const {
00294 return abcDualRowPivot_;
00295 }
00297 inline AbcPrimalColumnPivot * primalColumnPivot() const {
00298 return abcPrimalColumnPivot_;
00299 }
00301 inline AbcMatrix * abcMatrix() const {
00302 return abcMatrix_;
00303 }
00313 int internalFactorize(int solveType);
00329 void permuteIn();
00331 void permuteBasis();
00333 void permuteOut(int whatsWanted);
00335 ClpDataSave saveData() ;
00337 void restoreData(ClpDataSave saved);
00339 void cleanStatus();
00342 int computeDuals(double * givenDjs, CoinIndexedVector * array1, CoinIndexedVector * array2);
00344 int computePrimals (CoinIndexedVector * array1, CoinIndexedVector * array2);
00346 void computeObjective ();
00348 void setMultipleSequenceIn(int sequenceIn[4]);
00353 inline void unpack(CoinIndexedVector & rowArray) const
00354 {unpack(rowArray,sequenceIn_);}
00358 void unpack(CoinIndexedVector & rowArray, int sequence) const;
00363 int housekeeping();
00366 void checkPrimalSolution(bool justBasic);
00369 void checkDualSolution();
00372 void checkDualSolutionPlusFake();
00374 void checkBothSolutions();
00376 int gutsOfSolution(int type);
00378 int gutsOfPrimalSolution(int type);
00380 void saveGoodStatus();
00382 void restoreGoodStatus(int type);
00383 #define rowUseScale_ scaleFromExternal_
00384 #define inverseRowUseScale_ scaleToExternal_
00386 void refreshCosts();
00387 void refreshLower(unsigned int type=~(ROW_LOWER_SAME|COLUMN_UPPER_SAME));
00388 void refreshUpper(unsigned int type=~(ROW_LOWER_SAME|COLUMN_LOWER_SAME));
00390 void setupPointers(int maxRows,int maxColumns);
00392 void copyFromSaved(int type=31);
00394 void fillPerturbation(int start, int number);
00396 void checkArrays(int ignoreEmpty=0) const;
00398 void checkDjs(int type=1) const;
00400 void checkSolutionBasic() const;
00402 void checkMoveBack(bool checkDuals);
00403 public:
00414 void setValuesPassAction(double incomingInfeasibility,
00415 double allowedInfeasibility);
00418 int cleanFactorization(int ifValuesPass);
00420 void moveStatusToClp(ClpSimplex * clpModel);
00422 void moveStatusFromClp(ClpSimplex * clpModel);
00424
00426 public:
00427
00429 inline double clpObjectiveValue() const {
00430 return (objectiveValue_+objectiveOffset_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset];
00431 }
00434 inline int * pivotVariable() const {
00435 return abcPivotVariable_;
00436 }
00438 inline int stateOfProblem() const
00439 { return stateOfProblem_;}
00441 inline void setStateOfProblem(int value)
00442 { stateOfProblem_=value;}
00444
00445
00447
00448
00451 inline double * scaleFromExternal() const
00452 {return scaleFromExternal_;}
00455 inline double * scaleToExternal() const
00456 {return scaleToExternal_;}
00458 inline double * rowScale2() const
00459 {return rowUseScale_;}
00460 inline double * inverseRowScale2() const
00461 {return inverseRowUseScale_;}
00462 inline double * inverseColumnScale2() const
00463 {return inverseColumnUseScale_;}
00464 inline double * columnScale2() const
00465 {return columnUseScale_;}
00466 inline int arrayForDualColumn() const
00467 {return arrayForDualColumn_;}
00469 inline double upperTheta() const
00470 {return upperTheta_;}
00471 inline int arrayForReplaceColumn() const
00472 { return arrayForReplaceColumn_;}
00473 inline int arrayForFlipBounds() const
00474 { return arrayForFlipBounds_;}
00475 inline int arrayForFlipRhs() const
00476 { return arrayForFlipRhs_;}
00477 inline int arrayForBtran() const
00478 { return arrayForBtran_;}
00479 inline int arrayForFtran() const
00480 { return arrayForFtran_;}
00481 inline int arrayForTableauRow() const
00482 { return arrayForTableauRow_;}
00484 double valueIncomingDual() const;
00486 const double * getColSolution() const;
00487
00489 const double * getRowPrice() const;
00490
00492 const double * getReducedCost() const;
00493
00496 const double * getRowActivity() const;
00498
00504 int gutsOfSolution ( double * givenDuals,
00505 const double * givenPrimals,
00506 bool valuesPass = false);
00508 void gutsOfDelete(int type);
00510 void gutsOfCopy(const AbcSimplex & rhs);
00512 void gutsOfInitialize(int numberRows,int numberColumns,bool doMore);
00514 void gutsOfResize(int numberRows,int numberColumns);
00518 void translate(int type);
00520 void moveToBasic(int which=15);
00522 public:
00525
00526 inline double * solutionRegion() const {
00527 return abcSolution_;
00528 }
00529 inline double * djRegion() const {
00530 return abcDj_;
00531 }
00532 inline double * lowerRegion() const {
00533 return abcLower_;
00534 }
00535 inline double * upperRegion() const {
00536 return abcUpper_;
00537 }
00538 inline double * costRegion() const {
00539 return abcCost_;
00540 }
00542 inline double * solutionRegion(int which) const {
00543 return abcSolution_+which*maximumAbcNumberRows_;
00544 }
00545 inline double * djRegion(int which) const {
00546 return abcDj_+which*maximumAbcNumberRows_;
00547 }
00548 inline double * lowerRegion(int which) const {
00549 return abcLower_+which*maximumAbcNumberRows_;
00550 }
00551 inline double * upperRegion(int which) const {
00552 return abcUpper_+which*maximumAbcNumberRows_;
00553 }
00554 inline double * costRegion(int which) const {
00555 return abcCost_+which*maximumAbcNumberRows_;
00556 }
00558 inline double * solutionBasic() const {
00559 return solutionBasic_;
00560 }
00561 inline double * djBasic() const {
00562 return djBasic_;
00563 }
00564 inline double * lowerBasic() const {
00565 return lowerBasic_;
00566 }
00567 inline double * upperBasic() const {
00568 return upperBasic_;
00569 }
00570 inline double * costBasic() const {
00571 return costBasic_;
00572 }
00574 inline double * abcPerturbation() const
00575 { return abcPerturbation_;}
00577 inline double * fakeDjs() const
00578 { return djSaved_;}
00579 inline unsigned char * internalStatus() const
00580 { return internalStatus_;}
00581 inline AbcSimplex::Status getInternalStatus(int sequence) const {
00582 return static_cast<Status> (internalStatus_[sequence] & 7);
00583 }
00584 inline AbcSimplex::Status getInternalColumnStatus(int sequence) const {
00585 return static_cast<Status> (internalStatus_[sequence+maximumAbcNumberRows_] & 7);
00586 }
00587 inline void setInternalStatus(int sequence, AbcSimplex::Status newstatus) {
00588 unsigned char & st_byte = internalStatus_[sequence];
00589 st_byte = static_cast<unsigned char>(st_byte & ~7);
00590 st_byte = static_cast<unsigned char>(st_byte | newstatus);
00591 }
00592 inline void setInternalColumnStatus(int sequence, AbcSimplex::Status newstatus) {
00593 unsigned char & st_byte = internalStatus_[sequence+maximumAbcNumberRows_];
00594 st_byte = static_cast<unsigned char>(st_byte & ~7);
00595 st_byte = static_cast<unsigned char>(st_byte | newstatus);
00596 }
00601 void setInitialDenseFactorization(bool onOff);
00602 bool initialDenseFactorization() const;
00604 inline int sequenceIn() const {
00605 return sequenceIn_;
00606 }
00607 inline int sequenceOut() const {
00608 return sequenceOut_;
00609 }
00611 inline void setSequenceIn(int sequence) {
00612 sequenceIn_ = sequence;
00613 }
00614 inline void setSequenceOut(int sequence) {
00615 sequenceOut_ = sequence;
00616 }
00617 #if 0
00618
00619 inline int sequenceInternalIn() const {
00620 return sequenceInternalIn_;
00621 }
00622 inline int sequenceInternalOut() const {
00623 return sequenceInternalOut_;
00624 }
00626 inline void setSequenceInternalIn(int sequence) {
00627 sequenceInternalIn_ = sequence;
00628 }
00629 inline void setSequenceInternalOut(int sequence) {
00630 sequenceInternalOut_ = sequence;
00631 }
00632 #endif
00634 inline int isColumn(int sequence) const {
00635 return sequence >= maximumAbcNumberRows_ ? 1 : 0;
00636 }
00638 inline int sequenceWithin(int sequence) const {
00639 return sequence < maximumAbcNumberRows_ ? sequence : sequence - maximumAbcNumberRows_;
00640 }
00642 inline int lastPivotRow() const
00643 { return lastPivotRow_;}
00645 inline int firstFree() const
00646 { return firstFree_;}
00648 inline int lastFirstFree() const
00649 { return lastFirstFree_;}
00651 inline int freeSequenceIn() const
00652 { return freeSequenceIn_;}
00654 inline double currentAcceptablePivot() const
00655 { return currentAcceptablePivot_;}
00656 #ifdef PAN
00657
00663 inline int fakeSuperBasic(int iSequence) {
00664 if ((internalStatus_[iSequence]&7)==4)
00665 return 0;
00666 if ((internalStatus_[iSequence]&7)!=5)
00667 return -2;
00668 double value=abcSolution_[iSequence];
00669 if (value<abcLower_[iSequence]+primalTolerance_) {
00670 if(abcDj_[iSequence]>=-currentDualTolerance_) {
00671 setInternalStatus(iSequence,atLowerBound);
00672 #if PRINT_PAN>1
00673 printf("Pansetting %d to lb\n",iSequence);
00674 #endif
00675 return -1;
00676 } else {
00677 return 1;
00678 }
00679 } else if (value>abcUpper_[iSequence]-primalTolerance_) {
00680 if (abcDj_[iSequence]<=currentDualTolerance_) {
00681 setInternalStatus(iSequence,atUpperBound);
00682 #if PRINT_PAN>1
00683 printf("Pansetting %d to ub\n",iSequence);
00684 #endif
00685 return -1;
00686 } else {
00687 return 1;
00688 }
00689 } else {
00690 return 0;
00691 }
00692 }
00693 #endif
00695 inline double solution(int sequence) {
00696 return abcSolution_[sequence];
00697 }
00699 inline double & solutionAddress(int sequence) {
00700 return abcSolution_[sequence];
00701 }
00702 inline double reducedCost(int sequence) {
00703 return abcDj_[sequence];
00704 }
00705 inline double & reducedCostAddress(int sequence) {
00706 return abcDj_[sequence];
00707 }
00708 inline double lower(int sequence) {
00709 return abcLower_[sequence];
00710 }
00712 inline double & lowerAddress(int sequence) {
00713 return abcLower_[sequence];
00714 }
00715 inline double upper(int sequence) {
00716 return abcUpper_[sequence];
00717 }
00719 inline double & upperAddress(int sequence) {
00720 return abcUpper_[sequence];
00721 }
00722 inline double cost(int sequence) {
00723 return abcCost_[sequence];
00724 }
00726 inline double & costAddress(int sequence) {
00727 return abcCost_[sequence];
00728 }
00730 inline double originalLower(int iSequence) const {
00731 if (iSequence < numberColumns_) return columnLower_[iSequence];
00732 else
00733 return rowLower_[iSequence-numberColumns_];
00734 }
00736 inline double originalUpper(int iSequence) const {
00737 if (iSequence < numberColumns_) return columnUpper_[iSequence];
00738 else
00739 return rowUpper_[iSequence-numberColumns_];
00740 }
00742 inline AbcSimplexProgress * abcProgress()
00743 { return &abcProgress_;}
00744 public:
00747 inline void clearArraysPublic(int which)
00748 { clearArrays(which);}
00751 inline int getAvailableArrayPublic() const
00752 { return getAvailableArray();}
00753 #if ABC_PARALLEL
00755 inline int parallelMode() const
00756 { return parallelMode_;}
00758 inline void setParallelMode(int value)
00759 { parallelMode_=value;}
00761 inline int numberCpus() const
00762 { return parallelMode_+1;}
00763 #if ABC_PARALLEL==1
00765 inline void setStopStart(int value)
00766 { stopStart_=value;}
00767 #endif
00768 #endif
00769
00771 void clearArrays(int which);
00773 void clearArrays(CoinPartitionedVector * which);
00775 int getAvailableArray() const;
00777 inline void setUsedArray(int which) const
00778 {int check=1<<which;assert ((stateOfProblem_&check)==0);stateOfProblem_|=check;}
00780 inline void setAvailableArray(int which) const
00781 {int check=1<<which;assert ((stateOfProblem_&check)!=0);
00782 assert (!usefulArray_[which].getNumElements());stateOfProblem_&=~check;}
00784 void swapPrimalStuff();
00786 void swapDualStuff(int lastSequenceOut,int lastDirectionOut);
00787 protected:
00789
00791
00792 void swap(int pivotRow,int nonBasicPosition,Status newStatus);
00793 inline void setFakeBound(int sequence, FakeBound fakeBound) {
00794 unsigned char & st_byte = internalStatus_[sequence];
00795 st_byte = static_cast<unsigned char>(st_byte & ~24);
00796 st_byte = static_cast<unsigned char>(st_byte | (fakeBound << 3));
00797 }
00798 inline FakeBound getFakeBound(int sequence) const {
00799 return static_cast<FakeBound> ((internalStatus_[sequence] >> 3) & 3);
00800 }
00801 bool atFakeBound(int sequence) const;
00802 inline void setPivoted( int sequence) {
00803 internalStatus_[sequence] = static_cast<unsigned char>(internalStatus_[sequence] | 32);
00804 }
00805 inline void clearPivoted( int sequence) {
00806 internalStatus_[sequence] = static_cast<unsigned char>(internalStatus_[sequence] & ~32);
00807 }
00808 inline bool pivoted(int sequence) const {
00809 return (((internalStatus_[sequence] >> 5) & 1) != 0);
00810 }
00811 public:
00813 void swap(int pivotRow,int nonBasicPosition);
00815 void setFlagged( int sequence);
00816 inline void clearFlagged( int sequence) {
00817 internalStatus_[sequence] = static_cast<unsigned char>(internalStatus_[sequence] & ~64);
00818 }
00819 inline bool flagged(int sequence) const {
00820 return ((internalStatus_[sequence] & 64) != 0);
00821 }
00822 protected:
00824 inline void setActive( int iRow) {
00825 internalStatus_[iRow] = static_cast<unsigned char>(internalStatus_[iRow] | 128);
00826 }
00827 inline void clearActive( int iRow) {
00828 internalStatus_[iRow] = static_cast<unsigned char>(internalStatus_[iRow] & ~128);
00829 }
00830 inline bool active(int iRow) const {
00831 return ((internalStatus_[iRow] & 128) != 0);
00832 }
00833 public:
00836 void createStatus() ;
00838 void crash(int type);
00843 void putStuffInBasis(int type);
00846 void allSlackBasis();
00848 void checkConsistentPivots() const;
00850 void printStuff() const;
00852 int startup(int ifValuesPass);
00853
00855 inline double rawObjectiveValue() const {
00856 return objectiveValue_;
00857 }
00859 void computeObjectiveValue(bool useWorkingSolution = false);
00861 double computeInternalObjectiveValue();
00863 void moveInfo(const AbcSimplex & rhs, bool justStatus = false);
00864 #define NUMBER_THREADS 3
00865 #if ABC_PARALLEL==1
00866
00867 inline pthread_mutex_t * mutexPointer(int which,int thread=0)
00868 { return mutex_+which+3*thread;}
00869 inline pthread_barrier_t * barrierPointer()
00870 { return &barrier_;}
00871 inline int whichLocked(int thread=0) const
00872 { return locked_[thread];}
00873 inline CoinAbcThreadInfo * threadInfoPointer(int thread=0)
00874 { return threadInfo_+thread;}
00875 void startParallelStuff(int type);
00876 int stopParallelStuff(int type);
00878 int whichThread() const;
00879 #elif ABC_PARALLEL==2
00880
00881
00882 #endif
00883
00884
00885
00889 void setObjectiveCoefficient( int elementIndex, double elementValue );
00891 inline void setObjCoeff( int elementIndex, double elementValue ) {
00892 setObjectiveCoefficient( elementIndex, elementValue);
00893 }
00894
00897 void setColumnLower( int elementIndex, double elementValue );
00898
00901 void setColumnUpper( int elementIndex, double elementValue );
00902
00904 void setColumnBounds( int elementIndex,
00905 double lower, double upper );
00906
00915 void setColumnSetBounds(const int* indexFirst,
00916 const int* indexLast,
00917 const double* boundList);
00918
00921 inline void setColLower( int elementIndex, double elementValue ) {
00922 setColumnLower(elementIndex, elementValue);
00923 }
00926 inline void setColUpper( int elementIndex, double elementValue ) {
00927 setColumnUpper(elementIndex, elementValue);
00928 }
00929
00931 inline void setColBounds( int elementIndex,
00932 double newlower, double newupper ) {
00933 setColumnBounds(elementIndex, newlower, newupper);
00934 }
00935
00942 inline void setColSetBounds(const int* indexFirst,
00943 const int* indexLast,
00944 const double* boundList) {
00945 setColumnSetBounds(indexFirst, indexLast, boundList);
00946 }
00947
00950 void setRowLower( int elementIndex, double elementValue );
00951
00954 void setRowUpper( int elementIndex, double elementValue ) ;
00955
00957 void setRowBounds( int elementIndex,
00958 double lower, double upper ) ;
00959
00966 void setRowSetBounds(const int* indexFirst,
00967 const int* indexLast,
00968 const double* boundList);
00970 void resize (int newNumberRows, int newNumberColumns);
00971
00973
00975 protected:
00976
00983
00984 double sumNonBasicCosts_;
00986 double rawObjectiveValue_;
00988 double objectiveOffset_;
00993 double perturbationFactor_;
00995 double currentDualTolerance_;
00997 double currentDualBound_;
00999 double largestGap_;
01001 double lastDualBound_;
01003 double sumFakeInfeasibilities_;
01005 double lastPrimalError_;
01007 double lastDualError_;
01009 double currentAcceptablePivot_;
01011 double movement_;
01013 double objectiveChange_;
01015 double btranAlpha_;
01017 #ifdef ABC_LONG_FACTORIZATION
01018 long
01019 #endif
01020 double ftAlpha_;
01022 double minimumThetaMovement_;
01024 double initialSumInfeasibilities_;
01025 public:
01027 int stateOfIteration_;
01028 protected:
01030 int lastFirstFree_;
01032 int freeSequenceIn_;
01034 int maximumAbcNumberRows_;
01036 int maximumAbcNumberColumns_;
01038 int maximumNumberTotal_;
01040 int numberFlagged_;
01042 int normalDualColumnIteration_;
01048 int stateDualColumn_;
01049
01050
01051
01052
01053
01055 int numberTotal_;
01057 int numberTotalWithoutFixed_;
01059 #define startAtLowerNoOther_ maximumAbcNumberRows_
01061 int startAtLowerOther_;
01063 int startAtUpperNoOther_;
01065 int startAtUpperOther_;
01067 int startOther_;
01069 int startFixed_;
01070 #ifdef EARLY_FACTORIZE
01072 int numberEarly_;
01073 #endif
01074
01091 #define ALL_STATUS_OK 2048
01092 #define ROW_PRIMAL_OK 4096
01093 #define ROW_DUAL_OK 8192
01094 #define COLUMN_PRIMAL_OK 16384
01095 #define COLUMN_DUAL_OK 32768
01096 #define PESSIMISTIC 65536
01097 #define ADD_A_BIT 131072
01098 #define DO_SCALE_AND_MATRIX 262144
01099 #define DO_BASIS_AND_ORDER 524288
01100 #define DO_STATUS 1048576
01101 #define DO_SOLUTION 2097152
01102 #define DO_JUST_BOUNDS 0x400000
01103 #define NEED_BASIS_SORT 0x800000
01104 #define FAKE_SUPERBASIC 0x1000000
01105 #define VALUES_PASS 0x2000000
01106 #define VALUES_PASS2 0x4000000
01107 mutable int stateOfProblem_;
01108 #if ABC_PARALLEL
01109 public:
01111 int parallelMode_;
01112 protected:
01113 #endif
01115 int numberOrdinary_;
01117 int ordinaryVariables_;
01119 int numberFreeNonBasic_;
01121 int lastCleaned_;
01123 int lastPivotRow_;
01125 int swappedAlgorithm_;
01127 int initialNumberInfeasibilities_;
01129 //int * fromExternal_;
01131 //int * toExternal_;
01132
01134 double * scaleFromExternal_;
01137 double * scaleToExternal_;
01139 double * columnUseScale_;
01141 double * inverseColumnUseScale_;
01145 double * offset_;
01147 double * offsetRhs_;
01149 double * tempArray_;
01154 unsigned char * internalStatus_;
01156 unsigned char * internalStatusSaved_;
01159 double * abcPerturbation_;
01161 double * perturbationSaved_;
01163 double * perturbationBasic_;
01165 AbcMatrix * abcMatrix_;
01168 double * abcLower_;
01171 double * abcUpper_;
01177 double * abcCost_;
01180 double * abcSolution_;
01183 double * abcDj_;
01185 double * lowerSaved_;
01187 double * upperSaved_;
01189 double * costSaved_;
01191 double * solutionSaved_;
01193 double * djSaved_;
01195 double * lowerBasic_;
01197 double * upperBasic_;
01199 double * costBasic_;
01201 double * solutionBasic_;
01203 double * djBasic_;
01205 AbcDualRowPivot * abcDualRowPivot_;
01207 AbcPrimalColumnPivot * abcPrimalColumnPivot_;
01211 int * abcPivotVariable_;
01213 int * reversePivotVariable_;
01215 AbcSimplexFactorization * abcFactorization_;
01216 #ifdef EARLY_FACTORIZE
01218 AbcSimplexFactorization * abcEarlyFactorization_;
01219 #endif
01220 #ifdef TEMPORARY_FACTORIZATION
01222 AbcSimplexFactorization * abcOtherFactorization_;
01223 #endif
01225 //double * savedSolution_;
01227 AbcSimplex * abcBaseModel_;
01229 ClpSimplex * clpModel_;
01230
01234 AbcNonLinearCost * abcNonLinearCost_;
01236
01237
01238
01239 #define ABC_NUMBER_USEFUL 8
01240 mutable CoinPartitionedVector usefulArray_[ABC_NUMBER_USEFUL];
01242 AbcSimplexProgress abcProgress_;
01244 ClpDataSave saveData_;
01246 double upperTheta_;
01248 int multipleSequenceIn_[4];
01249 public:
01250 int arrayForDualColumn_;
01251 int arrayForReplaceColumn_;
01252 int arrayForFlipBounds_;
01253 int arrayForFlipRhs_;
01254 int arrayForBtran_;
01255 int arrayForFtran_;
01256 int arrayForTableauRow_;
01257 protected:
01258 int numberFlipped_;
01259 int numberDisasters_;
01260
01261 #if ABC_PARALLEL==1
01262
01263 pthread_mutex_t mutex_[3*NUMBER_THREADS];
01264 pthread_barrier_t barrier_;
01265 CoinAbcThreadInfo threadInfo_[NUMBER_THREADS];
01266 pthread_t abcThread_[NUMBER_THREADS];
01267 int locked_[NUMBER_THREADS];
01268 int stopStart_;
01269 #elif ABC_PARALLEL==2
01270
01271 #endif
01272
01273 };
01274
01283 void
01284 AbcSimplexUnitTest(const std::string & mpsDir);
01285 #endif