/home/coin/SVN-release/Bcp-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 #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 class ClpDisasterHandler;
00028 class ClpConstraint;
00029 
00051 class ClpSimplex : public ClpModel {
00052   friend void ClpSimplexUnitTest(const std::string & mpsDir);
00053 
00054 public:
00059   enum Status {
00060     isFree = 0x00,
00061     basic = 0x01,
00062     atUpperBound = 0x02,
00063     atLowerBound = 0x03,
00064     superBasic = 0x04,
00065     isFixed = 0x05
00066   };
00067   // For Dual
00068   enum FakeBound {
00069     noFake = 0x00,
00070     bothFake = 0x01,
00071     upperFake = 0x02,
00072     lowerFake = 0x03
00073   };
00074 
00077 
00078     ClpSimplex (bool emptyMessages = false  );
00079 
00084   ClpSimplex(const ClpSimplex & rhs, int scalingMode =-1);
00089   ClpSimplex(const ClpModel & rhs, int scalingMode=-1);
00096   ClpSimplex (const ClpModel * wholeModel,
00097               int numberRows, const int * whichRows,
00098               int numberColumns, const int * whichColumns,
00099               bool dropNames=true, bool dropIntegers=true,
00100               bool fixOthers=false);
00104   ClpSimplex (ClpSimplex * wholeModel,
00105               int numberColumns, const int * whichColumns);
00108   void originalModel(ClpSimplex * miniModel);
00114   void setPersistenceFlag(int value);
00128   void auxiliaryModel(int options);
00130   void deleteAuxiliaryModel();
00132   inline bool usingAuxiliaryModel() const
00133   { return auxiliaryModel_!=NULL;}
00135     ClpSimplex & operator=(const ClpSimplex & rhs);
00137    ~ClpSimplex (  );
00138   // Ones below are just ClpModel with some changes
00150   void loadProblem (  const ClpMatrixBase& matrix,
00151                      const double* collb, const double* colub,   
00152                      const double* obj,
00153                      const double* rowlb, const double* rowub,
00154                       const double * rowObjective=NULL);
00155   void loadProblem (  const CoinPackedMatrix& matrix,
00156                      const double* collb, const double* colub,   
00157                      const double* obj,
00158                      const double* rowlb, const double* rowub,
00159                       const double * rowObjective=NULL);
00160 
00163   void loadProblem (  const int numcols, const int numrows,
00164                      const CoinBigIndex* start, const int* index,
00165                      const double* value,
00166                      const double* collb, const double* colub,   
00167                      const double* obj,
00168                       const double* rowlb, const double* rowub,
00169                       const double * rowObjective=NULL);
00171   void loadProblem (  const int numcols, const int numrows,
00172                      const CoinBigIndex* start, const int* index,
00173                       const double* value,const int * length,
00174                      const double* collb, const double* colub,   
00175                      const double* obj,
00176                       const double* rowlb, const double* rowub,
00177                       const double * rowObjective=NULL);
00182   int loadProblem (  CoinModel & modelObject,bool keepSolution=false);
00184   int readMps(const char *filename,
00185               bool keepNames=false,
00186               bool ignoreErrors = false);
00188   int readGMPL(const char *filename,const char * dataName,
00189                bool keepNames=false);
00192   int readLp(const char *filename, const double epsilon = 1e-5);
00197   void borrowModel(ClpModel & otherModel);
00198   void borrowModel(ClpSimplex & otherModel);
00200    void passInEventHandler(const ClpEventHandler * eventHandler);
00202   void getbackSolution(const ClpSimplex & smallModel,const int * whichRow, const int * whichColumn);
00211   int loadNonLinear(void * info, int & numberConstraints, 
00212                     ClpConstraint ** & constraints);
00214 
00220   int initialSolve(ClpSolve & options);
00222   int initialSolve();
00224   int initialDualSolve();
00226   int initialPrimalSolve();
00228   int initialBarrierSolve();
00230   int initialBarrierNoCrossSolve();
00241   int dual(int ifValuesPass=0, int startFinishOptions=0);
00242   // If using Debug
00243   int dualDebug(int ifValuesPass=0, int startFinishOptions=0);
00254   int primal(int ifValuesPass=0, int startFinishOptions=0);
00260   int nonlinearSLP(int numberPasses,double deltaTolerance);
00266   int nonlinearSLP(int numberConstraints, ClpConstraint ** constraints,
00267                    int numberPasses,double deltaTolerance);
00270   int barrier(bool crossover=true);
00273   int reducedGradient(int phase=0);
00288   int cleanup(int cleanupScaling);
00309   int dualRanging(int numberCheck,const int * which,
00310                   double * costIncrease, int * sequenceIncrease,
00311                   double * costDecrease, int * sequenceDecrease,
00312                   double * valueIncrease=NULL, double * valueDecrease=NULL);
00327   int primalRanging(int numberCheck,const int * which,
00328                   double * valueIncrease, int * sequenceIncrease,
00329                   double * valueDecrease, int * sequenceDecrease);
00344   int writeBasis(const char *filename,
00345                  bool writeValues=false,
00346                  int formatType=0) const;
00349   int readBasis(const char *filename);
00351   CoinWarmStartBasis * getBasis() const;
00353   void setFactorization( ClpFactorization & factorization);
00363   int tightenPrimalBounds(double factor=0.0,int doTight=0,bool tightIntegers=false);
00380   int crash(double gap,int pivot);
00382   void setDualRowPivotAlgorithm(ClpDualRowPivot & choice);
00384   void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot & choice);
00393   int strongBranching(int numberVariables,const int * variables,
00394                       double * newLower, double * newUpper,
00395                       double ** outputSolution,
00396                       int * outputStatus, int * outputIterations,
00397                       bool stopOnFirstInfeasible=true,
00398                       bool alwaysFinish=false,
00399                       int startFinishOptions=0);
00401 
00409   int pivot();
00410 
00416   int primalPivotResult();
00417   
00424   int dualPivotResult();
00425 
00437   int startup(int ifValuesPass,int startFinishOptions=0);
00438   void finish(int startFinishOptions=0);
00439   
00441   bool statusOfProblem(bool initial=false);
00443   void defaultFactorizationFrequency();
00445 
00448 
00449   inline bool primalFeasible() const
00450          { return (numberPrimalInfeasibilities_==0);}
00452   inline bool dualFeasible() const
00453          { return (numberDualInfeasibilities_==0);}
00455   inline ClpFactorization * factorization() const 
00456           { return factorization_;}
00458   bool sparseFactorization() const;
00459   void setSparseFactorization(bool value);
00461   int factorizationFrequency() const;
00462   void setFactorizationFrequency(int value);
00464   inline double dualBound() const
00465           { return dualBound_;}
00466   void setDualBound(double value);
00468   inline double infeasibilityCost() const
00469           { return infeasibilityCost_;}
00470   void setInfeasibilityCost(double value);
00487   inline int perturbation() const
00488     { return perturbation_;}
00489   void setPerturbation(int value);
00491   inline int algorithm() const 
00492   {return algorithm_; } 
00494   inline void setAlgorithm(int value)
00495   {algorithm_=value; } 
00497   inline double sumDualInfeasibilities() const 
00498           { return sumDualInfeasibilities_;} 
00499   inline void setSumDualInfeasibilities(double value)
00500           { sumDualInfeasibilities_=value;} 
00502   inline double sumOfRelaxedDualInfeasibilities() const 
00503           { return sumOfRelaxedDualInfeasibilities_;} 
00504   inline void setSumOfRelaxedDualInfeasibilities(double value)
00505           { sumOfRelaxedDualInfeasibilities_=value;} 
00507   inline int numberDualInfeasibilities() const 
00508           { return numberDualInfeasibilities_;} 
00509   inline void setNumberDualInfeasibilities(int value)
00510           { numberDualInfeasibilities_=value;} 
00512   inline int numberDualInfeasibilitiesWithoutFree() const 
00513           { return numberDualInfeasibilitiesWithoutFree_;} 
00515   inline double sumPrimalInfeasibilities() const 
00516           { return sumPrimalInfeasibilities_;} 
00517   inline void setSumPrimalInfeasibilities(double value)
00518           { sumPrimalInfeasibilities_=value;} 
00520   inline double sumOfRelaxedPrimalInfeasibilities() const 
00521           { return sumOfRelaxedPrimalInfeasibilities_;} 
00522   inline void setSumOfRelaxedPrimalInfeasibilities(double value)
00523           { sumOfRelaxedPrimalInfeasibilities_=value;} 
00525   inline int numberPrimalInfeasibilities() const 
00526           { return numberPrimalInfeasibilities_;} 
00527   inline void setNumberPrimalInfeasibilities(int value)
00528           { numberPrimalInfeasibilities_=value;} 
00535   int saveModel(const char * fileName);
00538   int restoreModel(const char * fileName);
00539   
00547   void checkSolution(int setToBounds=false);
00550   void checkSolutionInternal();
00552   inline CoinIndexedVector * rowArray(int index) const
00553   { return rowArray_[index];}
00555   inline CoinIndexedVector * columnArray(int index) const
00556   { return columnArray_[index];}
00558 
00559   /******************** End of most useful part **************/
00565   int getSolution (  const double * rowActivities,
00566                      const double * columnActivities);
00570   int getSolution ();
00577   int createPiecewiseLinearCosts(const int * starts,
00578                    const double * lower, const double * gradient);
00580   void returnModel(ClpSimplex & otherModel);
00588   int internalFactorize(int solveType);
00590   ClpDataSave saveData() ;
00592   void restoreData(ClpDataSave saved);
00594   void cleanStatus();
00596   int factorize();
00599   void computeDuals(double * givenDjs);
00601   void computePrimals (  const double * rowActivities,
00602                      const double * columnActivities);
00604   void add(double * array,
00605                    int column, double multiplier) const;
00611   void unpack(CoinIndexedVector * rowArray) const ;
00617   void unpack(CoinIndexedVector * rowArray,int sequence) const;
00624   void unpackPacked(CoinIndexedVector * rowArray) ;
00631   void unpackPacked(CoinIndexedVector * rowArray,int sequence);
00632 protected:  
00637   int housekeeping(double objectiveChange);
00640   void checkPrimalSolution(const double * rowActivities=NULL,
00641                            const double * columnActivies=NULL);
00644   void checkDualSolution();
00646   void checkBothSolutions();
00647 public:
00658   void setValuesPassAction(float incomingInfeasibility,
00659                            float allowedInfeasibility);
00661 
00663 public: 
00665   inline double alphaAccuracy() const
00666           { return alphaAccuracy_;} 
00667   inline void setAlphaAccuracy(double value)
00668           { alphaAccuracy_ = value;} 
00669 public:
00671   inline void setDisasterHandler(ClpDisasterHandler * handler)
00672   { disasterArea_= handler;}
00674   inline double largeValue() const 
00675           { return largeValue_;} 
00676   void setLargeValue( double value) ;
00678   inline double largestPrimalError() const
00679           { return largestPrimalError_;} 
00681   inline double largestDualError() const
00682           { return largestDualError_;} 
00684   inline void setLargestPrimalError(double value)
00685           { largestPrimalError_=value;} 
00687   inline void setLargestDualError(double value)
00688           { largestDualError_=value;} 
00690   inline int * pivotVariable() const
00691           { return pivotVariable_;}
00693   inline bool automaticScaling() const
00694   { return automaticScale_!=0;}
00695   inline void setAutomaticScaling(bool onOff)
00696   { automaticScale_ = onOff ? 1: 0;} 
00698   inline double currentDualTolerance() const 
00699           { return dualTolerance_;} 
00700   inline void setCurrentDualTolerance(double value)
00701           { dualTolerance_ = value;} 
00703   inline double currentPrimalTolerance() const 
00704           { return primalTolerance_;} 
00705   inline void setCurrentPrimalTolerance(double value)
00706           { primalTolerance_ = value;} 
00708   inline int numberRefinements() const 
00709           { return numberRefinements_;} 
00710   void setNumberRefinements( int value) ;
00712   inline double alpha() const { return alpha_;}
00713   inline void setAlpha(double value) { alpha_ = value;}
00715   inline double dualIn() const { return dualIn_;}
00717   inline int pivotRow() const{ return pivotRow_;}
00718   inline void setPivotRow(int value) { pivotRow_=value;}
00720   double valueIncomingDual() const;
00722 
00723   protected:
00729   int gutsOfSolution ( double * givenDuals,
00730                        const double * givenPrimals,
00731                        bool valuesPass=false);
00733   void gutsOfDelete(int type);
00735   void gutsOfCopy(const ClpSimplex & rhs);
00747   bool createRim(int what,bool makeRowCopy=false,int startFinishOptions=0);
00752   void deleteRim(int getRidOfFactorizationData=2);
00754   bool sanityCheck();
00756   public:
00761   inline double * solutionRegion(int section) const
00762   { if (!section) return rowActivityWork_; else return columnActivityWork_;}
00763   inline double * djRegion(int section) const
00764   { if (!section) return rowReducedCost_; else return reducedCostWork_;}
00765   inline double * lowerRegion(int section) const
00766   { if (!section) return rowLowerWork_; else return columnLowerWork_;}
00767   inline double * upperRegion(int section) const
00768   { if (!section) return rowUpperWork_; else return columnUpperWork_;}
00769   inline double * costRegion(int section) const
00770   { if (!section) return rowObjectiveWork_; else return objectiveWork_;}
00772   inline double * solutionRegion() const
00773   { return solution_;}
00774   inline double * djRegion() const
00775   { return dj_;}
00776   inline double * lowerRegion() const
00777   { return lower_;}
00778   inline double * upperRegion() const
00779   { return upper_;}
00780   inline double * costRegion() const
00781   { return cost_;}
00782   inline Status getStatus(int sequence) const
00783   {return static_cast<Status> (status_[sequence]&7);}
00784   inline void setStatus(int sequence, Status status)
00785   {
00786     unsigned char & st_byte = status_[sequence];
00787     st_byte &= ~7;
00788     st_byte |= status;
00789   }
00794   void setInitialDenseFactorization(bool onOff);
00795   bool  initialDenseFactorization() const;
00797   inline int sequenceIn() const
00798   {return sequenceIn_;}
00799   inline int sequenceOut() const
00800   {return sequenceOut_;}
00802   inline void  setSequenceIn(int sequence)
00803   { sequenceIn_=sequence;}
00804   inline void  setSequenceOut(int sequence)
00805   { sequenceOut_=sequence;}
00807   inline int directionIn() const
00808   {return directionIn_;}
00809   inline int directionOut() const
00810   {return directionOut_;}
00812   inline void  setDirectionIn(int direction)
00813   { directionIn_=direction;}
00814   inline void  setDirectionOut(int direction)
00815   { directionOut_=direction;}
00817   inline double valueOut() const
00818   { return valueOut_;}
00820   inline int isColumn(int sequence) const
00821   { return sequence<numberColumns_ ? 1 : 0;}
00823   inline int sequenceWithin(int sequence) const
00824   { return sequence<numberColumns_ ? sequence : sequence-numberColumns_;}
00826   inline double solution(int sequence)
00827   { return solution_[sequence];}
00829   inline double & solutionAddress(int sequence)
00830   { return solution_[sequence];}
00831   inline double reducedCost(int sequence)
00832    { return dj_[sequence];}
00833   inline double & reducedCostAddress(int sequence)
00834    { return dj_[sequence];}
00835   inline double lower(int sequence)
00836   { return lower_[sequence];}
00838   inline double & lowerAddress(int sequence)
00839   { return lower_[sequence];}
00840   inline double upper(int sequence)
00841   { return upper_[sequence];}
00843   inline double & upperAddress(int sequence)
00844   { return upper_[sequence];}
00845   inline double cost(int sequence)
00846   { return cost_[sequence];}
00848   inline double & costAddress(int sequence)
00849   { return cost_[sequence];}
00851   inline double originalLower(int iSequence) const
00852   { if (iSequence<numberColumns_) return columnLower_[iSequence]; else
00853     return rowLower_[iSequence-numberColumns_];}
00855   inline double originalUpper(int iSequence) const
00856   { if (iSequence<numberColumns_) return columnUpper_[iSequence]; else
00857     return rowUpper_[iSequence-numberColumns_];}
00859   inline double theta() const
00860   { return theta_;}
00862   inline ClpNonLinearCost * nonLinearCost() const
00863   { return nonLinearCost_;}
00868   inline int moreSpecialOptions() const
00869   { return moreSpecialOptions_;}
00874   inline void setMoreSpecialOptions(int value)
00875   { moreSpecialOptions_ = value;}
00877 
00879   inline void setFakeBound(int sequence, FakeBound fakeBound)
00880   {
00881     unsigned char & st_byte = status_[sequence];
00882     st_byte &= ~24;
00883     st_byte |= fakeBound<<3;
00884   }
00885   inline FakeBound getFakeBound(int sequence) const
00886   {return static_cast<FakeBound> ((status_[sequence]>>3)&3);}
00887   inline void setRowStatus(int sequence, Status status)
00888   {
00889     unsigned char & st_byte = status_[sequence+numberColumns_];
00890     st_byte &= ~7;
00891     st_byte |= status;
00892   }
00893   inline Status getRowStatus(int sequence) const
00894   {return static_cast<Status> (status_[sequence+numberColumns_]&7);}
00895   inline void setColumnStatus(int sequence, Status status)
00896   {
00897     unsigned char & st_byte = status_[sequence];
00898     st_byte &= ~7;
00899     st_byte |= status;
00900   }
00901   inline Status getColumnStatus(int sequence) const
00902   {return static_cast<Status> (status_[sequence]&7);}
00903   inline void setPivoted( int sequence)
00904   { status_[sequence] |= 32;}
00905   inline void clearPivoted( int sequence)
00906   { status_[sequence] &= ~32; }
00907   inline bool pivoted(int sequence) const
00908   {return (((status_[sequence]>>5)&1)!=0);}
00910   void setFlagged( int sequence);
00911   inline void clearFlagged( int sequence)
00912   {
00913     status_[sequence] &= ~64;
00914   }
00915   inline bool flagged(int sequence) const
00916   {return ((status_[sequence]&64)!=0);}
00918   inline void setActive( int iRow)
00919   {
00920     status_[iRow] |= 128;
00921   }
00922   inline void clearActive( int iRow)
00923   {
00924     status_[iRow] &= ~128;
00925   }
00926   inline bool active(int iRow) const
00927   {return ((status_[iRow]&128)!=0);}
00930   void createStatus() ;
00933   void allSlackBasis(bool resetSolution=false);
00934     
00936   inline int lastBadIteration() const
00937   {return lastBadIteration_;}
00939   inline int progressFlag() const
00940   {return progressFlag_;}
00942   inline void forceFactorization(int value)
00943   { forceFactorization_ = value;}
00945   inline double rawObjectiveValue() const
00946   { return objectiveValue_;}
00948   void computeObjectiveValue(bool useWorkingSolution=false);
00950   double computeInternalObjectiveValue();
00954   inline int numberExtraRows() const
00955   { return numberExtraRows_;}
00958   inline int maximumBasic() const
00959   { return maximumBasic_;}
00961   void generateCpp( FILE * fp,bool defaultFactor=false);
00963   ClpFactorization * getEmptyFactorization();
00965   void setEmptyFactorization();
00967   void moveInfo(const ClpSimplex & rhs, bool justStatus=false);
00969 
00971   // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
00972   // *** At present only without scaling
00973   // *** Slacks havve -1.0 element (so == row activity) - take care
00975   void getBInvARow(int row, double* z, double * slack=NULL);
00976   
00978   void getBInvRow(int row, double* z);
00979   
00981   void getBInvACol(int col, double* vec);
00982   
00984   void getBInvCol(int col, double* vec);
00985   
00990   void getBasics(int* index);
00991   
00993     //-------------------------------------------------------------------------
00997        void setObjectiveCoefficient( int elementIndex, double elementValue );
00999        inline void setObjCoeff( int elementIndex, double elementValue )
01000        { setObjectiveCoefficient( elementIndex, elementValue);}
01001 
01004        void setColumnLower( int elementIndex, double elementValue );
01005       
01008        void setColumnUpper( int elementIndex, double elementValue );
01009 
01011       void setColumnBounds( int elementIndex,
01012         double lower, double upper );
01013 
01022       void setColumnSetBounds(const int* indexFirst,
01023                                    const int* indexLast,
01024                                    const double* boundList);
01025       
01028        inline void setColLower( int elementIndex, double elementValue )
01029        { setColumnLower(elementIndex, elementValue);}
01032        inline void setColUpper( int elementIndex, double elementValue )
01033        { setColumnUpper(elementIndex, elementValue);}
01034 
01036       inline void setColBounds( int elementIndex,
01037         double lower, double upper )
01038        { setColumnBounds(elementIndex, lower, upper);}
01039 
01046       inline void setColSetBounds(const int* indexFirst,
01047                                    const int* indexLast,
01048                                    const double* boundList)
01049       { setColumnSetBounds(indexFirst, indexLast, boundList);}
01050       
01053       void setRowLower( int elementIndex, double elementValue );
01054       
01057       void setRowUpper( int elementIndex, double elementValue ) ;
01058     
01060       void setRowBounds( int elementIndex,
01061                                  double lower, double upper ) ;
01062     
01069       void setRowSetBounds(const int* indexFirst,
01070                                    const int* indexLast,
01071                                    const double* boundList);
01072     
01074 
01076 protected:
01077 
01084 
01085   double columnPrimalInfeasibility_;
01087   double rowPrimalInfeasibility_;
01089   int columnPrimalSequence_;
01091   int rowPrimalSequence_;
01093   double columnDualInfeasibility_;
01095   double rowDualInfeasibility_;
01097   int moreSpecialOptions_;
01099   int rowDualSequence_;
01101   double primalToleranceToGetOptimal_;
01103   double remainingDualInfeasibility_;
01105   double largeValue_;
01107   double largestPrimalError_;
01109   double largestDualError_;
01111   double alphaAccuracy_;
01113   double dualBound_;
01115   double alpha_;
01117   double theta_;
01119   double lowerIn_;
01121   double valueIn_;
01123   double upperIn_;
01125   double dualIn_;
01127   double lowerOut_;
01129   double valueOut_;
01131   double upperOut_;
01133   double dualOut_;
01135   double dualTolerance_;
01137   double primalTolerance_;
01139   double sumDualInfeasibilities_;
01141   double sumPrimalInfeasibilities_;
01143   double infeasibilityCost_;
01145   double sumOfRelaxedDualInfeasibilities_;
01147   double sumOfRelaxedPrimalInfeasibilities_;
01149   double acceptablePivot_;
01151   double * lower_;
01153   double * rowLowerWork_;
01155   double * columnLowerWork_;
01157   double * upper_;
01159   double * rowUpperWork_;
01161   double * columnUpperWork_;
01163   double * cost_;
01165   double * rowObjectiveWork_;
01167   double * objectiveWork_;
01169   CoinIndexedVector * rowArray_[6];
01171   CoinIndexedVector * columnArray_[6];
01173   int sequenceIn_;
01175   int directionIn_;
01177   int sequenceOut_;
01179   int directionOut_;
01181   int pivotRow_;
01183   int lastGoodIteration_;
01185   double * dj_;
01187   double * rowReducedCost_;
01189   double * reducedCostWork_;
01191   double * solution_;
01193   double * rowActivityWork_;
01195   double * columnActivityWork_;
01197   ClpSimplex * auxiliaryModel_;
01199   int numberDualInfeasibilities_;
01201   int numberDualInfeasibilitiesWithoutFree_;
01203   int numberPrimalInfeasibilities_;
01205   int numberRefinements_;
01207   ClpDualRowPivot * dualRowPivot_;
01209   ClpPrimalColumnPivot * primalColumnPivot_;
01211   int * pivotVariable_;
01213   ClpFactorization * factorization_;
01215   double * savedSolution_;
01217   int numberTimesOptimal_;
01219   ClpDisasterHandler * disasterArea_;
01221   int changeMade_;
01223   int algorithm_;
01226   int forceFactorization_;
01234   int perturbation_;
01236   unsigned char * saveStatus_;
01241   ClpNonLinearCost * nonLinearCost_;
01243   int lastBadIteration_;
01245   int lastFlaggedIteration_;
01247   int numberFake_;
01249   int numberChanged_;
01251   int progressFlag_;
01253   int firstFree_;
01257   int numberExtraRows_;
01260   int maximumBasic_;
01270   float incomingInfeasibility_;
01271   float allowedInfeasibility_;
01273   int automaticScale_;
01275   ClpSimplexProgress * progress_;
01276 public:
01278   mutable int spareIntArray_[4];
01280   mutable double spareDoubleArray_[4];
01281 protected:
01283   friend class OsiClpSolverInterface;
01285 };
01286 //#############################################################################
01295 void
01296 ClpSimplexUnitTest(const std::string & mpsDir);
01297 
01298 
01300 class ClpSimplexProgress {
01301 
01302 public:
01303 
01304 
01307 
01308     ClpSimplexProgress (  );
01309 
01311     ClpSimplexProgress ( ClpSimplex * model );
01312 
01314   ClpSimplexProgress(const ClpSimplexProgress &);
01315 
01317     ClpSimplexProgress & operator=(const ClpSimplexProgress & rhs);
01319    ~ClpSimplexProgress (  );
01321    void reset();
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   //#define CLP_PROGRESS_WEIGHT 10
01367 
01368   double objective_[CLP_PROGRESS];
01370   double infeasibility_[CLP_PROGRESS];
01372   double realInfeasibility_[CLP_PROGRESS];
01373 #ifdef CLP_PROGRESS_WEIGHT
01375   double objectiveWeight_[CLP_PROGRESS_WEIGHT];
01377   double infeasibilityWeight_[CLP_PROGRESS_WEIGHT];
01379   double realInfeasibilityWeight_[CLP_PROGRESS_WEIGHT];
01381   double drop_;
01383   double best_;
01384 #endif
01386   double initialWeight_;
01387 #define CLP_CYCLE 12
01389   //double obj_[CLP_CYCLE];
01390   int in_[CLP_CYCLE];
01391   int out_[CLP_CYCLE];
01392   char way_[CLP_CYCLE];
01394   ClpSimplex * model_;
01396   int numberInfeasibilities_[CLP_PROGRESS];
01398   int iterationNumber_[CLP_PROGRESS];
01399 #ifdef CLP_PROGRESS_WEIGHT
01401   int numberInfeasibilitiesWeight_[CLP_PROGRESS_WEIGHT];
01403   int iterationNumberWeight_[CLP_PROGRESS_WEIGHT];
01404 #endif
01406   int numberTimes_;
01408   int numberBadTimes_;
01410   int oddState_;
01411 
01412 };
01413 // For Devex stuff
01414 #define DEVEX_TRY_NORM 1.0e-4
01415 #define DEVEX_ADD_ONE 1.0
01416 #endif

Generated on Fri May 16 16:18:23 2008 for coin-Bcp by  doxygen 1.4.7