/home/coin/SVN-release/Cbc-1.1.1/Clp/src/ClpSimplex.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2002, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 
00004 /* 
00005    Authors
00006  
00007    John Forrest
00008 
00009  */
00010 #ifndef ClpSimplex_H
00011 #define ClpSimplex_H
00012 
00013 #if defined(_MSC_VER)
00014 // Turn off compiler warning about long names
00015 #  pragma warning(disable:4786)
00016 #endif
00017 
00018 #include <iostream>
00019 #include <cfloat>
00020 #include "ClpModel.hpp"
00021 #include "ClpMatrixBase.hpp"
00022 #include "ClpSolve.hpp"
00023 class ClpDualRowPivot;
00024 class ClpPrimalColumnPivot;
00025 class ClpFactorization;
00026 class CoinIndexedVector;
00027 class ClpNonLinearCost;
00028 class ClpSimplexProgress;
00029 class CoinModel;
00030 class OsiClpSolverInterface;
00031 class CoinWarmStartBasis;
00032 
00054 class ClpSimplex : public ClpModel {
00055    friend void ClpSimplexUnitTest(const std::string & mpsDir,
00056                                   const std::string & netlibDir);
00057 
00058 public:
00063   enum Status {
00064     isFree = 0x00,
00065     basic = 0x01,
00066     atUpperBound = 0x02,
00067     atLowerBound = 0x03,
00068     superBasic = 0x04,
00069     isFixed = 0x05
00070   };
00071   // For Dual
00072   enum FakeBound {
00073     noFake = 0x00,
00074     bothFake = 0x01,
00075     upperFake = 0x02,
00076     lowerFake = 0x03
00077   };
00078 
00081 
00082     ClpSimplex (  );
00083 
00088   ClpSimplex(const ClpSimplex & rhs, int scalingMode =-1);
00093   ClpSimplex(const ClpModel & rhs, int scalingMode=-1);
00100   ClpSimplex (const ClpModel * wholeModel,
00101               int numberRows, const int * whichRows,
00102               int numberColumns, const int * whichColumns,
00103               bool dropNames=true, bool dropIntegers=true,
00104               bool fixOthers=false);
00108   ClpSimplex (ClpSimplex * wholeModel,
00109               int numberColumns, const int * whichColumns);
00112   void originalModel(ClpSimplex * miniModel);
00126   void auxiliaryModel(int options);
00128   void deleteAuxiliaryModel();
00130   inline bool usingAuxiliaryModel() const
00131   { return auxiliaryModel_!=NULL;};
00133     ClpSimplex & operator=(const ClpSimplex & rhs);
00135    ~ClpSimplex (  );
00136   // Ones below are just ClpModel with some changes
00148   void loadProblem (  const ClpMatrixBase& matrix,
00149                      const double* collb, const double* colub,   
00150                      const double* obj,
00151                      const double* rowlb, const double* rowub,
00152                       const double * rowObjective=NULL);
00153   void loadProblem (  const CoinPackedMatrix& matrix,
00154                      const double* collb, const double* colub,   
00155                      const double* obj,
00156                      const double* rowlb, const double* rowub,
00157                       const double * rowObjective=NULL);
00158 
00161   void loadProblem (  const int numcols, const int numrows,
00162                      const CoinBigIndex* start, const int* index,
00163                      const double* value,
00164                      const double* collb, const double* colub,   
00165                      const double* obj,
00166                       const double* rowlb, const double* rowub,
00167                       const double * rowObjective=NULL);
00169   void loadProblem (  const int numcols, const int numrows,
00170                      const CoinBigIndex* start, const int* index,
00171                       const double* value,const int * length,
00172                      const double* collb, const double* colub,   
00173                      const double* obj,
00174                       const double* rowlb, const double* rowub,
00175                       const double * rowObjective=NULL);
00180   int loadProblem (  CoinModel & modelObject,bool keepSolution=false);
00182   int readMps(const char *filename,
00183               bool keepNames=false,
00184               bool ignoreErrors = false);
00186   int readGMPL(const char *filename,const char * dataName,
00187                bool keepNames=false);
00192   void borrowModel(ClpModel & otherModel);
00193   void borrowModel(ClpSimplex & otherModel);
00195    void passInEventHandler(const ClpEventHandler * eventHandler);
00197   void getbackSolution(const ClpSimplex & smallModel,const int * whichRow, const int * whichColumn);
00199 
00205   int initialSolve(ClpSolve & options);
00207   int initialSolve();
00209   int initialDualSolve();
00211   int initialPrimalSolve();
00222   int dual(int ifValuesPass=0, int startFinishOptions=0);
00223   // If using Debug
00224   int dualDebug(int ifValuesPass=0, int startFinishOptions=0);
00235   int primal(int ifValuesPass=0, int startFinishOptions=0);
00241   int nonlinearSLP(int numberPasses,double deltaTolerance);
00244   int barrier(bool crossover=true);
00247   int reducedGradient(int phase=0);
00262   int cleanup(int cleanupScaling);
00280   int dualRanging(int numberCheck,const int * which,
00281                   double * costIncrease, int * sequenceIncrease,
00282                   double * costDecrease, int * sequenceDecrease);
00296   int primalRanging(int numberCheck,const int * which,
00297                   double * valueIncrease, int * sequenceIncrease,
00298                   double * valueDecrease, int * sequenceDecrease);
00313   int writeBasis(const char *filename,
00314                  bool writeValues=false,
00315                  int formatType=0) const;
00318   int readBasis(const char *filename);
00320   CoinWarmStartBasis * getBasis() const;
00322   void setFactorization( ClpFactorization & factorization);
00332   int tightenPrimalBounds(double factor=0.0,int doTight=0);
00349   int crash(double gap,int pivot);
00351   void setDualRowPivotAlgorithm(ClpDualRowPivot & choice);
00353   void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot & choice);
00362   int strongBranching(int numberVariables,const int * variables,
00363                       double * newLower, double * newUpper,
00364                       double ** outputSolution,
00365                       int * outputStatus, int * outputIterations,
00366                       bool stopOnFirstInfeasible=true,
00367                       bool alwaysFinish=false,
00368                       int startFinishOptions=0);
00370 
00378   int pivot();
00379 
00385   int primalPivotResult();
00386   
00393   int dualPivotResult();
00394 
00406   int startup(int ifValuesPass,int startFinishOptions=0);
00407   void finish(int startFinishOptions=0);
00408   
00410   bool statusOfProblem(bool initial=false);
00412   void defaultFactorizationFrequency();
00414 
00417 
00418   inline bool primalFeasible() const
00419          { return (numberPrimalInfeasibilities_==0);};
00421   inline bool dualFeasible() const
00422          { return (numberDualInfeasibilities_==0);};
00424   inline ClpFactorization * factorization() const 
00425           { return factorization_;};
00427   bool sparseFactorization() const;
00428   void setSparseFactorization(bool value);
00430   int factorizationFrequency() const;
00431   void setFactorizationFrequency(int value);
00433   inline double dualBound() const
00434           { return dualBound_;};
00435   void setDualBound(double value);
00437   inline double infeasibilityCost() const
00438           { return infeasibilityCost_;};
00439   void setInfeasibilityCost(double value);
00456   inline int perturbation() const
00457     { return perturbation_;};
00458   void setPerturbation(int value);
00460   inline int algorithm() const 
00461   {return algorithm_; } ;
00463   inline void setAlgorithm(int value)
00464   {algorithm_=value; } ;
00466   inline double sumDualInfeasibilities() const 
00467           { return sumDualInfeasibilities_;} ;
00468   inline void setSumDualInfeasibilities(double value)
00469           { sumDualInfeasibilities_=value;} ;
00471   inline double sumOfRelaxedDualInfeasibilities() const 
00472           { return sumOfRelaxedDualInfeasibilities_;} ;
00473   inline void setSumOfRelaxedDualInfeasibilities(double value)
00474           { sumOfRelaxedDualInfeasibilities_=value;} ;
00476   inline int numberDualInfeasibilities() const 
00477           { return numberDualInfeasibilities_;} ;
00478   inline void setNumberDualInfeasibilities(int value)
00479           { numberDualInfeasibilities_=value;} ;
00481   inline double sumPrimalInfeasibilities() const 
00482           { return sumPrimalInfeasibilities_;} ;
00483   inline void setSumPrimalInfeasibilities(double value)
00484           { sumPrimalInfeasibilities_=value;} ;
00486   inline double sumOfRelaxedPrimalInfeasibilities() const 
00487           { return sumOfRelaxedPrimalInfeasibilities_;} ;
00488   inline void setSumOfRelaxedPrimalInfeasibilities(double value)
00489           { sumOfRelaxedPrimalInfeasibilities_=value;} ;
00491   inline int numberPrimalInfeasibilities() const 
00492           { return numberPrimalInfeasibilities_;} ;
00493   inline void setNumberPrimalInfeasibilities(int value)
00494           { numberPrimalInfeasibilities_=value;} ;
00501   int saveModel(const char * fileName);
00504   int restoreModel(const char * fileName);
00505   
00513   void checkSolution(int setToBounds=false);
00516   void checkSolutionInternal();
00518   inline CoinIndexedVector * rowArray(int index) const
00519   { return rowArray_[index];};
00521   inline CoinIndexedVector * columnArray(int index) const
00522   { return columnArray_[index];};
00524 
00525   /******************** End of most useful part **************/
00531   int getSolution (  const double * rowActivities,
00532                      const double * columnActivities);
00536   int getSolution ();
00543   int createPiecewiseLinearCosts(const int * starts,
00544                    const double * lower, const double * gradient);
00546   void returnModel(ClpSimplex & otherModel);
00554   int internalFactorize(int solveType);
00556   ClpDataSave saveData() ;
00558   void restoreData(ClpDataSave saved);
00560   void cleanStatus();
00562   int factorize();
00565   void computeDuals(double * givenDjs);
00567   void computePrimals (  const double * rowActivities,
00568                      const double * columnActivities);
00570   void add(double * array,
00571                    int column, double multiplier) const;
00577   void unpack(CoinIndexedVector * rowArray) const ;
00583   void unpack(CoinIndexedVector * rowArray,int sequence) const;
00590   void unpackPacked(CoinIndexedVector * rowArray) ;
00597   void unpackPacked(CoinIndexedVector * rowArray,int sequence);
00598 protected:  
00603   int housekeeping(double objectiveChange);
00606   void checkPrimalSolution(const double * rowActivities=NULL,
00607                            const double * columnActivies=NULL);
00610   void checkDualSolution();
00612   void checkBothSolutions();
00613 public:
00624   void setValuesPassAction(float incomingInfeasibility,
00625                            float allowedInfeasibility);
00627 
00629   // On reflection I doubt whether anyone uses so test
00630 private:
00632   inline double columnPrimalInfeasibility() const 
00633           { return columnPrimalInfeasibility_;} ;
00635   inline int columnPrimalSequence() const 
00636           { return columnPrimalSequence_;} ;
00638   inline double rowPrimalInfeasibility() const 
00639           { return rowPrimalInfeasibility_;} ;
00641   inline int rowPrimalSequence() const 
00642           { return rowPrimalSequence_;} ;
00645   inline double columnDualInfeasibility() const 
00646           { return columnDualInfeasibility_;} ;
00648   inline int columnDualSequence() const 
00649           { return columnDualSequence_;} ;
00651   inline double rowDualInfeasibility() const 
00652           { return rowDualInfeasibility_;} ;
00654   inline int rowDualSequence() const 
00655           { return rowDualSequence_;} ;
00657   inline double primalToleranceToGetOptimal() const 
00658           { return primalToleranceToGetOptimal_;} ;
00660   inline double remainingDualInfeasibility() const 
00661           { return remainingDualInfeasibility_;} ;
00663   inline double largestSolutionError() const
00664           { return largestSolutionError_;} ;
00665 public:
00667   inline double largeValue() const 
00668           { return largeValue_;} ;
00669   void setLargeValue( double value) ;
00671   inline double largestPrimalError() const
00672           { return largestPrimalError_;} ;
00674   inline double largestDualError() const
00675           { return largestDualError_;} ;
00677   inline void setLargestPrimalError(double value)
00678           { largestPrimalError_=value;} ;
00680   inline void setLargestDualError(double value)
00681           { largestDualError_=value;} ;
00683   inline int * pivotVariable() const
00684           { return pivotVariable_;};
00686   inline bool automaticScaling() const
00687   { return automaticScale_!=0;};
00688   inline void setAutomaticScaling(bool onOff)
00689   { automaticScale_ = onOff ? 1: 0;}; 
00691   inline double currentDualTolerance() const 
00692           { return dualTolerance_;} ;
00693   inline void setCurrentDualTolerance(double value)
00694           { dualTolerance_ = value;} ;
00696   inline double currentPrimalTolerance() const 
00697           { return primalTolerance_;} ;
00698   inline void setCurrentPrimalTolerance(double value)
00699           { primalTolerance_ = value;} ;
00701   inline int numberRefinements() const 
00702           { return numberRefinements_;} ;
00703   void setNumberRefinements( int value) ;
00705   inline double alpha() const { return alpha_;};
00706   inline void setAlpha(double value) { alpha_ = value;};
00708   inline double dualIn() const { return dualIn_;};
00710   inline int pivotRow() const{ return pivotRow_;};
00711   inline void setPivotRow(int value) { pivotRow_=value;};
00713   double valueIncomingDual() const;
00715 
00716   protected:
00722   int gutsOfSolution ( double * givenDuals,
00723                        const double * givenPrimals,
00724                        bool valuesPass=false);
00726   void gutsOfDelete(int type);
00728   void gutsOfCopy(const ClpSimplex & rhs);
00740   bool createRim(int what,bool makeRowCopy=false,int startFinishOptions=0);
00745   void deleteRim(int getRidOfFactorizationData=2);
00747   bool sanityCheck();
00749   public:
00754   inline double * solutionRegion(int section) const
00755   { if (!section) return rowActivityWork_; else return columnActivityWork_;};
00756   inline double * djRegion(int section) const
00757   { if (!section) return rowReducedCost_; else return reducedCostWork_;};
00758   inline double * lowerRegion(int section) const
00759   { if (!section) return rowLowerWork_; else return columnLowerWork_;};
00760   inline double * upperRegion(int section) const
00761   { if (!section) return rowUpperWork_; else return columnUpperWork_;};
00762   inline double * costRegion(int section) const
00763   { if (!section) return rowObjectiveWork_; else return objectiveWork_;};
00765   inline double * solutionRegion() const
00766   { return solution_;};
00767   inline double * djRegion() const
00768   { return dj_;};
00769   inline double * lowerRegion() const
00770   { return lower_;};
00771   inline double * upperRegion() const
00772   { return upper_;};
00773   inline double * costRegion() const
00774   { return cost_;};
00775   inline Status getStatus(int sequence) const
00776   {return static_cast<Status> (status_[sequence]&7);};
00777   inline void setStatus(int sequence, Status status)
00778   {
00779     unsigned char & st_byte = status_[sequence];
00780     st_byte &= ~7;
00781     st_byte |= status;
00782   };
00787   void setInitialDenseFactorization(bool onOff);
00788   bool  initialDenseFactorization() const;
00790   inline int sequenceIn() const
00791   {return sequenceIn_;};
00792   inline int sequenceOut() const
00793   {return sequenceOut_;};
00795   inline void  setSequenceIn(int sequence)
00796   { sequenceIn_=sequence;};
00797   inline void  setSequenceOut(int sequence)
00798   { sequenceOut_=sequence;};
00800   inline int directionIn() const
00801   {return directionIn_;};
00802   inline int directionOut() const
00803   {return directionOut_;};
00805   inline void  setDirectionIn(int direction)
00806   { directionIn_=direction;};
00807   inline void  setDirectionOut(int direction)
00808   { directionOut_=direction;};
00810   inline double valueOut() const
00811   { return valueOut_;};
00813   inline int isColumn(int sequence) const
00814   { return sequence<numberColumns_ ? 1 : 0;};
00816   inline int sequenceWithin(int sequence) const
00817   { return sequence<numberColumns_ ? sequence : sequence-numberColumns_;};
00819   inline double solution(int sequence)
00820   { return solution_[sequence];};
00822   inline double & solutionAddress(int sequence)
00823   { return solution_[sequence];};
00824   inline double reducedCost(int sequence)
00825    { return dj_[sequence];};
00826   inline double & reducedCostAddress(int sequence)
00827    { return dj_[sequence];};
00828   inline double lower(int sequence)
00829   { return lower_[sequence];};
00831   inline double & lowerAddress(int sequence)
00832   { return lower_[sequence];};
00833   inline double upper(int sequence)
00834   { return upper_[sequence];};
00836   inline double & upperAddress(int sequence)
00837   { return upper_[sequence];};
00838   inline double cost(int sequence)
00839   { return cost_[sequence];};
00841   inline double & costAddress(int sequence)
00842   { return cost_[sequence];};
00844   inline double originalLower(int iSequence) const
00845   { if (iSequence<numberColumns_) return columnLower_[iSequence]; else
00846     return rowLower_[iSequence-numberColumns_];};
00848   inline double originalUpper(int iSequence) const
00849   { if (iSequence<numberColumns_) return columnUpper_[iSequence]; else
00850     return rowUpper_[iSequence-numberColumns_];};
00852   inline double theta() const
00853   { return theta_;};
00855   inline ClpNonLinearCost * nonLinearCost() const
00856   { return nonLinearCost_;};
00858 
00860   inline void setFakeBound(int sequence, FakeBound fakeBound)
00861   {
00862     unsigned char & st_byte = status_[sequence];
00863     st_byte &= ~24;
00864     st_byte |= fakeBound<<3;
00865   };
00866   inline FakeBound getFakeBound(int sequence) const
00867   {return static_cast<FakeBound> ((status_[sequence]>>3)&3);};
00868   inline void setRowStatus(int sequence, Status status)
00869   {
00870     unsigned char & st_byte = status_[sequence+numberColumns_];
00871     st_byte &= ~7;
00872     st_byte |= status;
00873   };
00874   inline Status getRowStatus(int sequence) const
00875   {return static_cast<Status> (status_[sequence+numberColumns_]&7);};
00876   inline void setColumnStatus(int sequence, Status status)
00877   {
00878     unsigned char & st_byte = status_[sequence];
00879     st_byte &= ~7;
00880     st_byte |= status;
00881   };
00882   inline Status getColumnStatus(int sequence) const
00883   {return static_cast<Status> (status_[sequence]&7);};
00884   inline void setPivoted( int sequence)
00885   { status_[sequence] |= 32;};
00886   inline void clearPivoted( int sequence)
00887   { status_[sequence] &= ~32; };
00888   inline bool pivoted(int sequence) const
00889   {return (((status_[sequence]>>5)&1)!=0);};
00891   void setFlagged( int sequence);
00892   inline void clearFlagged( int sequence)
00893   {
00894     status_[sequence] &= ~64;
00895   };
00896   inline bool flagged(int sequence) const
00897   {return ((status_[sequence]&64)!=0);};
00899   inline void setActive( int iRow)
00900   {
00901     status_[iRow] |= 128;
00902   };
00903   inline void clearActive( int iRow)
00904   {
00905     status_[iRow] &= ~128;
00906   };
00907   inline bool active(int iRow) const
00908   {return ((status_[iRow]&128)!=0);};
00911   void createStatus() ;
00914   void allSlackBasis(bool resetSolution=false);
00915     
00917   inline int lastBadIteration() const
00918   {return lastBadIteration_;};
00920   inline int progressFlag() const
00921   {return progressFlag_;};
00923   inline void forceFactorization(int value)
00924   { forceFactorization_ = value;};
00926   inline double rawObjectiveValue() const
00927   { return objectiveValue_;};
00929   void computeObjectiveValue();
00933   inline int numberExtraRows() const
00934   { return numberExtraRows_;};
00937   inline int maximumBasic() const
00938   { return maximumBasic_;};
00940   void generateCpp( FILE * fp,bool defaultFactor=false);
00967 #define COIN_CBC_USING_CLP 0x01000000
00968   inline unsigned int specialOptions() const
00969   { return specialOptions_;};
00970   inline void setSpecialOptions(unsigned int value)
00971   { specialOptions_=value;};
00973 
00975   // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
00976   // *** At present only without scaling
00977   // *** Slacks havve -1.0 element (so == row activity) - take care
00979   void getBInvARow(int row, double* z, double * slack=NULL);
00980   
00982   void getBInvRow(int row, double* z);
00983   
00985   void getBInvACol(int col, double* vec);
00986   
00988   void getBInvCol(int col, double* vec);
00989   
00994   void getBasics(int* index);
00995   
00997     //-------------------------------------------------------------------------
01001        void setObjectiveCoefficient( int elementIndex, double elementValue );
01003        inline void setObjCoeff( int elementIndex, double elementValue )
01004        { setObjectiveCoefficient( elementIndex, elementValue);};
01005 
01008        void setColumnLower( int elementIndex, double elementValue );
01009       
01012        void setColumnUpper( int elementIndex, double elementValue );
01013 
01015       void setColumnBounds( int elementIndex,
01016         double lower, double upper );
01017 
01026       void setColumnSetBounds(const int* indexFirst,
01027                                    const int* indexLast,
01028                                    const double* boundList);
01029       
01032        inline void setColLower( int elementIndex, double elementValue )
01033        { setColumnLower(elementIndex, elementValue);};
01036        inline void setColUpper( int elementIndex, double elementValue )
01037        { setColumnUpper(elementIndex, elementValue);};
01038 
01040       inline void setColBounds( int elementIndex,
01041         double lower, double upper )
01042        { setColumnBounds(elementIndex, lower, upper);};
01043 
01050       inline void setColSetBounds(const int* indexFirst,
01051                                    const int* indexLast,
01052                                    const double* boundList)
01053       { setColumnSetBounds(indexFirst, indexLast, boundList);};
01054       
01057       void setRowLower( int elementIndex, double elementValue );
01058       
01061       void setRowUpper( int elementIndex, double elementValue ) ;
01062     
01064       void setRowBounds( int elementIndex,
01065                                  double lower, double upper ) ;
01066     
01073       void setRowSetBounds(const int* indexFirst,
01074                                    const int* indexLast,
01075                                    const double* boundList);
01076     
01078 
01080 protected:
01081 
01088 
01089   double columnPrimalInfeasibility_;
01091   double rowPrimalInfeasibility_;
01093   int columnPrimalSequence_;
01095   int rowPrimalSequence_;
01097   double columnDualInfeasibility_;
01099   double rowDualInfeasibility_;
01101   int columnDualSequence_;
01103   int rowDualSequence_;
01105   double primalToleranceToGetOptimal_;
01107   double remainingDualInfeasibility_;
01109   double largeValue_;
01111   double largestPrimalError_;
01113   double largestDualError_;
01115   double largestSolutionError_;
01117   double dualBound_;
01119   double alpha_;
01121   double theta_;
01123   double lowerIn_;
01125   double valueIn_;
01127   double upperIn_;
01129   double dualIn_;
01131   double lowerOut_;
01133   double valueOut_;
01135   double upperOut_;
01137   double dualOut_;
01139   double dualTolerance_;
01141   double primalTolerance_;
01143   double sumDualInfeasibilities_;
01145   double sumPrimalInfeasibilities_;
01147   double infeasibilityCost_;
01149   double sumOfRelaxedDualInfeasibilities_;
01151   double sumOfRelaxedPrimalInfeasibilities_;
01153   double acceptablePivot_;
01155   double * lower_;
01157   double * rowLowerWork_;
01159   double * columnLowerWork_;
01161   double * upper_;
01163   double * rowUpperWork_;
01165   double * columnUpperWork_;
01167   double * cost_;
01169   double * rowObjectiveWork_;
01171   double * objectiveWork_;
01173   CoinIndexedVector * rowArray_[6];
01175   CoinIndexedVector * columnArray_[6];
01177   int sequenceIn_;
01179   int directionIn_;
01181   int sequenceOut_;
01183   int directionOut_;
01185   int pivotRow_;
01187   int lastGoodIteration_;
01189   double * dj_;
01191   double * rowReducedCost_;
01193   double * reducedCostWork_;
01195   double * solution_;
01197   double * rowActivityWork_;
01199   double * columnActivityWork_;
01201   ClpSimplex * auxiliaryModel_;
01203   int numberDualInfeasibilities_;
01205   int numberDualInfeasibilitiesWithoutFree_;
01207   int numberPrimalInfeasibilities_;
01209   int numberRefinements_;
01211   ClpDualRowPivot * dualRowPivot_;
01213   ClpPrimalColumnPivot * primalColumnPivot_;
01215   int * pivotVariable_;
01217   ClpFactorization * factorization_;
01219   double * savedSolution_;
01221   int numberTimesOptimal_;
01223   int changeMade_;
01225   int algorithm_;
01228   int forceFactorization_;
01236   int perturbation_;
01238   unsigned char * saveStatus_;
01243   ClpNonLinearCost * nonLinearCost_;
01247   unsigned int specialOptions_;
01249   int lastBadIteration_;
01251   int lastFlaggedIteration_;
01253   int numberFake_;
01255   int numberChanged_;
01257   int progressFlag_;
01259   int firstFree_;
01263   int numberExtraRows_;
01266   int maximumBasic_;
01276   float incomingInfeasibility_;
01277   float allowedInfeasibility_;
01279   int automaticScale_;
01281   ClpSimplexProgress * progress_;
01282 public:
01284   mutable int spareIntArray_[4];
01286   mutable double spareDoubleArray_[4];
01287 protected:
01289   friend class OsiClpSolverInterface;
01291 };
01292 //#############################################################################
01301 void
01302 ClpSimplexUnitTest(const std::string & mpsDir,
01303                    const std::string & netlibDir);
01304 
01305 
01307 class ClpSimplexProgress {
01308 
01309 public:
01310 
01311 
01314 
01315     ClpSimplexProgress (  );
01316 
01318     ClpSimplexProgress ( ClpSimplex * model );
01319 
01321   ClpSimplexProgress(const ClpSimplexProgress &);
01322 
01324     ClpSimplexProgress & operator=(const ClpSimplexProgress & rhs);
01326    ~ClpSimplexProgress (  );
01328 
01334     int looping (  );
01336   void startCheck();
01338   int cycle(int in, int out,int wayIn,int wayOut); 
01339 
01341   double lastObjective(int back=1) const;
01343   void setInfeasibility(double value);
01345   double lastInfeasibility(int back=1) const;
01347   void modifyObjective(double value);
01349   int lastIterationNumber(int back=1) const;
01351   void clearIterationNumbers();
01353   inline void newOddState()
01354   { oddState_= - oddState_-1;};
01355   inline void endOddState()
01356   { oddState_=abs(oddState_);};
01357   inline void clearOddState() 
01358   { oddState_=0;};
01359   inline int oddState() const
01360   { return oddState_;};
01362   inline int badTimes() const
01363   { return numberBadTimes_;};
01364   inline void clearBadTimes()
01365   { numberBadTimes_=0;};
01366 
01368 
01369 #define CLP_PROGRESS 5
01370 
01371 
01372   double objective_[CLP_PROGRESS];
01374   double infeasibility_[CLP_PROGRESS];
01376   double realInfeasibility_[CLP_PROGRESS];
01377 #define CLP_CYCLE 12
01379   //double obj_[CLP_CYCLE];
01380   int in_[CLP_CYCLE];
01381   int out_[CLP_CYCLE];
01382   char way_[CLP_CYCLE];
01384   ClpSimplex * model_;
01386   int numberInfeasibilities_[CLP_PROGRESS];
01388   int iterationNumber_[CLP_PROGRESS];
01390   int numberTimes_;
01392   int numberBadTimes_;
01394   int oddState_;
01396 };
01397 // For Devex stuff
01398 #define DEVEX_TRY_NORM 1.0e-4
01399 #define DEVEX_ADD_ONE 1.0
01400 #endif

Generated on Thu May 15 21:59:05 2008 by  doxygen 1.4.7