Clp trunk
|
00001 /* $Id$ */ 00002 // Copyright (C) 2002, International Business Machines 00003 // Corporation and others. All Rights Reserved. 00004 // This code is licensed under the terms of the Eclipse Public License (EPL). 00005 /* 00006 Authors 00007 00008 John Forrest 00009 00010 */ 00011 #ifndef ClpSimplex_H 00012 #define ClpSimplex_H 00013 00014 #include <iostream> 00015 #include <cfloat> 00016 #include "ClpModel.hpp" 00017 #include "ClpMatrixBase.hpp" 00018 #include "ClpSolve.hpp" 00019 class ClpDualRowPivot; 00020 class ClpPrimalColumnPivot; 00021 class ClpFactorization; 00022 class CoinIndexedVector; 00023 class ClpNonLinearCost; 00024 class ClpNodeStuff; 00025 class CoinStructuredModel; 00026 class OsiClpSolverInterface; 00027 class CoinWarmStartBasis; 00028 class ClpDisasterHandler; 00029 class ClpConstraint; 00030 00049 class ClpSimplex : public ClpModel { 00050 friend void ClpSimplexUnitTest(const std::string & mpsDir); 00051 00052 public: 00057 enum Status { 00058 isFree = 0x00, 00059 basic = 0x01, 00060 atUpperBound = 0x02, 00061 atLowerBound = 0x03, 00062 superBasic = 0x04, 00063 isFixed = 0x05 00064 }; 00065 // For Dual 00066 enum FakeBound { 00067 noFake = 0x00, 00068 lowerFake = 0x01, 00069 upperFake = 0x02, 00070 bothFake = 0x03 00071 }; 00072 00075 00076 ClpSimplex (bool emptyMessages = false ); 00077 00082 ClpSimplex(const ClpSimplex & rhs, int scalingMode = -1); 00087 ClpSimplex(const ClpModel & rhs, int scalingMode = -1); 00094 ClpSimplex (const ClpModel * wholeModel, 00095 int numberRows, const int * whichRows, 00096 int numberColumns, const int * whichColumns, 00097 bool dropNames = true, bool dropIntegers = true, 00098 bool fixOthers = false); 00105 ClpSimplex (const ClpSimplex * wholeModel, 00106 int numberRows, const int * whichRows, 00107 int numberColumns, const int * whichColumns, 00108 bool dropNames = true, bool dropIntegers = true, 00109 bool fixOthers = false); 00113 ClpSimplex (ClpSimplex * wholeModel, 00114 int numberColumns, const int * whichColumns); 00117 void originalModel(ClpSimplex * miniModel); 00123 void setPersistenceFlag(int value); 00125 void makeBaseModel(); 00127 void deleteBaseModel(); 00129 inline ClpSimplex * baseModel() const { 00130 return baseModel_; 00131 } 00135 void setToBaseModel(ClpSimplex * model = NULL); 00137 ClpSimplex & operator=(const ClpSimplex & rhs); 00139 ~ClpSimplex ( ); 00140 // Ones below are just ClpModel with some changes 00152 void loadProblem ( const ClpMatrixBase& matrix, 00153 const double* collb, const double* colub, 00154 const double* obj, 00155 const double* rowlb, const double* rowub, 00156 const double * rowObjective = NULL); 00157 void loadProblem ( const CoinPackedMatrix& matrix, 00158 const double* collb, const double* colub, 00159 const double* obj, 00160 const double* rowlb, const double* rowub, 00161 const double * rowObjective = NULL); 00162 00165 void loadProblem ( const int numcols, const int numrows, 00166 const CoinBigIndex* start, const int* index, 00167 const double* value, 00168 const double* collb, const double* colub, 00169 const double* obj, 00170 const double* rowlb, const double* rowub, 00171 const double * rowObjective = NULL); 00173 void loadProblem ( const int numcols, const int numrows, 00174 const CoinBigIndex* start, const int* index, 00175 const double* value, const int * length, 00176 const double* collb, const double* colub, 00177 const double* obj, 00178 const double* rowlb, const double* rowub, 00179 const double * rowObjective = NULL); 00184 int loadProblem ( CoinModel & modelObject, bool keepSolution = false); 00186 int readMps(const char *filename, 00187 bool keepNames = false, 00188 bool ignoreErrors = false); 00190 int readGMPL(const char *filename, const char * dataName, 00191 bool keepNames = false); 00194 int readLp(const char *filename, const double epsilon = 1e-5); 00199 void borrowModel(ClpModel & otherModel); 00200 void borrowModel(ClpSimplex & otherModel); 00202 void passInEventHandler(const ClpEventHandler * eventHandler); 00204 void getbackSolution(const ClpSimplex & smallModel, const int * whichRow, const int * whichColumn); 00213 int loadNonLinear(void * info, int & numberConstraints, 00214 ClpConstraint ** & constraints); 00216 00222 int initialSolve(ClpSolve & options); 00224 int initialSolve(); 00226 int initialDualSolve(); 00228 int initialPrimalSolve(); 00230 int initialBarrierSolve(); 00232 int initialBarrierNoCrossSolve(); 00243 int dual(int ifValuesPass = 0, int startFinishOptions = 0); 00244 // If using Debug 00245 int dualDebug(int ifValuesPass = 0, int startFinishOptions = 0); 00256 int primal(int ifValuesPass = 0, int startFinishOptions = 0); 00262 int nonlinearSLP(int numberPasses, double deltaTolerance); 00268 int nonlinearSLP(int numberConstraints, ClpConstraint ** constraints, 00269 int numberPasses, double deltaTolerance); 00272 int barrier(bool crossover = true); 00275 int reducedGradient(int phase = 0); 00277 int solve(CoinStructuredModel * model); 00284 int loadProblem ( CoinStructuredModel & modelObject, 00285 bool originalOrder = true, bool keepSolution = false); 00300 int cleanup(int cleanupScaling); 00321 int dualRanging(int numberCheck, const int * which, 00322 double * costIncrease, int * sequenceIncrease, 00323 double * costDecrease, int * sequenceDecrease, 00324 double * valueIncrease = NULL, double * valueDecrease = NULL); 00339 int primalRanging(int numberCheck, const int * which, 00340 double * valueIncrease, int * sequenceIncrease, 00341 double * valueDecrease, int * sequenceDecrease); 00356 int writeBasis(const char *filename, 00357 bool writeValues = false, 00358 int formatType = 0) const; 00361 int readBasis(const char *filename); 00363 CoinWarmStartBasis * getBasis() const; 00365 void setFactorization( ClpFactorization & factorization); 00366 // Swaps factorization 00367 ClpFactorization * swapFactorization( ClpFactorization * factorization); 00369 void copyFactorization( ClpFactorization & factorization); 00379 int tightenPrimalBounds(double factor = 0.0, int doTight = 0, bool tightIntegers = false); 00396 int crash(double gap, int pivot); 00398 void setDualRowPivotAlgorithm(ClpDualRowPivot & choice); 00400 void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot & choice); 00409 int strongBranching(int numberVariables, const int * variables, 00410 double * newLower, double * newUpper, 00411 double ** outputSolution, 00412 int * outputStatus, int * outputIterations, 00413 bool stopOnFirstInfeasible = true, 00414 bool alwaysFinish = false, 00415 int startFinishOptions = 0); 00417 int fathom(void * stuff); 00423 int fathomMany(void * stuff); 00425 double doubleCheck(); 00427 int startFastDual2(ClpNodeStuff * stuff); 00429 int fastDual2(ClpNodeStuff * stuff); 00431 void stopFastDual2(ClpNodeStuff * stuff); 00438 ClpSimplex * fastCrunch(ClpNodeStuff * stuff, int mode); 00440 00448 int pivot(); 00449 00455 int primalPivotResult(); 00456 00463 int dualPivotResult(); 00464 00476 int startup(int ifValuesPass, int startFinishOptions = 0); 00477 void finish(int startFinishOptions = 0); 00478 00480 bool statusOfProblem(bool initial = false); 00482 void defaultFactorizationFrequency(); 00484 00487 00488 inline bool primalFeasible() const { 00489 return (numberPrimalInfeasibilities_ == 0); 00490 } 00492 inline bool dualFeasible() const { 00493 return (numberDualInfeasibilities_ == 0); 00494 } 00496 inline ClpFactorization * factorization() const { 00497 return factorization_; 00498 } 00500 bool sparseFactorization() const; 00501 void setSparseFactorization(bool value); 00503 int factorizationFrequency() const; 00504 void setFactorizationFrequency(int value); 00506 inline double dualBound() const { 00507 return dualBound_; 00508 } 00509 void setDualBound(double value); 00511 inline double infeasibilityCost() const { 00512 return infeasibilityCost_; 00513 } 00514 void setInfeasibilityCost(double value); 00531 inline int perturbation() const { 00532 return perturbation_; 00533 } 00534 void setPerturbation(int value); 00536 inline int algorithm() const { 00537 return algorithm_; 00538 } 00540 inline void setAlgorithm(int value) { 00541 algorithm_ = value; 00542 } 00544 bool isObjectiveLimitTestValid() const ; 00546 inline double sumDualInfeasibilities() const { 00547 return sumDualInfeasibilities_; 00548 } 00549 inline void setSumDualInfeasibilities(double value) { 00550 sumDualInfeasibilities_ = value; 00551 } 00553 inline double sumOfRelaxedDualInfeasibilities() const { 00554 return sumOfRelaxedDualInfeasibilities_; 00555 } 00556 inline void setSumOfRelaxedDualInfeasibilities(double value) { 00557 sumOfRelaxedDualInfeasibilities_ = value; 00558 } 00560 inline int numberDualInfeasibilities() const { 00561 return numberDualInfeasibilities_; 00562 } 00563 inline void setNumberDualInfeasibilities(int value) { 00564 numberDualInfeasibilities_ = value; 00565 } 00567 inline int numberDualInfeasibilitiesWithoutFree() const { 00568 return numberDualInfeasibilitiesWithoutFree_; 00569 } 00571 inline double sumPrimalInfeasibilities() const { 00572 return sumPrimalInfeasibilities_; 00573 } 00574 inline void setSumPrimalInfeasibilities(double value) { 00575 sumPrimalInfeasibilities_ = value; 00576 } 00578 inline double sumOfRelaxedPrimalInfeasibilities() const { 00579 return sumOfRelaxedPrimalInfeasibilities_; 00580 } 00581 inline void setSumOfRelaxedPrimalInfeasibilities(double value) { 00582 sumOfRelaxedPrimalInfeasibilities_ = value; 00583 } 00585 inline int numberPrimalInfeasibilities() const { 00586 return numberPrimalInfeasibilities_; 00587 } 00588 inline void setNumberPrimalInfeasibilities(int value) { 00589 numberPrimalInfeasibilities_ = value; 00590 } 00597 int saveModel(const char * fileName); 00600 int restoreModel(const char * fileName); 00601 00609 void checkSolution(int setToBounds = 0); 00612 void checkSolutionInternal(); 00614 void checkUnscaledSolution(); 00616 inline CoinIndexedVector * rowArray(int index) const { 00617 return rowArray_[index]; 00618 } 00620 inline CoinIndexedVector * columnArray(int index) const { 00621 return columnArray_[index]; 00622 } 00624 00625 /******************** End of most useful part **************/ 00631 int getSolution ( const double * rowActivities, 00632 const double * columnActivities); 00636 int getSolution (); 00643 int createPiecewiseLinearCosts(const int * starts, 00644 const double * lower, const double * gradient); 00646 inline ClpDualRowPivot * dualRowPivot() const { 00647 return dualRowPivot_; 00648 } 00650 inline ClpPrimalColumnPivot * primalColumnPivot() const { 00651 return primalColumnPivot_; 00652 } 00654 inline bool goodAccuracy() const { 00655 return (largestPrimalError_ < 1.0e-7 && largestDualError_ < 1.0e-7); 00656 } 00658 void returnModel(ClpSimplex & otherModel); 00666 int internalFactorize(int solveType); 00668 ClpDataSave saveData() ; 00670 void restoreData(ClpDataSave saved); 00672 void cleanStatus(); 00674 int factorize(); 00677 void computeDuals(double * givenDjs); 00679 void computePrimals ( const double * rowActivities, 00680 const double * columnActivities); 00682 void add(double * array, 00683 int column, double multiplier) const; 00689 void unpack(CoinIndexedVector * rowArray) const ; 00695 void unpack(CoinIndexedVector * rowArray, int sequence) const; 00702 void unpackPacked(CoinIndexedVector * rowArray) ; 00709 void unpackPacked(CoinIndexedVector * rowArray, int sequence); 00710 protected: 00715 int housekeeping(double objectiveChange); 00718 void checkPrimalSolution(const double * rowActivities = NULL, 00719 const double * columnActivies = NULL); 00722 void checkDualSolution(); 00724 void checkBothSolutions(); 00729 double scaleObjective(double value); 00731 int solveDW(CoinStructuredModel * model); 00733 int solveBenders(CoinStructuredModel * model); 00734 public: 00745 void setValuesPassAction(double incomingInfeasibility, 00746 double allowedInfeasibility); 00748 00750 public: 00752 inline double alphaAccuracy() const { 00753 return alphaAccuracy_; 00754 } 00755 inline void setAlphaAccuracy(double value) { 00756 alphaAccuracy_ = value; 00757 } 00758 public: 00760 //inline double objectiveValue() const { 00761 //return (objectiveValue_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset]; 00762 //} 00764 inline void setDisasterHandler(ClpDisasterHandler * handler) { 00765 disasterArea_ = handler; 00766 } 00768 inline ClpDisasterHandler * disasterHandler() const { 00769 return disasterArea_; 00770 } 00772 inline double largeValue() const { 00773 return largeValue_; 00774 } 00775 void setLargeValue( double value) ; 00777 inline double largestPrimalError() const { 00778 return largestPrimalError_; 00779 } 00781 inline double largestDualError() const { 00782 return largestDualError_; 00783 } 00785 inline void setLargestPrimalError(double value) { 00786 largestPrimalError_ = value; 00787 } 00789 inline void setLargestDualError(double value) { 00790 largestDualError_ = value; 00791 } 00793 inline double zeroTolerance() const { 00794 return zeroTolerance_;/*factorization_->zeroTolerance();*/ 00795 } 00797 inline void setZeroTolerance( double value) { 00798 zeroTolerance_ = value; 00799 } 00801 inline int * pivotVariable() const { 00802 return pivotVariable_; 00803 } 00805 inline bool automaticScaling() const { 00806 return automaticScale_ != 0; 00807 } 00808 inline void setAutomaticScaling(bool onOff) { 00809 automaticScale_ = onOff ? 1 : 0; 00810 } 00812 inline double currentDualTolerance() const { 00813 return dualTolerance_; 00814 } 00815 inline void setCurrentDualTolerance(double value) { 00816 dualTolerance_ = value; 00817 } 00819 inline double currentPrimalTolerance() const { 00820 return primalTolerance_; 00821 } 00822 inline void setCurrentPrimalTolerance(double value) { 00823 primalTolerance_ = value; 00824 } 00826 inline int numberRefinements() const { 00827 return numberRefinements_; 00828 } 00829 void setNumberRefinements( int value) ; 00831 inline double alpha() const { 00832 return alpha_; 00833 } 00834 inline void setAlpha(double value) { 00835 alpha_ = value; 00836 } 00838 inline double dualIn() const { 00839 return dualIn_; 00840 } 00842 inline int pivotRow() const { 00843 return pivotRow_; 00844 } 00845 inline void setPivotRow(int value) { 00846 pivotRow_ = value; 00847 } 00849 double valueIncomingDual() const; 00851 00852 protected: 00858 int gutsOfSolution ( double * givenDuals, 00859 const double * givenPrimals, 00860 bool valuesPass = false); 00862 void gutsOfDelete(int type); 00864 void gutsOfCopy(const ClpSimplex & rhs); 00876 bool createRim(int what, bool makeRowCopy = false, int startFinishOptions = 0); 00878 void createRim1(bool initial); 00880 void createRim4(bool initial); 00882 void createRim5(bool initial); 00887 void deleteRim(int getRidOfFactorizationData = 2); 00889 bool sanityCheck(); 00891 public: 00896 inline double * solutionRegion(int section) const { 00897 if (!section) return rowActivityWork_; 00898 else return columnActivityWork_; 00899 } 00900 inline double * djRegion(int section) const { 00901 if (!section) return rowReducedCost_; 00902 else return reducedCostWork_; 00903 } 00904 inline double * lowerRegion(int section) const { 00905 if (!section) return rowLowerWork_; 00906 else return columnLowerWork_; 00907 } 00908 inline double * upperRegion(int section) const { 00909 if (!section) return rowUpperWork_; 00910 else return columnUpperWork_; 00911 } 00912 inline double * costRegion(int section) const { 00913 if (!section) return rowObjectiveWork_; 00914 else return objectiveWork_; 00915 } 00917 inline double * solutionRegion() const { 00918 return solution_; 00919 } 00920 inline double * djRegion() const { 00921 return dj_; 00922 } 00923 inline double * lowerRegion() const { 00924 return lower_; 00925 } 00926 inline double * upperRegion() const { 00927 return upper_; 00928 } 00929 inline double * costRegion() const { 00930 return cost_; 00931 } 00932 inline Status getStatus(int sequence) const { 00933 return static_cast<Status> (status_[sequence] & 7); 00934 } 00935 inline void setStatus(int sequence, Status newstatus) { 00936 unsigned char & st_byte = status_[sequence]; 00937 st_byte = static_cast<unsigned char>(st_byte & ~7); 00938 st_byte = static_cast<unsigned char>(st_byte | newstatus); 00939 } 00941 bool startPermanentArrays(); 00946 void setInitialDenseFactorization(bool onOff); 00947 bool initialDenseFactorization() const; 00949 inline int sequenceIn() const { 00950 return sequenceIn_; 00951 } 00952 inline int sequenceOut() const { 00953 return sequenceOut_; 00954 } 00956 inline void setSequenceIn(int sequence) { 00957 sequenceIn_ = sequence; 00958 } 00959 inline void setSequenceOut(int sequence) { 00960 sequenceOut_ = sequence; 00961 } 00963 inline int directionIn() const { 00964 return directionIn_; 00965 } 00966 inline int directionOut() const { 00967 return directionOut_; 00968 } 00970 inline void setDirectionIn(int direction) { 00971 directionIn_ = direction; 00972 } 00973 inline void setDirectionOut(int direction) { 00974 directionOut_ = direction; 00975 } 00977 inline double valueOut() const { 00978 return valueOut_; 00979 } 00981 inline void setValueOut(double value) { 00982 valueOut_ = value; 00983 } 00985 inline void setLowerOut(double value) { 00986 lowerOut_ = value; 00987 } 00989 inline void setUpperOut(double value) { 00990 upperOut_ = value; 00991 } 00993 inline void setTheta(double value) { 00994 theta_ = value; 00995 } 00997 inline int isColumn(int sequence) const { 00998 return sequence < numberColumns_ ? 1 : 0; 00999 } 01001 inline int sequenceWithin(int sequence) const { 01002 return sequence < numberColumns_ ? sequence : sequence - numberColumns_; 01003 } 01005 inline double solution(int sequence) { 01006 return solution_[sequence]; 01007 } 01009 inline double & solutionAddress(int sequence) { 01010 return solution_[sequence]; 01011 } 01012 inline double reducedCost(int sequence) { 01013 return dj_[sequence]; 01014 } 01015 inline double & reducedCostAddress(int sequence) { 01016 return dj_[sequence]; 01017 } 01018 inline double lower(int sequence) { 01019 return lower_[sequence]; 01020 } 01022 inline double & lowerAddress(int sequence) { 01023 return lower_[sequence]; 01024 } 01025 inline double upper(int sequence) { 01026 return upper_[sequence]; 01027 } 01029 inline double & upperAddress(int sequence) { 01030 return upper_[sequence]; 01031 } 01032 inline double cost(int sequence) { 01033 return cost_[sequence]; 01034 } 01036 inline double & costAddress(int sequence) { 01037 return cost_[sequence]; 01038 } 01040 inline double originalLower(int iSequence) const { 01041 if (iSequence < numberColumns_) return columnLower_[iSequence]; 01042 else 01043 return rowLower_[iSequence-numberColumns_]; 01044 } 01046 inline double originalUpper(int iSequence) const { 01047 if (iSequence < numberColumns_) return columnUpper_[iSequence]; 01048 else 01049 return rowUpper_[iSequence-numberColumns_]; 01050 } 01052 inline double theta() const { 01053 return theta_; 01054 } 01057 inline double bestPossibleImprovement() const { 01058 return bestPossibleImprovement_; 01059 } 01061 inline ClpNonLinearCost * nonLinearCost() const { 01062 return nonLinearCost_; 01063 } 01077 inline int moreSpecialOptions() const { 01078 return moreSpecialOptions_; 01079 } 01093 inline void setMoreSpecialOptions(int value) { 01094 moreSpecialOptions_ = value; 01095 } 01097 01099 inline void setFakeBound(int sequence, FakeBound fakeBound) { 01100 unsigned char & st_byte = status_[sequence]; 01101 st_byte = static_cast<unsigned char>(st_byte & ~24); 01102 st_byte = static_cast<unsigned char>(st_byte | (fakeBound << 3)); 01103 } 01104 inline FakeBound getFakeBound(int sequence) const { 01105 return static_cast<FakeBound> ((status_[sequence] >> 3) & 3); 01106 } 01107 inline void setRowStatus(int sequence, Status newstatus) { 01108 unsigned char & st_byte = status_[sequence+numberColumns_]; 01109 st_byte = static_cast<unsigned char>(st_byte & ~7); 01110 st_byte = static_cast<unsigned char>(st_byte | newstatus); 01111 } 01112 inline Status getRowStatus(int sequence) const { 01113 return static_cast<Status> (status_[sequence+numberColumns_] & 7); 01114 } 01115 inline void setColumnStatus(int sequence, Status newstatus) { 01116 unsigned char & st_byte = status_[sequence]; 01117 st_byte = static_cast<unsigned char>(st_byte & ~7); 01118 st_byte = static_cast<unsigned char>(st_byte | newstatus); 01119 } 01120 inline Status getColumnStatus(int sequence) const { 01121 return static_cast<Status> (status_[sequence] & 7); 01122 } 01123 inline void setPivoted( int sequence) { 01124 status_[sequence] = static_cast<unsigned char>(status_[sequence] | 32); 01125 } 01126 inline void clearPivoted( int sequence) { 01127 status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~32); 01128 } 01129 inline bool pivoted(int sequence) const { 01130 return (((status_[sequence] >> 5) & 1) != 0); 01131 } 01133 void setFlagged( int sequence); 01134 inline void clearFlagged( int sequence) { 01135 status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~64); 01136 } 01137 inline bool flagged(int sequence) const { 01138 return ((status_[sequence] & 64) != 0); 01139 } 01141 inline void setActive( int iRow) { 01142 status_[iRow] = static_cast<unsigned char>(status_[iRow] | 128); 01143 } 01144 inline void clearActive( int iRow) { 01145 status_[iRow] = static_cast<unsigned char>(status_[iRow] & ~128); 01146 } 01147 inline bool active(int iRow) const { 01148 return ((status_[iRow] & 128) != 0); 01149 } 01152 void createStatus() ; 01155 void allSlackBasis(bool resetSolution = false); 01156 01158 inline int lastBadIteration() const { 01159 return lastBadIteration_; 01160 } 01162 inline int progressFlag() const { 01163 return (progressFlag_ & 3); 01164 } 01166 inline void forceFactorization(int value) { 01167 forceFactorization_ = value; 01168 } 01170 inline double rawObjectiveValue() const { 01171 return objectiveValue_; 01172 } 01174 void computeObjectiveValue(bool useWorkingSolution = false); 01176 double computeInternalObjectiveValue(); 01180 inline int numberExtraRows() const { 01181 return numberExtraRows_; 01182 } 01185 inline int maximumBasic() const { 01186 return maximumBasic_; 01187 } 01189 inline int baseIteration() const { 01190 return baseIteration_; 01191 } 01193 void generateCpp( FILE * fp, bool defaultFactor = false); 01195 ClpFactorization * getEmptyFactorization(); 01197 void setEmptyFactorization(); 01199 void moveInfo(const ClpSimplex & rhs, bool justStatus = false); 01201 01203 // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal) 01204 // *** At present only without scaling 01205 // *** Slacks havve -1.0 element (so == row activity) - take care 01207 void getBInvARow(int row, double* z, double * slack = NULL); 01208 01210 void getBInvRow(int row, double* z); 01211 01213 void getBInvACol(int col, double* vec); 01214 01216 void getBInvCol(int col, double* vec); 01217 01222 void getBasics(int* index); 01223 01225 //------------------------------------------------------------------------- 01229 void setObjectiveCoefficient( int elementIndex, double elementValue ); 01231 inline void setObjCoeff( int elementIndex, double elementValue ) { 01232 setObjectiveCoefficient( elementIndex, elementValue); 01233 } 01234 01237 void setColumnLower( int elementIndex, double elementValue ); 01238 01241 void setColumnUpper( int elementIndex, double elementValue ); 01242 01244 void setColumnBounds( int elementIndex, 01245 double lower, double upper ); 01246 01255 void setColumnSetBounds(const int* indexFirst, 01256 const int* indexLast, 01257 const double* boundList); 01258 01261 inline void setColLower( int elementIndex, double elementValue ) { 01262 setColumnLower(elementIndex, elementValue); 01263 } 01266 inline void setColUpper( int elementIndex, double elementValue ) { 01267 setColumnUpper(elementIndex, elementValue); 01268 } 01269 01271 inline void setColBounds( int elementIndex, 01272 double newlower, double newupper ) { 01273 setColumnBounds(elementIndex, newlower, newupper); 01274 } 01275 01282 inline void setColSetBounds(const int* indexFirst, 01283 const int* indexLast, 01284 const double* boundList) { 01285 setColumnSetBounds(indexFirst, indexLast, boundList); 01286 } 01287 01290 void setRowLower( int elementIndex, double elementValue ); 01291 01294 void setRowUpper( int elementIndex, double elementValue ) ; 01295 01297 void setRowBounds( int elementIndex, 01298 double lower, double upper ) ; 01299 01306 void setRowSetBounds(const int* indexFirst, 01307 const int* indexLast, 01308 const double* boundList); 01310 void resize (int newNumberRows, int newNumberColumns); 01311 01313 01315 protected: 01316 01325 double bestPossibleImprovement_; 01327 double zeroTolerance_; 01329 int columnPrimalSequence_; 01331 int rowPrimalSequence_; 01333 double bestObjectiveValue_; 01335 int moreSpecialOptions_; 01337 int baseIteration_; 01339 double primalToleranceToGetOptimal_; 01341 double largeValue_; 01343 double largestPrimalError_; 01345 double largestDualError_; 01347 double alphaAccuracy_; 01349 double dualBound_; 01351 double alpha_; 01353 double theta_; 01355 double lowerIn_; 01357 double valueIn_; 01359 double upperIn_; 01361 double dualIn_; 01363 double lowerOut_; 01365 double valueOut_; 01367 double upperOut_; 01369 double dualOut_; 01371 double dualTolerance_; 01373 double primalTolerance_; 01375 double sumDualInfeasibilities_; 01377 double sumPrimalInfeasibilities_; 01379 double infeasibilityCost_; 01381 double sumOfRelaxedDualInfeasibilities_; 01383 double sumOfRelaxedPrimalInfeasibilities_; 01385 double acceptablePivot_; 01387 double * lower_; 01389 double * rowLowerWork_; 01391 double * columnLowerWork_; 01393 double * upper_; 01395 double * rowUpperWork_; 01397 double * columnUpperWork_; 01399 double * cost_; 01401 double * rowObjectiveWork_; 01403 double * objectiveWork_; 01405 CoinIndexedVector * rowArray_[6]; 01407 CoinIndexedVector * columnArray_[6]; 01409 int sequenceIn_; 01411 int directionIn_; 01413 int sequenceOut_; 01415 int directionOut_; 01417 int pivotRow_; 01419 int lastGoodIteration_; 01421 double * dj_; 01423 double * rowReducedCost_; 01425 double * reducedCostWork_; 01427 double * solution_; 01429 double * rowActivityWork_; 01431 double * columnActivityWork_; 01433 int numberDualInfeasibilities_; 01435 int numberDualInfeasibilitiesWithoutFree_; 01437 int numberPrimalInfeasibilities_; 01439 int numberRefinements_; 01441 ClpDualRowPivot * dualRowPivot_; 01443 ClpPrimalColumnPivot * primalColumnPivot_; 01445 int * pivotVariable_; 01447 ClpFactorization * factorization_; 01449 double * savedSolution_; 01451 int numberTimesOptimal_; 01453 ClpDisasterHandler * disasterArea_; 01455 int changeMade_; 01457 int algorithm_; 01460 int forceFactorization_; 01468 int perturbation_; 01470 unsigned char * saveStatus_; 01475 ClpNonLinearCost * nonLinearCost_; 01477 int lastBadIteration_; 01479 int lastFlaggedIteration_; 01481 int numberFake_; 01483 int numberChanged_; 01485 int progressFlag_; 01487 int firstFree_; 01491 int numberExtraRows_; 01494 int maximumBasic_; 01496 int dontFactorizePivots_; 01506 double incomingInfeasibility_; 01507 double allowedInfeasibility_; 01509 int automaticScale_; 01511 int maximumPerturbationSize_; 01513 double * perturbationArray_; 01515 ClpSimplex * baseModel_; 01517 ClpSimplexProgress progress_; 01518 public: 01520 mutable int spareIntArray_[4]; 01522 mutable double spareDoubleArray_[4]; 01523 protected: 01525 friend class OsiClpSolverInterface; 01527 }; 01528 //############################################################################# 01537 void 01538 ClpSimplexUnitTest(const std::string & mpsDir); 01539 01540 // For Devex stuff 01541 #define DEVEX_TRY_NORM 1.0e-4 01542 #define DEVEX_ADD_ONE 1.0 01543 #endif