Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

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 #include <iostream>
00014 #include <cfloat>
00015 #include "ClpModel.hpp"
00016 #include "ClpMatrixBase.hpp"
00017 #include "ClpSolve.hpp"
00018 class ClpDualRowPivot;
00019 class ClpPrimalColumnPivot;
00020 class ClpFactorization;
00021 class CoinIndexedVector;
00022 class ClpNonLinearCost;
00023 class ClpSimplexProgress;
00024 class CoinModel;
00025 class OsiClpSolverInterface;
00026 class CoinWarmStartBasis;
00027 
00049 class ClpSimplex : public ClpModel {
00050    friend void ClpSimplexUnitTest(const std::string & mpsDir,
00051                                   const std::string & netlibDir);
00052 
00053 public:
00058   enum Status {
00059     isFree = 0x00,
00060     basic = 0x01,
00061     atUpperBound = 0x02,
00062     atLowerBound = 0x03,
00063     superBasic = 0x04,
00064     isFixed = 0x05
00065   };
00066   // For Dual
00067   enum FakeBound {
00068     noFake = 0x00,
00069     bothFake = 0x01,
00070     upperFake = 0x02,
00071     lowerFake = 0x03
00072   };
00073 
00076 
00077     ClpSimplex (  );
00078 
00083   ClpSimplex(const ClpSimplex & rhs, int scalingMode =-1);
00088   ClpSimplex(const ClpModel & rhs, int scalingMode=-1);
00095   ClpSimplex (const ClpModel * wholeModel,
00096               int numberRows, const int * whichRows,
00097               int numberColumns, const int * whichColumns,
00098               bool dropNames=true, bool dropIntegers=true,
00099               bool fixOthers=false);
00103   ClpSimplex (ClpSimplex * wholeModel,
00104               int numberColumns, const int * whichColumns);
00107   void originalModel(ClpSimplex * miniModel);
00121   void auxiliaryModel(int options);
00123   void deleteAuxiliaryModel();
00125   inline bool usingAuxiliaryModel() const
00126   { return auxiliaryModel_!=NULL;};
00128     ClpSimplex & operator=(const ClpSimplex & rhs);
00130    ~ClpSimplex (  );
00131   // Ones below are just ClpModel with some changes
00143   void loadProblem (  const ClpMatrixBase& matrix,
00144                      const double* collb, const double* colub,   
00145                      const double* obj,
00146                      const double* rowlb, const double* rowub,
00147                       const double * rowObjective=NULL);
00148   void loadProblem (  const CoinPackedMatrix& 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 
00156   void loadProblem (  const int numcols, const int numrows,
00157                      const CoinBigIndex* start, const int* index,
00158                      const double* value,
00159                      const double* collb, const double* colub,   
00160                      const double* obj,
00161                       const double* rowlb, const double* rowub,
00162                       const double * rowObjective=NULL);
00164   void loadProblem (  const int numcols, const int numrows,
00165                      const CoinBigIndex* start, const int* index,
00166                       const double* value,const int * length,
00167                      const double* collb, const double* colub,   
00168                      const double* obj,
00169                       const double* rowlb, const double* rowub,
00170                       const double * rowObjective=NULL);
00175   int loadProblem (  CoinModel & modelObject,bool keepSolution=false);
00177   int readMps(const char *filename,
00178               bool keepNames=false,
00179               bool ignoreErrors = false);
00181   int readGMPL(const char *filename,const char * dataName,
00182                bool keepNames=false);
00187   void borrowModel(ClpModel & otherModel);
00188   void borrowModel(ClpSimplex & otherModel);
00190    void passInEventHandler(const ClpEventHandler * eventHandler);
00192   void getbackSolution(const ClpSimplex & smallModel,const int * whichRow, const int * whichColumn);
00194 
00200   int initialSolve(ClpSolve & options);
00202   int initialSolve();
00204   int initialDualSolve();
00206   int initialPrimalSolve();
00217   int dual(int ifValuesPass=0, int startFinishOptions=0);
00218   // If using Debug
00219   int dualDebug(int ifValuesPass=0, int startFinishOptions=0);
00230   int primal(int ifValuesPass=0, int startFinishOptions=0);
00236   int nonlinearSLP(int numberPasses,double deltaTolerance);
00239   int barrier(bool crossover=true);
00242   int reducedGradient(int phase=0);
00257   int cleanup(int cleanupScaling);
00275   int dualRanging(int numberCheck,const int * which,
00276                   double * costIncrease, int * sequenceIncrease,
00277                   double * costDecrease, int * sequenceDecrease);
00291   int primalRanging(int numberCheck,const int * which,
00292                   double * valueIncrease, int * sequenceIncrease,
00293                   double * valueDecrease, int * sequenceDecrease);
00308   int writeBasis(const char *filename,
00309                  bool writeValues=false,
00310                  int formatType=0) const;
00313   int readBasis(const char *filename);
00315   CoinWarmStartBasis * getBasis() const;
00317   void setFactorization( ClpFactorization & factorization);
00327   int tightenPrimalBounds(double factor=0.0,int doTight=0);
00344   int crash(double gap,int pivot);
00346   void setDualRowPivotAlgorithm(ClpDualRowPivot & choice);
00348   void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot & choice);
00357   int strongBranching(int numberVariables,const int * variables,
00358                       double * newLower, double * newUpper,
00359                       double ** outputSolution,
00360                       int * outputStatus, int * outputIterations,
00361                       bool stopOnFirstInfeasible=true,
00362                       bool alwaysFinish=false,
00363                       int startFinishOptions=0);
00365 
00373   int pivot();
00374 
00380   int primalPivotResult();
00381   
00388   int dualPivotResult();
00389 
00401   int startup(int ifValuesPass,int startFinishOptions=0);
00402   void finish(int startFinishOptions=0);
00403   
00405   bool statusOfProblem(bool initial=false);
00407   void defaultFactorizationFrequency();
00409 
00412 
00413   inline bool primalFeasible() const
00414          { return (numberPrimalInfeasibilities_==0);};
00416   inline bool dualFeasible() const
00417          { return (numberDualInfeasibilities_==0);};
00419   inline ClpFactorization * factorization() const 
00420           { return factorization_;};
00422   bool sparseFactorization() const;
00423   void setSparseFactorization(bool value);
00425   int factorizationFrequency() const;
00426   void setFactorizationFrequency(int value);
00428   inline double dualBound() const
00429           { return dualBound_;};
00430   void setDualBound(double value);
00432   inline double infeasibilityCost() const
00433           { return infeasibilityCost_;};
00434   void setInfeasibilityCost(double value);
00451   inline int perturbation() const
00452     { return perturbation_;};
00453   void setPerturbation(int value);
00455   inline int algorithm() const 
00456   {return algorithm_; } ;
00458   inline void setAlgorithm(int value)
00459   {algorithm_=value; } ;
00461   inline double sumDualInfeasibilities() const 
00462           { return sumDualInfeasibilities_;} ;
00463   inline void setSumDualInfeasibilities(double value)
00464           { sumDualInfeasibilities_=value;} ;
00466   inline double sumOfRelaxedDualInfeasibilities() const 
00467           { return sumOfRelaxedDualInfeasibilities_;} ;
00468   inline void setSumOfRelaxedDualInfeasibilities(double value)
00469           { sumOfRelaxedDualInfeasibilities_=value;} ;
00471   inline int numberDualInfeasibilities() const 
00472           { return numberDualInfeasibilities_;} ;
00473   inline void setNumberDualInfeasibilities(int value)
00474           { numberDualInfeasibilities_=value;} ;
00476   inline double sumPrimalInfeasibilities() const 
00477           { return sumPrimalInfeasibilities_;} ;
00478   inline void setSumPrimalInfeasibilities(double value)
00479           { sumPrimalInfeasibilities_=value;} ;
00481   inline double sumOfRelaxedPrimalInfeasibilities() const 
00482           { return sumOfRelaxedPrimalInfeasibilities_;} ;
00483   inline void setSumOfRelaxedPrimalInfeasibilities(double value)
00484           { sumOfRelaxedPrimalInfeasibilities_=value;} ;
00486   inline int numberPrimalInfeasibilities() const 
00487           { return numberPrimalInfeasibilities_;} ;
00488   inline void setNumberPrimalInfeasibilities(int value)
00489           { numberPrimalInfeasibilities_=value;} ;
00496   int saveModel(const char * fileName);
00499   int restoreModel(const char * fileName);
00500   
00508   void checkSolution(int setToBounds=false);
00511   void checkSolutionInternal();
00513   inline CoinIndexedVector * rowArray(int index) const
00514   { return rowArray_[index];};
00516   inline CoinIndexedVector * columnArray(int index) const
00517   { return columnArray_[index];};
00519 
00520   /******************** End of most useful part **************/
00526   int getSolution (  const double * rowActivities,
00527                      const double * columnActivities);
00531   int getSolution ();
00538   int createPiecewiseLinearCosts(const int * starts,
00539                    const double * lower, const double * gradient);
00541   void returnModel(ClpSimplex & otherModel);
00549   int internalFactorize(int solveType);
00551   ClpDataSave saveData() ;
00553   void restoreData(ClpDataSave saved);
00555   void cleanStatus();
00557   int factorize();
00560   void computeDuals(double * givenDjs);
00562   void computePrimals (  const double * rowActivities,
00563                      const double * columnActivities);
00565   void add(double * array,
00566                    int column, double multiplier) const;
00572   void unpack(CoinIndexedVector * rowArray) const ;
00578   void unpack(CoinIndexedVector * rowArray,int sequence) const;
00585   void unpackPacked(CoinIndexedVector * rowArray) ;
00592   void unpackPacked(CoinIndexedVector * rowArray,int sequence);
00593 protected:  
00598   int housekeeping(double objectiveChange);
00601   void checkPrimalSolution(const double * rowActivities=NULL,
00602                            const double * columnActivies=NULL);
00605   void checkDualSolution();
00607   void checkBothSolutions();
00608 public:
00619   void setValuesPassAction(float incomingInfeasibility,
00620                            float allowedInfeasibility);
00622 
00624   // On reflection I doubt whether anyone uses so test
00625 private:
00627   inline double columnPrimalInfeasibility() const 
00628           { return columnPrimalInfeasibility_;} ;
00630   inline int columnPrimalSequence() const 
00631           { return columnPrimalSequence_;} ;
00633   inline double rowPrimalInfeasibility() const 
00634           { return rowPrimalInfeasibility_;} ;
00636   inline int rowPrimalSequence() const 
00637           { return rowPrimalSequence_;} ;
00640   inline double columnDualInfeasibility() const 
00641           { return columnDualInfeasibility_;} ;
00643   inline int columnDualSequence() const 
00644           { return columnDualSequence_;} ;
00646   inline double rowDualInfeasibility() const 
00647           { return rowDualInfeasibility_;} ;
00649   inline int rowDualSequence() const 
00650           { return rowDualSequence_;} ;
00652   inline double primalToleranceToGetOptimal() const 
00653           { return primalToleranceToGetOptimal_;} ;
00655   inline double remainingDualInfeasibility() const 
00656           { return remainingDualInfeasibility_;} ;
00658   inline double largestSolutionError() const
00659           { return largestSolutionError_;} ;
00660 public:
00662   inline double largeValue() const 
00663           { return largeValue_;} ;
00664   void setLargeValue( double value) ;
00666   inline double largestPrimalError() const
00667           { return largestPrimalError_;} ;
00669   inline double largestDualError() const
00670           { return largestDualError_;} ;
00672   inline void setLargestPrimalError(double value)
00673           { largestPrimalError_=value;} ;
00675   inline void setLargestDualError(double value)
00676           { largestDualError_=value;} ;
00678   inline int * pivotVariable() const
00679           { return pivotVariable_;};
00681   inline bool automaticScaling() const
00682   { return automaticScale_!=0;};
00683   inline void setAutomaticScaling(bool onOff)
00684   { automaticScale_ = onOff ? 1: 0;}; 
00686   inline double currentDualTolerance() const 
00687           { return dualTolerance_;} ;
00688   inline void setCurrentDualTolerance(double value)
00689           { dualTolerance_ = value;} ;
00691   inline double currentPrimalTolerance() const 
00692           { return primalTolerance_;} ;
00693   inline void setCurrentPrimalTolerance(double value)
00694           { primalTolerance_ = value;} ;
00696   inline int numberRefinements() const 
00697           { return numberRefinements_;} ;
00698   void setNumberRefinements( int value) ;
00700   inline double alpha() const { return alpha_;};
00701   inline void setAlpha(double value) { alpha_ = value;};
00703   inline double dualIn() const { return dualIn_;};
00705   inline int pivotRow() const{ return pivotRow_;};
00706   inline void setPivotRow(int value) { pivotRow_=value;};
00708   double valueIncomingDual() const;
00710 
00711   protected:
00717   int gutsOfSolution ( double * givenDuals,
00718                        const double * givenPrimals,
00719                        bool valuesPass=false);
00721   void gutsOfDelete(int type);
00723   void gutsOfCopy(const ClpSimplex & rhs);
00735   bool createRim(int what,bool makeRowCopy=false,int startFinishOptions=0);
00740   void deleteRim(int getRidOfFactorizationData=2);
00742   bool sanityCheck();
00744   public:
00749   inline double * solutionRegion(int section) const
00750   { if (!section) return rowActivityWork_; else return columnActivityWork_;};
00751   inline double * djRegion(int section) const
00752   { if (!section) return rowReducedCost_; else return reducedCostWork_;};
00753   inline double * lowerRegion(int section) const
00754   { if (!section) return rowLowerWork_; else return columnLowerWork_;};
00755   inline double * upperRegion(int section) const
00756   { if (!section) return rowUpperWork_; else return columnUpperWork_;};
00757   inline double * costRegion(int section) const
00758   { if (!section) return rowObjectiveWork_; else return objectiveWork_;};
00760   inline double * solutionRegion() const
00761   { return solution_;};
00762   inline double * djRegion() const
00763   { return dj_;};
00764   inline double * lowerRegion() const
00765   { return lower_;};
00766   inline double * upperRegion() const
00767   { return upper_;};
00768   inline double * costRegion() const
00769   { return cost_;};
00770   inline Status getStatus(int sequence) const
00771   {return static_cast<Status> (status_[sequence]&7);};
00772   inline void setStatus(int sequence, Status status)
00773   {
00774     unsigned char & st_byte = status_[sequence];
00775     st_byte &= ~7;
00776     st_byte |= status;
00777   };
00782   void setInitialDenseFactorization(bool onOff);
00783   bool  initialDenseFactorization() const;
00785   inline int sequenceIn() const
00786   {return sequenceIn_;};
00787   inline int sequenceOut() const
00788   {return sequenceOut_;};
00790   inline void  setSequenceIn(int sequence)
00791   { sequenceIn_=sequence;};
00792   inline void  setSequenceOut(int sequence)
00793   { sequenceOut_=sequence;};
00795   inline int directionIn() const
00796   {return directionIn_;};
00797   inline int directionOut() const
00798   {return directionOut_;};
00800   inline void  setDirectionIn(int direction)
00801   { directionIn_=direction;};
00802   inline void  setDirectionOut(int direction)
00803   { directionOut_=direction;};
00805   inline double valueOut() const
00806   { return valueOut_;};
00808   inline int isColumn(int sequence) const
00809   { return sequence<numberColumns_ ? 1 : 0;};
00811   inline int sequenceWithin(int sequence) const
00812   { return sequence<numberColumns_ ? sequence : sequence-numberColumns_;};
00814   inline double solution(int sequence)
00815   { return solution_[sequence];};
00817   inline double & solutionAddress(int sequence)
00818   { return solution_[sequence];};
00819   inline double reducedCost(int sequence)
00820    { return dj_[sequence];};
00821   inline double & reducedCostAddress(int sequence)
00822    { return dj_[sequence];};
00823   inline double lower(int sequence)
00824   { return lower_[sequence];};
00826   inline double & lowerAddress(int sequence)
00827   { return lower_[sequence];};
00828   inline double upper(int sequence)
00829   { return upper_[sequence];};
00831   inline double & upperAddress(int sequence)
00832   { return upper_[sequence];};
00833   inline double cost(int sequence)
00834   { return cost_[sequence];};
00836   inline double & costAddress(int sequence)
00837   { return cost_[sequence];};
00839   inline double originalLower(int iSequence) const
00840   { if (iSequence<numberColumns_) return columnLower_[iSequence]; else
00841     return rowLower_[iSequence-numberColumns_];};
00843   inline double originalUpper(int iSequence) const
00844   { if (iSequence<numberColumns_) return columnUpper_[iSequence]; else
00845     return rowUpper_[iSequence-numberColumns_];};
00847   inline double theta() const
00848   { return theta_;};
00850   inline ClpNonLinearCost * nonLinearCost() const
00851   { return nonLinearCost_;};
00853 
00855   inline void setFakeBound(int sequence, FakeBound fakeBound)
00856   {
00857     unsigned char & st_byte = status_[sequence];
00858     st_byte &= ~24;
00859     st_byte |= fakeBound<<3;
00860   };
00861   inline FakeBound getFakeBound(int sequence) const
00862   {return static_cast<FakeBound> ((status_[sequence]>>3)&3);};
00863   inline void setRowStatus(int sequence, Status status)
00864   {
00865     unsigned char & st_byte = status_[sequence+numberColumns_];
00866     st_byte &= ~7;
00867     st_byte |= status;
00868   };
00869   inline Status getRowStatus(int sequence) const
00870   {return static_cast<Status> (status_[sequence+numberColumns_]&7);};
00871   inline void setColumnStatus(int sequence, Status status)
00872   {
00873     unsigned char & st_byte = status_[sequence];
00874     st_byte &= ~7;
00875     st_byte |= status;
00876   };
00877   inline Status getColumnStatus(int sequence) const
00878   {return static_cast<Status> (status_[sequence]&7);};
00879   inline void setPivoted( int sequence)
00880   { status_[sequence] |= 32;};
00881   inline void clearPivoted( int sequence)
00882   { status_[sequence] &= ~32; };
00883   inline bool pivoted(int sequence) const
00884   {return (((status_[sequence]>>5)&1)!=0);};
00886   void setFlagged( int sequence);
00887   inline void clearFlagged( int sequence)
00888   {
00889     status_[sequence] &= ~64;
00890   };
00891   inline bool flagged(int sequence) const
00892   {return ((status_[sequence]&64)!=0);};
00894   inline void setActive( int iRow)
00895   {
00896     status_[iRow] |= 128;
00897   };
00898   inline void clearActive( int iRow)
00899   {
00900     status_[iRow] &= ~128;
00901   };
00902   inline bool active(int iRow) const
00903   {return ((status_[iRow]&128)!=0);};
00906   void createStatus() ;
00909   void allSlackBasis(bool resetSolution=false);
00910     
00912   inline int lastBadIteration() const
00913   {return lastBadIteration_;};
00915   inline int progressFlag() const
00916   {return progressFlag_;};
00918   inline void forceFactorization(int value)
00919   { forceFactorization_ = value;};
00921   inline double rawObjectiveValue() const
00922   { return objectiveValue_;};
00924   void computeObjectiveValue();
00928   inline int numberExtraRows() const
00929   { return numberExtraRows_;};
00932   inline int maximumBasic() const
00933   { return maximumBasic_;};
00935   void generateCpp( FILE * fp,bool defaultFactor=false);
00962 #define COIN_CBC_USING_CLP 0x01000000
00963   inline unsigned int specialOptions() const
00964   { return specialOptions_;};
00965   inline void setSpecialOptions(unsigned int value)
00966   { specialOptions_=value;};
00968 
00970   // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
00971   // *** At present only without scaling
00972   // *** Slacks havve -1.0 element (so == row activity) - take care
00974   void getBInvARow(int row, double* z, double * slack=NULL);
00975   
00977   void getBInvRow(int row, double* z);
00978   
00980   void getBInvACol(int col, double* vec);
00981   
00983   void getBInvCol(int col, double* vec);
00984   
00989   void getBasics(int* index);
00990   
00992     //-------------------------------------------------------------------------
00996        void setObjectiveCoefficient( int elementIndex, double elementValue );
00998        inline void setObjCoeff( int elementIndex, double elementValue )
00999        { setObjectiveCoefficient( elementIndex, elementValue);};
01000 
01003        void setColumnLower( int elementIndex, double elementValue );
01004       
01007        void setColumnUpper( int elementIndex, double elementValue );
01008 
01010       void setColumnBounds( int elementIndex,
01011         double lower, double upper );
01012 
01021       void setColumnSetBounds(const int* indexFirst,
01022                                    const int* indexLast,
01023                                    const double* boundList);
01024       
01027        inline void setColLower( int elementIndex, double elementValue )
01028        { setColumnLower(elementIndex, elementValue);};
01031        inline void setColUpper( int elementIndex, double elementValue )
01032        { setColumnUpper(elementIndex, elementValue);};
01033 
01035       inline void setColBounds( int elementIndex,
01036         double lower, double upper )
01037        { setColumnBounds(elementIndex, lower, upper);};
01038 
01045       inline void setColSetBounds(const int* indexFirst,
01046                                    const int* indexLast,
01047                                    const double* boundList)
01048       { setColumnSetBounds(indexFirst, indexLast, boundList);};
01049       
01052       void setRowLower( int elementIndex, double elementValue );
01053       
01056       void setRowUpper( int elementIndex, double elementValue ) ;
01057     
01059       void setRowBounds( int elementIndex,
01060                                  double lower, double upper ) ;
01061     
01068       void setRowSetBounds(const int* indexFirst,
01069                                    const int* indexLast,
01070                                    const double* boundList);
01071     
01073 
01075 protected:
01076 
01083 
01084   double columnPrimalInfeasibility_;
01086   double rowPrimalInfeasibility_;
01088   int columnPrimalSequence_;
01090   int rowPrimalSequence_;
01092   double columnDualInfeasibility_;
01094   double rowDualInfeasibility_;
01096   int columnDualSequence_;
01098   int rowDualSequence_;
01100   double primalToleranceToGetOptimal_;
01102   double remainingDualInfeasibility_;
01104   double largeValue_;
01106   double largestPrimalError_;
01108   double largestDualError_;
01110   double largestSolutionError_;
01112   double dualBound_;
01114   double alpha_;
01116   double theta_;
01118   double lowerIn_;
01120   double valueIn_;
01122   double upperIn_;
01124   double dualIn_;
01126   double lowerOut_;
01128   double valueOut_;
01130   double upperOut_;
01132   double dualOut_;
01134   double dualTolerance_;
01136   double primalTolerance_;
01138   double sumDualInfeasibilities_;
01140   double sumPrimalInfeasibilities_;
01142   double infeasibilityCost_;
01144   double sumOfRelaxedDualInfeasibilities_;
01146   double sumOfRelaxedPrimalInfeasibilities_;
01148   double acceptablePivot_;
01150   double * lower_;
01152   double * rowLowerWork_;
01154   double * columnLowerWork_;
01156   double * upper_;
01158   double * rowUpperWork_;
01160   double * columnUpperWork_;
01162   double * cost_;
01164   double * rowObjectiveWork_;
01166   double * objectiveWork_;
01168   CoinIndexedVector * rowArray_[6];
01170   CoinIndexedVector * columnArray_[6];
01172   int sequenceIn_;
01174   int directionIn_;
01176   int sequenceOut_;
01178   int directionOut_;
01180   int pivotRow_;
01182   int lastGoodIteration_;
01184   double * dj_;
01186   double * rowReducedCost_;
01188   double * reducedCostWork_;
01190   double * solution_;
01192   double * rowActivityWork_;
01194   double * columnActivityWork_;
01196   ClpSimplex * auxiliaryModel_;
01198   int numberDualInfeasibilities_;
01200   int numberDualInfeasibilitiesWithoutFree_;
01202   int numberPrimalInfeasibilities_;
01204   int numberRefinements_;
01206   ClpDualRowPivot * dualRowPivot_;
01208   ClpPrimalColumnPivot * primalColumnPivot_;
01210   int * pivotVariable_;
01212   ClpFactorization * factorization_;
01214   double * savedSolution_;
01216   int numberTimesOptimal_;
01218   int changeMade_;
01220   int algorithm_;
01223   int forceFactorization_;
01231   int perturbation_;
01233   unsigned char * saveStatus_;
01238   ClpNonLinearCost * nonLinearCost_;
01242   unsigned int specialOptions_;
01244   int lastBadIteration_;
01246   int lastFlaggedIteration_;
01248   int numberFake_;
01250   int numberChanged_;
01252   int progressFlag_;
01254   int firstFree_;
01258   int numberExtraRows_;
01261   int maximumBasic_;
01271   float incomingInfeasibility_;
01272   float allowedInfeasibility_;
01274   int automaticScale_;
01276   ClpSimplexProgress * progress_;
01277 public:
01279   mutable int spareIntArray_[4];
01281   mutable double spareDoubleArray_[4];
01282 protected:
01284   friend class OsiClpSolverInterface;
01286 };
01287 //#############################################################################
01296 void
01297 ClpSimplexUnitTest(const std::string & mpsDir,
01298                    const std::string & netlibDir);
01299 
01300 
01302 class ClpSimplexProgress {
01303 
01304 public:
01305 
01306 
01309 
01310     ClpSimplexProgress (  );
01311 
01313     ClpSimplexProgress ( ClpSimplex * model );
01314 
01316   ClpSimplexProgress(const ClpSimplexProgress &);
01317 
01319     ClpSimplexProgress & operator=(const ClpSimplexProgress & rhs);
01321    ~ClpSimplexProgress (  );
01323 
01329     int looping (  );
01331   void startCheck();
01333   int cycle(int in, int out,int wayIn,int wayOut); 
01334 
01336   double lastObjective(int back=1) const;
01338   void setInfeasibility(double value);
01340   double lastInfeasibility(int back=1) const;
01342   void modifyObjective(double value);
01344   int lastIterationNumber(int back=1) const;
01346   void clearIterationNumbers();
01348   inline void newOddState()
01349   { oddState_= - oddState_-1;};
01350   inline void endOddState()
01351   { oddState_=abs(oddState_);};
01352   inline void clearOddState() 
01353   { oddState_=0;};
01354   inline int oddState() const
01355   { return oddState_;};
01357   inline int badTimes() const
01358   { return numberBadTimes_;};
01359   inline void clearBadTimes()
01360   { numberBadTimes_=0;};
01361 
01363 
01364 #define CLP_PROGRESS 5
01365 
01366 
01367   double objective_[CLP_PROGRESS];
01369   double infeasibility_[CLP_PROGRESS];
01371   double realInfeasibility_[CLP_PROGRESS];
01372 #define CLP_CYCLE 12
01373 
01374   //double obj_[CLP_CYCLE];
01375   int in_[CLP_CYCLE];
01376   int out_[CLP_CYCLE];
01377   char way_[CLP_CYCLE];
01379   ClpSimplex * model_;
01381   int numberInfeasibilities_[CLP_PROGRESS];
01383   int iterationNumber_[CLP_PROGRESS];
01385   int numberTimes_;
01387   int numberBadTimes_;
01389   int oddState_;
01391 };
01392 // For Devex stuff
01393 #define DEVEX_TRY_NORM 1.0e-4
01394 #define DEVEX_ADD_ONE 1.0
01395 #endif

Generated on Sun Jun 11 02:00:26 2006 by  doxygen 1.3.9.1