- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/Clp-1.5.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 #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
    00969   // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
    00970   // *** At present only without scaling
    00971   // *** Slacks havve -1.0 element (so == row activity) - take care
    00973   void getBInvARow(int row, double* z, double * slack=NULL);
    00974
    00976   void getBInvRow(int row, double* z);
    00977
    00979   void getBInvACol(int col, double* vec);
    00980
    00982   void getBInvCol(int col, double* vec);
    00983
    00988   void getBasics(int* index);
    00989
    00991     //-------------------------------------------------------------------------
    00995        void setObjectiveCoefficient( int elementIndex, double elementValue );
    00997        inline void setObjCoeff( int elementIndex, double elementValue )
    00998        { setObjectiveCoefficient( elementIndex, elementValue);}
    00999
    01002        void setColumnLower( int elementIndex, double elementValue );
    01003
    01006        void setColumnUpper( int elementIndex, double elementValue );
    01007
    01009       void setColumnBounds( int elementIndex,
    01010         double lower, double upper );
    01011
    01020       void setColumnSetBounds(const int* indexFirst,
    01021                                    const int* indexLast,
    01022                                    const double* boundList);
    01023
    01026        inline void setColLower( int elementIndex, double elementValue )
    01027        { setColumnLower(elementIndex, elementValue);}
    01030        inline void setColUpper( int elementIndex, double elementValue )
    01031        { setColumnUpper(elementIndex, elementValue);}
    01032
    01034       inline void setColBounds( int elementIndex,
    01035         double lower, double upper )
    01036        { setColumnBounds(elementIndex, lower, upper);}
    01037
    01044       inline void setColSetBounds(const int* indexFirst,
    01045                                    const int* indexLast,
    01046                                    const double* boundList)
    01047       { setColumnSetBounds(indexFirst, indexLast, boundList);}
    01048
    01051       void setRowLower( int elementIndex, double elementValue );
    01052
    01055       void setRowUpper( int elementIndex, double elementValue ) ;
    01056
    01058       void setRowBounds( int elementIndex,
    01059                                  double lower, double upper ) ;
    01060
    01067       void setRowSetBounds(const int* indexFirst,
    01068                                    const int* indexLast,
    01069                                    const double* boundList);
    01070
    01072
    01074 protected:
    01075
    01082
    01083   double columnPrimalInfeasibility_;
    01085   double rowPrimalInfeasibility_;
    01087   int columnPrimalSequence_;
    01089   int rowPrimalSequence_;
    01091   double columnDualInfeasibility_;
    01093   double rowDualInfeasibility_;
    01095   int moreSpecialOptions_;
    01097   int rowDualSequence_;
    01099   double primalToleranceToGetOptimal_;
    01101   double remainingDualInfeasibility_;
    01103   double largeValue_;
    01105   double largestPrimalError_;
    01107   double largestDualError_;
    01109   double alphaAccuracy_;
    01111   double dualBound_;
    01113   double alpha_;
    01115   double theta_;
    01117   double lowerIn_;
    01119   double valueIn_;
    01121   double upperIn_;
    01123   double dualIn_;
    01125   double lowerOut_;
    01127   double valueOut_;
    01129   double upperOut_;
    01131   double dualOut_;
    01133   double dualTolerance_;
    01135   double primalTolerance_;
    01137   double sumDualInfeasibilities_;
    01139   double sumPrimalInfeasibilities_;
    01141   double infeasibilityCost_;
    01143   double sumOfRelaxedDualInfeasibilities_;
    01145   double sumOfRelaxedPrimalInfeasibilities_;
    01147   double acceptablePivot_;
    01149   double * lower_;
    01151   double * rowLowerWork_;
    01153   double * columnLowerWork_;
    01155   double * upper_;
    01157   double * rowUpperWork_;
    01159   double * columnUpperWork_;
    01161   double * cost_;
    01163   double * rowObjectiveWork_;
    01165   double * objectiveWork_;
    01167   CoinIndexedVector * rowArray_[6];
    01169   CoinIndexedVector * columnArray_[6];
    01171   int sequenceIn_;
    01173   int directionIn_;
    01175   int sequenceOut_;
    01177   int directionOut_;
    01179   int pivotRow_;
    01181   int lastGoodIteration_;
    01183   double * dj_;
    01185   double * rowReducedCost_;
    01187   double * reducedCostWork_;
    01189   double * solution_;
    01191   double * rowActivityWork_;
    01193   double * columnActivityWork_;
    01195   ClpSimplex * auxiliaryModel_;
    01197   int numberDualInfeasibilities_;
    01199   int numberDualInfeasibilitiesWithoutFree_;
    01201   int numberPrimalInfeasibilities_;
    01203   int numberRefinements_;
    01205   ClpDualRowPivot * dualRowPivot_;
    01207   ClpPrimalColumnPivot * primalColumnPivot_;
    01209   int * pivotVariable_;
    01211   ClpFactorization * factorization_;
    01213   double * savedSolution_;
    01215   int numberTimesOptimal_;
    01217   ClpDisasterHandler * disasterArea_;
    01219   int changeMade_;
    01221   int algorithm_;
    01224   int forceFactorization_;
    01232   int perturbation_;
    01234   unsigned char * saveStatus_;
    01239   ClpNonLinearCost * nonLinearCost_;
    01241   int lastBadIteration_;
    01243   int lastFlaggedIteration_;
    01245   int numberFake_;
    01247   int numberChanged_;
    01249   int progressFlag_;
    01251   int firstFree_;
    01255   int numberExtraRows_;
    01258   int maximumBasic_;
    01268   float incomingInfeasibility_;
    01269   float allowedInfeasibility_;
    01271   int automaticScale_;
    01273   ClpSimplexProgress * progress_;
    01274 public:
    01276   mutable int spareIntArray_[4];
    01278   mutable double spareDoubleArray_[4];
    01279 protected:
    01281   friend class OsiClpSolverInterface;
    01283 };
    01284 //#############################################################################
    01293 void
    01294 ClpSimplexUnitTest(const std::string & mpsDir);
    01295
    01296
    01298 class ClpSimplexProgress {
    01299
    01300 public:
    01301
    01302
    01305
    01306     ClpSimplexProgress (  );
    01307
    01309     ClpSimplexProgress ( ClpSimplex * model );
    01310
    01312   ClpSimplexProgress(const ClpSimplexProgress &);
    01313
    01315     ClpSimplexProgress & operator=(const ClpSimplexProgress & rhs);
    01317    ~ClpSimplexProgress (  );
    01319    void reset();
    01321
    01327     int looping (  );
    01329   void startCheck();
    01331   int cycle(int in, int out,int wayIn,int wayOut);
    01332
    01334   double lastObjective(int back=1) const;
    01336   void setInfeasibility(double value);
    01338   double lastInfeasibility(int back=1) const;
    01340   void modifyObjective(double value);
    01342   int lastIterationNumber(int back=1) const;
    01344   void clearIterationNumbers();
    01346   inline void newOddState()
    01347   { oddState_= - oddState_-1;}
    01348   inline void endOddState()
    01349   { oddState_=abs(oddState_);}
    01350   inline void clearOddState()
    01351   { oddState_=0;}
    01352   inline int oddState() const
    01353   { return oddState_;}
    01355   inline int badTimes() const
    01356   { return numberBadTimes_;}
    01357   inline void clearBadTimes()
    01358   { numberBadTimes_=0;}
    01359
    01361
    01362 #define CLP_PROGRESS 5
    01363   //#define CLP_PROGRESS_WEIGHT 10
    01365
    01366   double objective_[CLP_PROGRESS];
    01368   double infeasibility_[CLP_PROGRESS];
    01370   double realInfeasibility_[CLP_PROGRESS];
    01371 #ifdef CLP_PROGRESS_WEIGHT
    01373   double objectiveWeight_[CLP_PROGRESS_WEIGHT];
    01375   double infeasibilityWeight_[CLP_PROGRESS_WEIGHT];
    01377   double realInfeasibilityWeight_[CLP_PROGRESS_WEIGHT];
    01379   double drop_;
    01381   double best_;
    01382 #endif
    01384   double initialWeight_;
    01385 #define CLP_CYCLE 12
    01387   //double obj_[CLP_CYCLE];
    01388   int in_[CLP_CYCLE];
    01389   int out_[CLP_CYCLE];
    01390   char way_[CLP_CYCLE];
    01392   ClpSimplex * model_;
    01394   int numberInfeasibilities_[CLP_PROGRESS];
    01396   int iterationNumber_[CLP_PROGRESS];
    01397 #ifdef CLP_PROGRESS_WEIGHT
    01399   int numberInfeasibilitiesWeight_[CLP_PROGRESS_WEIGHT];
    01401   int iterationNumberWeight_[CLP_PROGRESS_WEIGHT];
    01402 #endif
    01404   int numberTimes_;
    01406   int numberBadTimes_;
    01408   int oddState_;
    01409
    01410 };
    01411 // For Devex stuff
    01412 #define DEVEX_TRY_NORM 1.0e-4
    01413 #define DEVEX_ADD_ONE 1.0
    01414 #endif