/home/coin/SVN-release/Cbc-1.2.0/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 class ClpDisasterHandler;
00033 
00055 class ClpSimplex : public ClpModel {
00056    friend void ClpSimplexUnitTest(const std::string & mpsDir,
00057                                   const std::string & netlibDir);
00058 
00059 public:
00064   enum Status {
00065     isFree = 0x00,
00066     basic = 0x01,
00067     atUpperBound = 0x02,
00068     atLowerBound = 0x03,
00069     superBasic = 0x04,
00070     isFixed = 0x05
00071   };
00072   // For Dual
00073   enum FakeBound {
00074     noFake = 0x00,
00075     bothFake = 0x01,
00076     upperFake = 0x02,
00077     lowerFake = 0x03
00078   };
00079 
00082 
00083     ClpSimplex (  );
00084 
00089   ClpSimplex(const ClpSimplex & rhs, int scalingMode =-1);
00094   ClpSimplex(const ClpModel & rhs, int scalingMode=-1);
00101   ClpSimplex (const ClpModel * wholeModel,
00102               int numberRows, const int * whichRows,
00103               int numberColumns, const int * whichColumns,
00104               bool dropNames=true, bool dropIntegers=true,
00105               bool fixOthers=false);
00109   ClpSimplex (ClpSimplex * wholeModel,
00110               int numberColumns, const int * whichColumns);
00113   void originalModel(ClpSimplex * miniModel);
00127   void auxiliaryModel(int options);
00129   void deleteAuxiliaryModel();
00131   inline bool usingAuxiliaryModel() const
00132   { return auxiliaryModel_!=NULL;};
00134     ClpSimplex & operator=(const ClpSimplex & rhs);
00136    ~ClpSimplex (  );
00137   // Ones below are just ClpModel with some changes
00149   void loadProblem (  const ClpMatrixBase& matrix,
00150                      const double* collb, const double* colub,   
00151                      const double* obj,
00152                      const double* rowlb, const double* rowub,
00153                       const double * rowObjective=NULL);
00154   void loadProblem (  const CoinPackedMatrix& matrix,
00155                      const double* collb, const double* colub,   
00156                      const double* obj,
00157                      const double* rowlb, const double* rowub,
00158                       const double * rowObjective=NULL);
00159 
00162   void loadProblem (  const int numcols, const int numrows,
00163                      const CoinBigIndex* start, const int* index,
00164                      const double* value,
00165                      const double* collb, const double* colub,   
00166                      const double* obj,
00167                       const double* rowlb, const double* rowub,
00168                       const double * rowObjective=NULL);
00170   void loadProblem (  const int numcols, const int numrows,
00171                      const CoinBigIndex* start, const int* index,
00172                       const double* value,const int * length,
00173                      const double* collb, const double* colub,   
00174                      const double* obj,
00175                       const double* rowlb, const double* rowub,
00176                       const double * rowObjective=NULL);
00181   int loadProblem (  CoinModel & modelObject,bool keepSolution=false);
00183   int readMps(const char *filename,
00184               bool keepNames=false,
00185               bool ignoreErrors = false);
00187   int readGMPL(const char *filename,const char * dataName,
00188                bool keepNames=false);
00193   void borrowModel(ClpModel & otherModel);
00194   void borrowModel(ClpSimplex & otherModel);
00196    void passInEventHandler(const ClpEventHandler * eventHandler);
00198   void getbackSolution(const ClpSimplex & smallModel,const int * whichRow, const int * whichColumn);
00200 
00206   int initialSolve(ClpSolve & options);
00208   int initialSolve();
00210   int initialDualSolve();
00212   int initialPrimalSolve();
00214   int initialBarrierSolve();
00216   int initialBarrierNoCrossSolve();
00217 
00228   int dual(int ifValuesPass=0, int startFinishOptions=0);
00229   // If using Debug
00230   int dualDebug(int ifValuesPass=0, int startFinishOptions=0);
00241   int primal(int ifValuesPass=0, int startFinishOptions=0);
00247   int nonlinearSLP(int numberPasses,double deltaTolerance);
00250   int barrier(bool crossover=true);
00253   int reducedGradient(int phase=0);
00268   int cleanup(int cleanupScaling);
00289   int dualRanging(int numberCheck,const int * which,
00290                   double * costIncrease, int * sequenceIncrease,
00291                   double * costDecrease, int * sequenceDecrease,
00292                   double * valueIncrease=NULL, double * valueDecrease=NULL);
00293 
00308   int primalRanging(int numberCheck,const int * which,
00309                   double * valueIncrease, int * sequenceIncrease,
00310                   double * valueDecrease, int * sequenceDecrease);
00325   int writeBasis(const char *filename,
00326                  bool writeValues=false,
00327                  int formatType=0) const;
00330   int readBasis(const char *filename);
00332   CoinWarmStartBasis * getBasis() const;
00334   void setFactorization( ClpFactorization & factorization);
00344   int tightenPrimalBounds(double factor=0.0,int doTight=0);
00361   int crash(double gap,int pivot);
00363   void setDualRowPivotAlgorithm(ClpDualRowPivot & choice);
00365   void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot & choice);
00374   int strongBranching(int numberVariables,const int * variables,
00375                       double * newLower, double * newUpper,
00376                       double ** outputSolution,
00377                       int * outputStatus, int * outputIterations,
00378                       bool stopOnFirstInfeasible=true,
00379                       bool alwaysFinish=false,
00380                       int startFinishOptions=0);
00382 
00390   int pivot();
00391 
00397   int primalPivotResult();
00398   
00405   int dualPivotResult();
00406 
00418   int startup(int ifValuesPass,int startFinishOptions=0);
00419   void finish(int startFinishOptions=0);
00420   
00422   bool statusOfProblem(bool initial=false);
00424   void defaultFactorizationFrequency();
00426 
00429 
00430   inline bool primalFeasible() const
00431          { return (numberPrimalInfeasibilities_==0);};
00433   inline bool dualFeasible() const
00434          { return (numberDualInfeasibilities_==0);};
00436   inline ClpFactorization * factorization() const 
00437           { return factorization_;};
00439   bool sparseFactorization() const;
00440   void setSparseFactorization(bool value);
00442   int factorizationFrequency() const;
00443   void setFactorizationFrequency(int value);
00445   inline double dualBound() const
00446           { return dualBound_;};
00447   void setDualBound(double value);
00449   inline double infeasibilityCost() const
00450           { return infeasibilityCost_;};
00451   void setInfeasibilityCost(double value);
00468   inline int perturbation() const
00469     { return perturbation_;};
00470   void setPerturbation(int value);
00472   inline int algorithm() const 
00473   {return algorithm_; } ;
00475   inline void setAlgorithm(int value)
00476   {algorithm_=value; } ;
00478   inline double sumDualInfeasibilities() const 
00479           { return sumDualInfeasibilities_;} ;
00480   inline void setSumDualInfeasibilities(double value)
00481           { sumDualInfeasibilities_=value;} ;
00483   inline double sumOfRelaxedDualInfeasibilities() const 
00484           { return sumOfRelaxedDualInfeasibilities_;} ;
00485   inline void setSumOfRelaxedDualInfeasibilities(double value)
00486           { sumOfRelaxedDualInfeasibilities_=value;} ;
00488   inline int numberDualInfeasibilities() const 
00489           { return numberDualInfeasibilities_;} ;
00490   inline void setNumberDualInfeasibilities(int value)
00491           { numberDualInfeasibilities_=value;} ;
00493   inline int numberDualInfeasibilitiesWithoutFree() const 
00494           { return numberDualInfeasibilitiesWithoutFree_;} ;
00496   inline double sumPrimalInfeasibilities() const 
00497           { return sumPrimalInfeasibilities_;} ;
00498   inline void setSumPrimalInfeasibilities(double value)
00499           { sumPrimalInfeasibilities_=value;} ;
00501   inline double sumOfRelaxedPrimalInfeasibilities() const 
00502           { return sumOfRelaxedPrimalInfeasibilities_;} ;
00503   inline void setSumOfRelaxedPrimalInfeasibilities(double value)
00504           { sumOfRelaxedPrimalInfeasibilities_=value;} ;
00506   inline int numberPrimalInfeasibilities() const 
00507           { return numberPrimalInfeasibilities_;} ;
00508   inline void setNumberPrimalInfeasibilities(int value)
00509           { numberPrimalInfeasibilities_=value;} ;
00516   int saveModel(const char * fileName);
00519   int restoreModel(const char * fileName);
00520   
00528   void checkSolution(int setToBounds=false);
00531   void checkSolutionInternal();
00533   inline CoinIndexedVector * rowArray(int index) const
00534   { return rowArray_[index];};
00536   inline CoinIndexedVector * columnArray(int index) const
00537   { return columnArray_[index];};
00539 
00540   /******************** End of most useful part **************/
00546   int getSolution (  const double * rowActivities,
00547                      const double * columnActivities);
00551   int getSolution ();
00558   int createPiecewiseLinearCosts(const int * starts,
00559                    const double * lower, const double * gradient);
00561   void returnModel(ClpSimplex & otherModel);
00569   int internalFactorize(int solveType);
00571   ClpDataSave saveData() ;
00573   void restoreData(ClpDataSave saved);
00575   void cleanStatus();
00577   int factorize();
00580   void computeDuals(double * givenDjs);
00582   void computePrimals (  const double * rowActivities,
00583                      const double * columnActivities);
00585   void add(double * array,
00586                    int column, double multiplier) const;
00592   void unpack(CoinIndexedVector * rowArray) const ;
00598   void unpack(CoinIndexedVector * rowArray,int sequence) const;
00605   void unpackPacked(CoinIndexedVector * rowArray) ;
00612   void unpackPacked(CoinIndexedVector * rowArray,int sequence);
00613 protected:  
00618   int housekeeping(double objectiveChange);
00621   void checkPrimalSolution(const double * rowActivities=NULL,
00622                            const double * columnActivies=NULL);
00625   void checkDualSolution();
00627   void checkBothSolutions();
00628 public:
00639   void setValuesPassAction(float incomingInfeasibility,
00640                            float allowedInfeasibility);
00642 
00644   // On reflection I doubt whether anyone uses so test
00645 private:
00647   inline double columnPrimalInfeasibility() const 
00648           { return columnPrimalInfeasibility_;} ;
00650   inline int columnPrimalSequence() const 
00651           { return columnPrimalSequence_;} ;
00653   inline double rowPrimalInfeasibility() const 
00654           { return rowPrimalInfeasibility_;} ;
00656   inline int rowPrimalSequence() const 
00657           { return rowPrimalSequence_;} ;
00660   inline double columnDualInfeasibility() const 
00661           { return columnDualInfeasibility_;} ;
00663   inline int columnDualSequence() const 
00664           { return columnDualSequence_;} ;
00666   inline double rowDualInfeasibility() const 
00667           { return rowDualInfeasibility_;} ;
00669   inline int rowDualSequence() const 
00670           { return rowDualSequence_;} ;
00672   inline double primalToleranceToGetOptimal() const 
00673           { return primalToleranceToGetOptimal_;} ;
00675   inline double remainingDualInfeasibility() const 
00676           { return remainingDualInfeasibility_;} ;
00678   inline double largestSolutionError() const
00679           { return largestSolutionError_;} ;
00680 public:
00682   inline double largeValue() const 
00683           { return largeValue_;} ;
00684   void setLargeValue( double value) ;
00686   inline double largestPrimalError() const
00687           { return largestPrimalError_;} ;
00689   inline double largestDualError() const
00690           { return largestDualError_;} ;
00692   inline void setLargestPrimalError(double value)
00693           { largestPrimalError_=value;} ;
00695   inline void setLargestDualError(double value)
00696           { largestDualError_=value;} ;
00698   inline int * pivotVariable() const
00699           { return pivotVariable_;};
00701   inline bool automaticScaling() const
00702   { return automaticScale_!=0;};
00703   inline void setAutomaticScaling(bool onOff)
00704   { automaticScale_ = onOff ? 1: 0;}; 
00706   inline double currentDualTolerance() const 
00707           { return dualTolerance_;} ;
00708   inline void setCurrentDualTolerance(double value)
00709           { dualTolerance_ = value;} ;
00711   inline double currentPrimalTolerance() const 
00712           { return primalTolerance_;} ;
00713   inline void setCurrentPrimalTolerance(double value)
00714           { primalTolerance_ = value;} ;
00716   inline int numberRefinements() const 
00717           { return numberRefinements_;} ;
00718   void setNumberRefinements( int value) ;
00720   inline double alpha() const { return alpha_;};
00721   inline void setAlpha(double value) { alpha_ = value;};
00723   inline double dualIn() const { return dualIn_;};
00725   inline int pivotRow() const{ return pivotRow_;};
00726   inline void setPivotRow(int value) { pivotRow_=value;};
00728   double valueIncomingDual() const;
00730 
00731   protected:
00737   int gutsOfSolution ( double * givenDuals,
00738                        const double * givenPrimals,
00739                        bool valuesPass=false);
00741   void gutsOfDelete(int type);
00743   void gutsOfCopy(const ClpSimplex & rhs);
00755   bool createRim(int what,bool makeRowCopy=false,int startFinishOptions=0);
00760   void deleteRim(int getRidOfFactorizationData=2);
00762   bool sanityCheck();
00764   public:
00769   inline double * solutionRegion(int section) const
00770   { if (!section) return rowActivityWork_; else return columnActivityWork_;};
00771   inline double * djRegion(int section) const
00772   { if (!section) return rowReducedCost_; else return reducedCostWork_;};
00773   inline double * lowerRegion(int section) const
00774   { if (!section) return rowLowerWork_; else return columnLowerWork_;};
00775   inline double * upperRegion(int section) const
00776   { if (!section) return rowUpperWork_; else return columnUpperWork_;};
00777   inline double * costRegion(int section) const
00778   { if (!section) return rowObjectiveWork_; else return objectiveWork_;};
00780   inline double * solutionRegion() const
00781   { return solution_;};
00782   inline double * djRegion() const
00783   { return dj_;};
00784   inline double * lowerRegion() const
00785   { return lower_;};
00786   inline double * upperRegion() const
00787   { return upper_;};
00788   inline double * costRegion() const
00789   { return cost_;};
00790   inline Status getStatus(int sequence) const
00791   {return static_cast<Status> (status_[sequence]&7);};
00792   inline void setStatus(int sequence, Status status)
00793   {
00794     unsigned char & st_byte = status_[sequence];
00795     st_byte &= ~7;
00796     st_byte |= status;
00797   };
00802   void setInitialDenseFactorization(bool onOff);
00803   bool  initialDenseFactorization() const;
00805   inline int sequenceIn() const
00806   {return sequenceIn_;};
00807   inline int sequenceOut() const
00808   {return sequenceOut_;};
00810   inline void  setSequenceIn(int sequence)
00811   { sequenceIn_=sequence;};
00812   inline void  setSequenceOut(int sequence)
00813   { sequenceOut_=sequence;};
00815   inline int directionIn() const
00816   {return directionIn_;};
00817   inline int directionOut() const
00818   {return directionOut_;};
00820   inline void  setDirectionIn(int direction)
00821   { directionIn_=direction;};
00822   inline void  setDirectionOut(int direction)
00823   { directionOut_=direction;};
00825   inline double valueOut() const
00826   { return valueOut_;};
00828   inline int isColumn(int sequence) const
00829   { return sequence<numberColumns_ ? 1 : 0;};
00831   inline int sequenceWithin(int sequence) const
00832   { return sequence<numberColumns_ ? sequence : sequence-numberColumns_;};
00834   inline double solution(int sequence)
00835   { return solution_[sequence];};
00837   inline double & solutionAddress(int sequence)
00838   { return solution_[sequence];};
00839   inline double reducedCost(int sequence)
00840    { return dj_[sequence];};
00841   inline double & reducedCostAddress(int sequence)
00842    { return dj_[sequence];};
00843   inline double lower(int sequence)
00844   { return lower_[sequence];};
00846   inline double & lowerAddress(int sequence)
00847   { return lower_[sequence];};
00848   inline double upper(int sequence)
00849   { return upper_[sequence];};
00851   inline double & upperAddress(int sequence)
00852   { return upper_[sequence];};
00853   inline double cost(int sequence)
00854   { return cost_[sequence];};
00856   inline double & costAddress(int sequence)
00857   { return cost_[sequence];};
00859   inline double originalLower(int iSequence) const
00860   { if (iSequence<numberColumns_) return columnLower_[iSequence]; else
00861     return rowLower_[iSequence-numberColumns_];};
00863   inline double originalUpper(int iSequence) const
00864   { if (iSequence<numberColumns_) return columnUpper_[iSequence]; else
00865     return rowUpper_[iSequence-numberColumns_];};
00867   inline double theta() const
00868   { return theta_;};
00870   inline ClpNonLinearCost * nonLinearCost() const
00871   { return nonLinearCost_;};
00873 
00875   inline void setFakeBound(int sequence, FakeBound fakeBound)
00876   {
00877     unsigned char & st_byte = status_[sequence];
00878     st_byte &= ~24;
00879     st_byte |= fakeBound<<3;
00880   };
00881   inline FakeBound getFakeBound(int sequence) const
00882   {return static_cast<FakeBound> ((status_[sequence]>>3)&3);};
00883   inline void setRowStatus(int sequence, Status status)
00884   {
00885     unsigned char & st_byte = status_[sequence+numberColumns_];
00886     st_byte &= ~7;
00887     st_byte |= status;
00888   };
00889   inline Status getRowStatus(int sequence) const
00890   {return static_cast<Status> (status_[sequence+numberColumns_]&7);};
00891   inline void setColumnStatus(int sequence, Status status)
00892   {
00893     unsigned char & st_byte = status_[sequence];
00894     st_byte &= ~7;
00895     st_byte |= status;
00896   };
00897   inline Status getColumnStatus(int sequence) const
00898   {return static_cast<Status> (status_[sequence]&7);};
00899   inline void setPivoted( int sequence)
00900   { status_[sequence] |= 32;};
00901   inline void clearPivoted( int sequence)
00902   { status_[sequence] &= ~32; };
00903   inline bool pivoted(int sequence) const
00904   {return (((status_[sequence]>>5)&1)!=0);};
00906   void setFlagged( int sequence);
00907   inline void clearFlagged( int sequence)
00908   {
00909     status_[sequence] &= ~64;
00910   };
00911   inline bool flagged(int sequence) const
00912   {return ((status_[sequence]&64)!=0);};
00914   inline void setActive( int iRow)
00915   {
00916     status_[iRow] |= 128;
00917   };
00918   inline void clearActive( int iRow)
00919   {
00920     status_[iRow] &= ~128;
00921   };
00922   inline bool active(int iRow) const
00923   {return ((status_[iRow]&128)!=0);};
00926   void createStatus() ;
00929   void allSlackBasis(bool resetSolution=false);
00930     
00932   inline int lastBadIteration() const
00933   {return lastBadIteration_;};
00935   inline int progressFlag() const
00936   {return progressFlag_;};
00938   inline void forceFactorization(int value)
00939   { forceFactorization_ = value;};
00941   inline double rawObjectiveValue() const
00942   { return objectiveValue_;};
00944   void computeObjectiveValue(bool useWorkingSolution=false);
00948   inline int numberExtraRows() const
00949   { return numberExtraRows_;};
00952   inline int maximumBasic() const
00953   { return maximumBasic_;};
00955   void generateCpp( FILE * fp,bool defaultFactor=false);
00982 #define COIN_CBC_USING_CLP 0x01000000
00983   inline unsigned int specialOptions() const
00984   { return specialOptions_;};
00985   inline void setSpecialOptions(unsigned int value)
00986   { specialOptions_=value;};
00988 
00990   // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
00991   // *** At present only without scaling
00992   // *** Slacks havve -1.0 element (so == row activity) - take care
00994   void getBInvARow(int row, double* z, double * slack=NULL);
00995   
00997   void getBInvRow(int row, double* z);
00998   
01000   void getBInvACol(int col, double* vec);
01001   
01003   void getBInvCol(int col, double* vec);
01004   
01009   void getBasics(int* index);
01010   
01012     //-------------------------------------------------------------------------
01016        void setObjectiveCoefficient( int elementIndex, double elementValue );
01018        inline void setObjCoeff( int elementIndex, double elementValue )
01019        { setObjectiveCoefficient( elementIndex, elementValue);};
01020 
01023        void setColumnLower( int elementIndex, double elementValue );
01024       
01027        void setColumnUpper( int elementIndex, double elementValue );
01028 
01030       void setColumnBounds( int elementIndex,
01031         double lower, double upper );
01032 
01041       void setColumnSetBounds(const int* indexFirst,
01042                                    const int* indexLast,
01043                                    const double* boundList);
01044       
01047        inline void setColLower( int elementIndex, double elementValue )
01048        { setColumnLower(elementIndex, elementValue);};
01051        inline void setColUpper( int elementIndex, double elementValue )
01052        { setColumnUpper(elementIndex, elementValue);};
01053 
01055       inline void setColBounds( int elementIndex,
01056         double lower, double upper )
01057        { setColumnBounds(elementIndex, lower, upper);};
01058 
01065       inline void setColSetBounds(const int* indexFirst,
01066                                    const int* indexLast,
01067                                    const double* boundList)
01068       { setColumnSetBounds(indexFirst, indexLast, boundList);};
01069       
01072       void setRowLower( int elementIndex, double elementValue );
01073       
01076       void setRowUpper( int elementIndex, double elementValue ) ;
01077     
01079       void setRowBounds( int elementIndex,
01080                                  double lower, double upper ) ;
01081     
01088       void setRowSetBounds(const int* indexFirst,
01089                                    const int* indexLast,
01090                                    const double* boundList);
01091     
01093 
01095 protected:
01096 
01103 
01104   double columnPrimalInfeasibility_;
01106   double rowPrimalInfeasibility_;
01108   int columnPrimalSequence_;
01110   int rowPrimalSequence_;
01112   double columnDualInfeasibility_;
01114   double rowDualInfeasibility_;
01116   int columnDualSequence_;
01118   int rowDualSequence_;
01120   double primalToleranceToGetOptimal_;
01122   double remainingDualInfeasibility_;
01124   double largeValue_;
01126   double largestPrimalError_;
01128   double largestDualError_;
01130   double largestSolutionError_;
01132   double dualBound_;
01134   double alpha_;
01136   double theta_;
01138   double lowerIn_;
01140   double valueIn_;
01142   double upperIn_;
01144   double dualIn_;
01146   double lowerOut_;
01148   double valueOut_;
01150   double upperOut_;
01152   double dualOut_;
01154   double dualTolerance_;
01156   double primalTolerance_;
01158   double sumDualInfeasibilities_;
01160   double sumPrimalInfeasibilities_;
01162   double infeasibilityCost_;
01164   double sumOfRelaxedDualInfeasibilities_;
01166   double sumOfRelaxedPrimalInfeasibilities_;
01168   double acceptablePivot_;
01170   double * lower_;
01172   double * rowLowerWork_;
01174   double * columnLowerWork_;
01176   double * upper_;
01178   double * rowUpperWork_;
01180   double * columnUpperWork_;
01182   double * cost_;
01184   double * rowObjectiveWork_;
01186   double * objectiveWork_;
01188   CoinIndexedVector * rowArray_[6];
01190   CoinIndexedVector * columnArray_[6];
01192   int sequenceIn_;
01194   int directionIn_;
01196   int sequenceOut_;
01198   int directionOut_;
01200   int pivotRow_;
01202   int lastGoodIteration_;
01204   double * dj_;
01206   double * rowReducedCost_;
01208   double * reducedCostWork_;
01210   double * solution_;
01212   double * rowActivityWork_;
01214   double * columnActivityWork_;
01216   ClpSimplex * auxiliaryModel_;
01218   int numberDualInfeasibilities_;
01220   int numberDualInfeasibilitiesWithoutFree_;
01222   int numberPrimalInfeasibilities_;
01224   int numberRefinements_;
01226   ClpDualRowPivot * dualRowPivot_;
01228   ClpPrimalColumnPivot * primalColumnPivot_;
01230   int * pivotVariable_;
01232   ClpFactorization * factorization_;
01234   double * savedSolution_;
01236   int numberTimesOptimal_;
01238   int changeMade_;
01240   int algorithm_;
01243   int forceFactorization_;
01251   int perturbation_;
01253   unsigned char * saveStatus_;
01258   ClpNonLinearCost * nonLinearCost_;
01262   unsigned int specialOptions_;
01264   int lastBadIteration_;
01266   int lastFlaggedIteration_;
01268   int numberFake_;
01270   int numberChanged_;
01272   int progressFlag_;
01274   int firstFree_;
01278   int numberExtraRows_;
01281   int maximumBasic_;
01291   float incomingInfeasibility_;
01292   float allowedInfeasibility_;
01294   int automaticScale_;
01296   ClpSimplexProgress * progress_;
01297 public:
01299   mutable int spareIntArray_[4];
01301   mutable double spareDoubleArray_[4];
01302 protected:
01304   friend class OsiClpSolverInterface;
01306 };
01307 //#############################################################################
01316 void
01317 ClpSimplexUnitTest(const std::string & mpsDir,
01318                    const std::string & netlibDir);
01319 
01320 
01322 class ClpSimplexProgress {
01323 
01324 public:
01325 
01326 
01329 
01330     ClpSimplexProgress (  );
01331 
01333     ClpSimplexProgress ( ClpSimplex * model );
01334 
01336   ClpSimplexProgress(const ClpSimplexProgress &);
01337 
01339     ClpSimplexProgress & operator=(const ClpSimplexProgress & rhs);
01341    ~ClpSimplexProgress (  );
01343 
01349     int looping (  );
01351   void startCheck();
01353   int cycle(int in, int out,int wayIn,int wayOut); 
01354 
01356   double lastObjective(int back=1) const;
01358   void setInfeasibility(double value);
01360   double lastInfeasibility(int back=1) const;
01362   void modifyObjective(double value);
01364   int lastIterationNumber(int back=1) const;
01366   void clearIterationNumbers();
01368   inline void newOddState()
01369   { oddState_= - oddState_-1;};
01370   inline void endOddState()
01371   { oddState_=abs(oddState_);};
01372   inline void clearOddState() 
01373   { oddState_=0;};
01374   inline int oddState() const
01375   { return oddState_;};
01377   inline int badTimes() const
01378   { return numberBadTimes_;};
01379   inline void clearBadTimes()
01380   { numberBadTimes_=0;};
01381 
01383 
01384 #define CLP_PROGRESS 5
01385 
01386 
01387   double objective_[CLP_PROGRESS];
01389   double infeasibility_[CLP_PROGRESS];
01391   double realInfeasibility_[CLP_PROGRESS];
01392 #define CLP_CYCLE 12
01394   //double obj_[CLP_CYCLE];
01395   int in_[CLP_CYCLE];
01396   int out_[CLP_CYCLE];
01397   char way_[CLP_CYCLE];
01399   ClpSimplex * model_;
01401   int numberInfeasibilities_[CLP_PROGRESS];
01403   int iterationNumber_[CLP_PROGRESS];
01405   int numberTimes_;
01407   int numberBadTimes_;
01409   int oddState_;
01411 };
01412 // For Devex stuff
01413 #define DEVEX_TRY_NORM 1.0e-4
01414 #define DEVEX_ADD_ONE 1.0
01415 #endif

Generated on Thu May 15 22:04:42 2008 by  doxygen 1.4.7