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

- File List
- File Members

# /home/coin/svn-release/Alps-1.4.5/Clp/src/ClpSimplex.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpSimplex.hpp 1928 2013-04-06 12:54:16Z stefan $ */
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005 /*
    00006    Authors
    00007
    00008    John Forrest
    00009
    00010  */
    00011 #ifndef ClpSimplex_H
    00012 #define ClpSimplex_H
    00013
    00014 #include <iostream>
    00015 #include <cfloat>
    00016 #include "ClpModel.hpp"
    00017 #include "ClpMatrixBase.hpp"
    00018 #include "ClpSolve.hpp"
    00019 #include "ClpConfig.h"
    00020 class ClpDualRowPivot;
    00021 class ClpPrimalColumnPivot;
    00022 class ClpFactorization;
    00023 class CoinIndexedVector;
    00024 class ClpNonLinearCost;
    00025 class ClpNodeStuff;
    00026 class CoinStructuredModel;
    00027 class OsiClpSolverInterface;
    00028 class CoinWarmStartBasis;
    00029 class ClpDisasterHandler;
    00030 class ClpConstraint;
    00031 #ifdef CLP_HAS_ABC
    00032 #include "AbcCommon.hpp"
    00033 class AbcTolerancesEtc;
    00034 class AbcSimplex;
    00035 #include "CoinAbcCommon.hpp"
    00036 #endif
    00037
    00055 class ClpSimplex : public ClpModel {
    00056      friend void ClpSimplexUnitTest(const std::string & mpsDir);
    00057
    00058 public:
    00063      enum Status {
    00064           isFree = 0x00,
    00065           basic = 0x01,
    00066           atUpperBound = 0x02,
    00067           atLowerBound = 0x03,
    00068           superBasic = 0x04,
    00069           isFixed = 0x05
    00070      };
    00071      // For Dual
    00072      enum FakeBound {
    00073           noFake = 0x00,
    00074           lowerFake = 0x01,
    00075           upperFake = 0x02,
    00076           bothFake = 0x03
    00077      };
    00078
    00081
    00082      ClpSimplex (bool emptyMessages = false  );
    00083
    00088      ClpSimplex(const ClpSimplex & rhs, int scalingMode = -1);
    00093      ClpSimplex(const ClpModel & rhs, int scalingMode = -1);
    00100      ClpSimplex (const ClpModel * wholeModel,
    00101                  int numberRows, const int * whichRows,
    00102                  int numberColumns, const int * whichColumns,
    00103                  bool dropNames = true, bool dropIntegers = true,
    00104                  bool fixOthers = false);
    00111      ClpSimplex (const ClpSimplex * wholeModel,
    00112                  int numberRows, const int * whichRows,
    00113                  int numberColumns, const int * whichColumns,
    00114                  bool dropNames = true, bool dropIntegers = true,
    00115                  bool fixOthers = false);
    00119      ClpSimplex (ClpSimplex * wholeModel,
    00120                  int numberColumns, const int * whichColumns);
    00123      void originalModel(ClpSimplex * miniModel);
    00124   inline int abcState() const
    00125   { return abcState_;}
    00126   inline void setAbcState(int state)
    00127   { abcState_=state;}
    00128 #ifdef ABC_INHERIT
    00129   inline AbcSimplex * abcSimplex() const
    00130   { return abcSimplex_;}
    00131   inline void setAbcSimplex(AbcSimplex * simplex)
    00132   { abcSimplex_=simplex;}
    00134   int doAbcDual();
    00136   int doAbcPrimal(int ifValuesPass);
    00137 #endif
    00138
    00143      void setPersistenceFlag(int value);
    00145      void makeBaseModel();
    00147      void deleteBaseModel();
    00149      inline ClpSimplex *  baseModel() const {
    00150           return baseModel_;
    00151      }
    00155      void setToBaseModel(ClpSimplex * model = NULL);
    00157      ClpSimplex & operator=(const ClpSimplex & rhs);
    00159      ~ClpSimplex (  );
    00160      // Ones below are just ClpModel with some changes
    00172      void loadProblem (  const ClpMatrixBase& matrix,
    00173                          const double* collb, const double* colub,
    00174                          const double* obj,
    00175                          const double* rowlb, const double* rowub,
    00176                          const double * rowObjective = NULL);
    00177      void loadProblem (  const CoinPackedMatrix& matrix,
    00178                          const double* collb, const double* colub,
    00179                          const double* obj,
    00180                          const double* rowlb, const double* rowub,
    00181                          const double * rowObjective = NULL);
    00182
    00185      void loadProblem (  const int numcols, const int numrows,
    00186                          const CoinBigIndex* start, const int* index,
    00187                          const double* value,
    00188                          const double* collb, const double* colub,
    00189                          const double* obj,
    00190                          const double* rowlb, const double* rowub,
    00191                          const double * rowObjective = NULL);
    00193      void loadProblem (  const int numcols, const int numrows,
    00194                          const CoinBigIndex* start, const int* index,
    00195                          const double* value, const int * length,
    00196                          const double* collb, const double* colub,
    00197                          const double* obj,
    00198                          const double* rowlb, const double* rowub,
    00199                          const double * rowObjective = NULL);
    00204      int loadProblem (  CoinModel & modelObject, bool keepSolution = false);
    00206      int readMps(const char *filename,
    00207                  bool keepNames = false,
    00208                  bool ignoreErrors = false);
    00210      int readGMPL(const char *filename, const char * dataName,
    00211                   bool keepNames = false);
    00214      int readLp(const char *filename, const double epsilon = 1e-5);
    00219      void borrowModel(ClpModel & otherModel);
    00220      void borrowModel(ClpSimplex & otherModel);
    00222      void passInEventHandler(const ClpEventHandler * eventHandler);
    00224      void getbackSolution(const ClpSimplex & smallModel, const int * whichRow, const int * whichColumn);
    00233      int loadNonLinear(void * info, int & numberConstraints,
    00234                        ClpConstraint ** & constraints);
    00235 #ifdef ABC_INHERIT
    00237   void loadTolerancesEtc(const AbcTolerancesEtc & data);
    00239   void unloadTolerancesEtc(AbcTolerancesEtc & data);
    00240 #endif
    00241
    00242
    00248      int initialSolve(ClpSolve & options);
    00250      int initialSolve();
    00252      int initialDualSolve();
    00254      int initialPrimalSolve();
    00256      int initialBarrierSolve();
    00258      int initialBarrierNoCrossSolve();
    00269      int dual(int ifValuesPass = 0, int startFinishOptions = 0);
    00270      // If using Debug
    00271      int dualDebug(int ifValuesPass = 0, int startFinishOptions = 0);
    00282      int primal(int ifValuesPass = 0, int startFinishOptions = 0);
    00288      int nonlinearSLP(int numberPasses, double deltaTolerance);
    00294      int nonlinearSLP(int numberConstraints, ClpConstraint ** constraints,
    00295                       int numberPasses, double deltaTolerance);
    00298      int barrier(bool crossover = true);
    00301      int reducedGradient(int phase = 0);
    00303      int solve(CoinStructuredModel * model);
    00304 #ifdef ABC_INHERIT
    00305
    00309   void dealWithAbc(int solveType,int startUp,bool interrupt=false);
    00310 #endif
    00311
    00317      int loadProblem (  CoinStructuredModel & modelObject,
    00318                         bool originalOrder = true, bool keepSolution = false);
    00333      int cleanup(int cleanupScaling);
    00354      int dualRanging(int numberCheck, const int * which,
    00355                      double * costIncrease, int * sequenceIncrease,
    00356                      double * costDecrease, int * sequenceDecrease,
    00357                      double * valueIncrease = NULL, double * valueDecrease = NULL);
    00372      int primalRanging(int numberCheck, const int * which,
    00373                        double * valueIncrease, int * sequenceIncrease,
    00374                        double * valueDecrease, int * sequenceDecrease);
    00384      int modifyCoefficientsAndPivot(int number,
    00385                                  const int * which,
    00386                                  const CoinBigIndex * start,
    00387                                  const int * row,
    00388                                  const double * newCoefficient,
    00389                                  const unsigned char * newStatus=NULL,
    00390                                  const double * newLower=NULL,
    00391                                  const double * newUpper=NULL,
    00392                                  const double * newObjective=NULL);
    00400      int outDuplicateRows(int numberLook,int * whichRows, bool noOverlaps=false, double tolerance=-1.0,
    00401                           double cleanUp=0.0);
    00404      double moveTowardsPrimalFeasible();
    00407      void removeSuperBasicSlacks(int threshold=0);
    00420      ClpSimplex * miniPresolve(char * rowType, char * columnType,void ** info);
    00422      void miniPostsolve(const ClpSimplex * presolvedModel,void * info);
    00437      int writeBasis(const char *filename,
    00438                     bool writeValues = false,
    00439                     int formatType = 0) const;
    00442      int readBasis(const char *filename);
    00444      CoinWarmStartBasis * getBasis() const;
    00446      void setFactorization( ClpFactorization & factorization);
    00447      // Swaps factorization
    00448      ClpFactorization * swapFactorization( ClpFactorization * factorization);
    00450      void copyFactorization( ClpFactorization & factorization);
    00460      int tightenPrimalBounds(double factor = 0.0, int doTight = 0, bool tightIntegers = false);
    00477      int crash(double gap, int pivot);
    00479      void setDualRowPivotAlgorithm(ClpDualRowPivot & choice);
    00481      void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot & choice);
    00490      int strongBranching(int numberVariables, const int * variables,
    00491                          double * newLower, double * newUpper,
    00492                          double ** outputSolution,
    00493                          int * outputStatus, int * outputIterations,
    00494                          bool stopOnFirstInfeasible = true,
    00495                          bool alwaysFinish = false,
    00496                          int startFinishOptions = 0);
    00498      int fathom(void * stuff);
    00504      int fathomMany(void * stuff);
    00506      double doubleCheck();
    00508      int startFastDual2(ClpNodeStuff * stuff);
    00510      int fastDual2(ClpNodeStuff * stuff);
    00512      void stopFastDual2(ClpNodeStuff * stuff);
    00519      ClpSimplex * fastCrunch(ClpNodeStuff * stuff, int mode);
    00521
    00529      int pivot();
    00530
    00536      int primalPivotResult();
    00537
    00543      int dualPivotResultPart1();
    00547   int pivotResultPart2(int algorithm,int state);
    00548
    00560      int startup(int ifValuesPass, int startFinishOptions = 0);
    00561      void finish(int startFinishOptions = 0);
    00562
    00564      bool statusOfProblem(bool initial = false);
    00566      void defaultFactorizationFrequency();
    00568      void copyEnabledStuff(const ClpSimplex * rhs);
    00570
    00573
    00574      inline bool primalFeasible() const {
    00575           return (numberPrimalInfeasibilities_ == 0);
    00576      }
    00578      inline bool dualFeasible() const {
    00579           return (numberDualInfeasibilities_ == 0);
    00580      }
    00582      inline ClpFactorization * factorization() const {
    00583           return factorization_;
    00584      }
    00586      bool sparseFactorization() const;
    00587      void setSparseFactorization(bool value);
    00589      int factorizationFrequency() const;
    00590      void setFactorizationFrequency(int value);
    00592      inline double dualBound() const {
    00593           return dualBound_;
    00594      }
    00595      void setDualBound(double value);
    00597      inline double infeasibilityCost() const {
    00598           return infeasibilityCost_;
    00599      }
    00600      void setInfeasibilityCost(double value);
    00617      inline int perturbation() const {
    00618           return perturbation_;
    00619      }
    00620      void setPerturbation(int value);
    00622      inline int algorithm() const {
    00623           return algorithm_;
    00624      }
    00626      inline void setAlgorithm(int value) {
    00627           algorithm_ = value;
    00628      }
    00630      bool isObjectiveLimitTestValid() const ;
    00632      inline double sumDualInfeasibilities() const {
    00633           return sumDualInfeasibilities_;
    00634      }
    00635      inline void setSumDualInfeasibilities(double value) {
    00636           sumDualInfeasibilities_ = value;
    00637      }
    00639      inline double sumOfRelaxedDualInfeasibilities() const {
    00640           return sumOfRelaxedDualInfeasibilities_;
    00641      }
    00642      inline void setSumOfRelaxedDualInfeasibilities(double value) {
    00643           sumOfRelaxedDualInfeasibilities_ = value;
    00644      }
    00646      inline int numberDualInfeasibilities() const {
    00647           return numberDualInfeasibilities_;
    00648      }
    00649      inline void setNumberDualInfeasibilities(int value) {
    00650           numberDualInfeasibilities_ = value;
    00651      }
    00653      inline int numberDualInfeasibilitiesWithoutFree() const {
    00654           return numberDualInfeasibilitiesWithoutFree_;
    00655      }
    00657      inline double sumPrimalInfeasibilities() const {
    00658           return sumPrimalInfeasibilities_;
    00659      }
    00660      inline void setSumPrimalInfeasibilities(double value) {
    00661           sumPrimalInfeasibilities_ = value;
    00662      }
    00664      inline double sumOfRelaxedPrimalInfeasibilities() const {
    00665           return sumOfRelaxedPrimalInfeasibilities_;
    00666      }
    00667      inline void setSumOfRelaxedPrimalInfeasibilities(double value) {
    00668           sumOfRelaxedPrimalInfeasibilities_ = value;
    00669      }
    00671      inline int numberPrimalInfeasibilities() const {
    00672           return numberPrimalInfeasibilities_;
    00673      }
    00674      inline void setNumberPrimalInfeasibilities(int value) {
    00675           numberPrimalInfeasibilities_ = value;
    00676      }
    00683      int saveModel(const char * fileName);
    00686      int restoreModel(const char * fileName);
    00687
    00695      void checkSolution(int setToBounds = 0);
    00698      void checkSolutionInternal();
    00700      void checkUnscaledSolution();
    00702      inline CoinIndexedVector * rowArray(int index) const {
    00703           return rowArray_[index];
    00704      }
    00706      inline CoinIndexedVector * columnArray(int index) const {
    00707           return columnArray_[index];
    00708      }
    00710
    00711      /******************** End of most useful part **************/
    00717      int getSolution (  const double * rowActivities,
    00718                         const double * columnActivities);
    00722      int getSolution ();
    00729      int createPiecewiseLinearCosts(const int * starts,
    00730                                     const double * lower, const double * gradient);
    00732      inline ClpDualRowPivot * dualRowPivot() const {
    00733           return dualRowPivot_;
    00734      }
    00736      inline ClpPrimalColumnPivot * primalColumnPivot() const {
    00737           return primalColumnPivot_;
    00738      }
    00740      inline bool goodAccuracy() const {
    00741           return (largestPrimalError_ < 1.0e-7 && largestDualError_ < 1.0e-7);
    00742      }
    00744      void returnModel(ClpSimplex & otherModel);
    00752      int internalFactorize(int solveType);
    00754      ClpDataSave saveData() ;
    00756      void restoreData(ClpDataSave saved);
    00758      void cleanStatus();
    00760      int factorize();
    00763      void computeDuals(double * givenDjs);
    00765      void computePrimals (  const double * rowActivities,
    00766                             const double * columnActivities);
    00768      void add(double * array,
    00769               int column, double multiplier) const;
    00775      void unpack(CoinIndexedVector * rowArray) const ;
    00781      void unpack(CoinIndexedVector * rowArray, int sequence) const;
    00788      void unpackPacked(CoinIndexedVector * rowArray) ;
    00795      void unpackPacked(CoinIndexedVector * rowArray, int sequence);
    00796 #ifndef CLP_USER_DRIVEN
    00797 protected:
    00798 #endif
    00799
    00803      int housekeeping(double objectiveChange);
    00806      void checkPrimalSolution(const double * rowActivities = NULL,
    00807                               const double * columnActivies = NULL);
    00810      void checkDualSolution();
    00812      void checkBothSolutions();
    00817      double scaleObjective(double value);
    00819      int solveDW(CoinStructuredModel * model);
    00821      int solveBenders(CoinStructuredModel * model);
    00822 public:
    00833      void setValuesPassAction(double incomingInfeasibility,
    00834                               double allowedInfeasibility);
    00837      int cleanFactorization(int ifValuesPass);
    00839
    00841 public:
    00843      inline double alphaAccuracy() const {
    00844           return alphaAccuracy_;
    00845      }
    00846      inline void setAlphaAccuracy(double value) {
    00847           alphaAccuracy_ = value;
    00848      }
    00849 public:
    00851      //inline double objectiveValue() const {
    00852      //return (objectiveValue_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset];
    00853      //}
    00855      inline void setDisasterHandler(ClpDisasterHandler * handler) {
    00856           disasterArea_ = handler;
    00857      }
    00859      inline ClpDisasterHandler * disasterHandler() const {
    00860           return disasterArea_;
    00861      }
    00863      inline double largeValue() const {
    00864           return largeValue_;
    00865      }
    00866      void setLargeValue( double value) ;
    00868      inline double largestPrimalError() const {
    00869           return largestPrimalError_;
    00870      }
    00872      inline double largestDualError() const {
    00873           return largestDualError_;
    00874      }
    00876      inline void setLargestPrimalError(double value) {
    00877           largestPrimalError_ = value;
    00878      }
    00880      inline void setLargestDualError(double value) {
    00881           largestDualError_ = value;
    00882      }
    00884      inline double zeroTolerance() const {
    00885           return zeroTolerance_;/*factorization_->zeroTolerance();*/
    00886      }
    00888      inline void setZeroTolerance( double value) {
    00889           zeroTolerance_ = value;
    00890      }
    00892      inline int * pivotVariable() const {
    00893           return pivotVariable_;
    00894      }
    00896      inline bool automaticScaling() const {
    00897           return automaticScale_ != 0;
    00898      }
    00899      inline void setAutomaticScaling(bool onOff) {
    00900           automaticScale_ = onOff ? 1 : 0;
    00901      }
    00903      inline double currentDualTolerance() const {
    00904           return dualTolerance_;
    00905      }
    00906      inline void setCurrentDualTolerance(double value) {
    00907           dualTolerance_ = value;
    00908      }
    00910      inline double currentPrimalTolerance() const {
    00911           return primalTolerance_;
    00912      }
    00913      inline void setCurrentPrimalTolerance(double value) {
    00914           primalTolerance_ = value;
    00915      }
    00917      inline int numberRefinements() const {
    00918           return numberRefinements_;
    00919      }
    00920      void setNumberRefinements( int value) ;
    00922      inline double alpha() const {
    00923           return alpha_;
    00924      }
    00925      inline void setAlpha(double value) {
    00926           alpha_ = value;
    00927      }
    00929      inline double dualIn() const {
    00930           return dualIn_;
    00931      }
    00933      inline void setDualIn(double value) {
    00934           dualIn_ = value;
    00935      }
    00937      inline int pivotRow() const {
    00938           return pivotRow_;
    00939      }
    00940      inline void setPivotRow(int value) {
    00941           pivotRow_ = value;
    00942      }
    00944      double valueIncomingDual() const;
    00946
    00947 #ifndef CLP_USER_DRIVEN
    00948 protected:
    00949 #endif
    00950
    00955      int gutsOfSolution ( double * givenDuals,
    00956                           const double * givenPrimals,
    00957                           bool valuesPass = false);
    00959      void gutsOfDelete(int type);
    00961      void gutsOfCopy(const ClpSimplex & rhs);
    00973      bool createRim(int what, bool makeRowCopy = false, int startFinishOptions = 0);
    00975      void createRim1(bool initial);
    00977      void createRim4(bool initial);
    00979      void createRim5(bool initial);
    00984      void deleteRim(int getRidOfFactorizationData = 2);
    00986      bool sanityCheck();
    00988 public:
    00993      inline double * solutionRegion(int section) const {
    00994           if (!section) return rowActivityWork_;
    00995           else return columnActivityWork_;
    00996      }
    00997      inline double * djRegion(int section) const {
    00998           if (!section) return rowReducedCost_;
    00999           else return reducedCostWork_;
    01000      }
    01001      inline double * lowerRegion(int section) const {
    01002           if (!section) return rowLowerWork_;
    01003           else return columnLowerWork_;
    01004      }
    01005      inline double * upperRegion(int section) const {
    01006           if (!section) return rowUpperWork_;
    01007           else return columnUpperWork_;
    01008      }
    01009      inline double * costRegion(int section) const {
    01010           if (!section) return rowObjectiveWork_;
    01011           else return objectiveWork_;
    01012      }
    01014      inline double * solutionRegion() const {
    01015           return solution_;
    01016      }
    01017      inline double * djRegion() const {
    01018           return dj_;
    01019      }
    01020      inline double * lowerRegion() const {
    01021           return lower_;
    01022      }
    01023      inline double * upperRegion() const {
    01024           return upper_;
    01025      }
    01026      inline double * costRegion() const {
    01027           return cost_;
    01028      }
    01029      inline Status getStatus(int sequence) const {
    01030           return static_cast<Status> (status_[sequence] & 7);
    01031      }
    01032      inline void setStatus(int sequence, Status newstatus) {
    01033           unsigned char & st_byte = status_[sequence];
    01034           st_byte = static_cast<unsigned char>(st_byte & ~7);
    01035           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    01036      }
    01038      bool startPermanentArrays();
    01043      void setInitialDenseFactorization(bool onOff);
    01044      bool  initialDenseFactorization() const;
    01046      inline int sequenceIn() const {
    01047           return sequenceIn_;
    01048      }
    01049      inline int sequenceOut() const {
    01050           return sequenceOut_;
    01051      }
    01053      inline void  setSequenceIn(int sequence) {
    01054           sequenceIn_ = sequence;
    01055      }
    01056      inline void  setSequenceOut(int sequence) {
    01057           sequenceOut_ = sequence;
    01058      }
    01060      inline int directionIn() const {
    01061           return directionIn_;
    01062      }
    01063      inline int directionOut() const {
    01064           return directionOut_;
    01065      }
    01067      inline void  setDirectionIn(int direction) {
    01068           directionIn_ = direction;
    01069      }
    01070      inline void  setDirectionOut(int direction) {
    01071           directionOut_ = direction;
    01072      }
    01074      inline double valueOut() const {
    01075           return valueOut_;
    01076      }
    01078      inline void setValueOut(double value) {
    01079           valueOut_ = value;
    01080      }
    01082      inline double dualOut() const {
    01083           return dualOut_;
    01084      }
    01086      inline void setDualOut(double value) {
    01087           dualOut_ = value;
    01088      }
    01090      inline void setLowerOut(double value) {
    01091           lowerOut_ = value;
    01092      }
    01094      inline void setUpperOut(double value) {
    01095           upperOut_ = value;
    01096      }
    01098      inline void setTheta(double value) {
    01099           theta_ = value;
    01100      }
    01102      inline int isColumn(int sequence) const {
    01103           return sequence < numberColumns_ ? 1 : 0;
    01104      }
    01106      inline int sequenceWithin(int sequence) const {
    01107           return sequence < numberColumns_ ? sequence : sequence - numberColumns_;
    01108      }
    01110      inline double solution(int sequence) {
    01111           return solution_[sequence];
    01112      }
    01114      inline double & solutionAddress(int sequence) {
    01115           return solution_[sequence];
    01116      }
    01117      inline double reducedCost(int sequence) {
    01118           return dj_[sequence];
    01119      }
    01120      inline double & reducedCostAddress(int sequence) {
    01121           return dj_[sequence];
    01122      }
    01123      inline double lower(int sequence) {
    01124           return lower_[sequence];
    01125      }
    01127      inline double & lowerAddress(int sequence) {
    01128           return lower_[sequence];
    01129      }
    01130      inline double upper(int sequence) {
    01131           return upper_[sequence];
    01132      }
    01134      inline double & upperAddress(int sequence) {
    01135           return upper_[sequence];
    01136      }
    01137      inline double cost(int sequence) {
    01138           return cost_[sequence];
    01139      }
    01141      inline double & costAddress(int sequence) {
    01142           return cost_[sequence];
    01143      }
    01145      inline double originalLower(int iSequence) const {
    01146           if (iSequence < numberColumns_) return columnLower_[iSequence];
    01147           else
    01148                return rowLower_[iSequence-numberColumns_];
    01149      }
    01151      inline double originalUpper(int iSequence) const {
    01152           if (iSequence < numberColumns_) return columnUpper_[iSequence];
    01153           else
    01154                return rowUpper_[iSequence-numberColumns_];
    01155      }
    01157      inline double theta() const {
    01158           return theta_;
    01159      }
    01162      inline double bestPossibleImprovement() const {
    01163           return bestPossibleImprovement_;
    01164      }
    01166      inline ClpNonLinearCost * nonLinearCost() const {
    01167           return nonLinearCost_;
    01168      }
    01189      inline int moreSpecialOptions() const {
    01190           return moreSpecialOptions_;
    01191      }
    01209      inline void setMoreSpecialOptions(int value) {
    01210           moreSpecialOptions_ = value;
    01211      }
    01213
    01215      inline void setFakeBound(int sequence, FakeBound fakeBound) {
    01216           unsigned char & st_byte = status_[sequence];
    01217           st_byte = static_cast<unsigned char>(st_byte & ~24);
    01218           st_byte = static_cast<unsigned char>(st_byte | (fakeBound << 3));
    01219      }
    01220      inline FakeBound getFakeBound(int sequence) const {
    01221           return static_cast<FakeBound> ((status_[sequence] >> 3) & 3);
    01222      }
    01223      inline void setRowStatus(int sequence, Status newstatus) {
    01224           unsigned char & st_byte = status_[sequence+numberColumns_];
    01225           st_byte = static_cast<unsigned char>(st_byte & ~7);
    01226           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    01227      }
    01228      inline Status getRowStatus(int sequence) const {
    01229           return static_cast<Status> (status_[sequence+numberColumns_] & 7);
    01230      }
    01231      inline void setColumnStatus(int sequence, Status newstatus) {
    01232           unsigned char & st_byte = status_[sequence];
    01233           st_byte = static_cast<unsigned char>(st_byte & ~7);
    01234           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    01235      }
    01236      inline Status getColumnStatus(int sequence) const {
    01237           return static_cast<Status> (status_[sequence] & 7);
    01238      }
    01239      inline void setPivoted( int sequence) {
    01240           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 32);
    01241      }
    01242      inline void clearPivoted( int sequence) {
    01243           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~32);
    01244      }
    01245      inline bool pivoted(int sequence) const {
    01246           return (((status_[sequence] >> 5) & 1) != 0);
    01247      }
    01249      void setFlagged( int sequence);
    01250      inline void clearFlagged( int sequence) {
    01251           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~64);
    01252      }
    01253      inline bool flagged(int sequence) const {
    01254           return ((status_[sequence] & 64) != 0);
    01255      }
    01257      inline void setActive( int iRow) {
    01258           status_[iRow] = static_cast<unsigned char>(status_[iRow] | 128);
    01259      }
    01260      inline void clearActive( int iRow) {
    01261           status_[iRow] = static_cast<unsigned char>(status_[iRow] & ~128);
    01262      }
    01263      inline bool active(int iRow) const {
    01264           return ((status_[iRow] & 128) != 0);
    01265      }
    01268      void createStatus() ;
    01271      void allSlackBasis(bool resetSolution = false);
    01272
    01274      inline int lastBadIteration() const {
    01275           return lastBadIteration_;
    01276      }
    01278      inline void setLastBadIteration(int value) {
    01279           lastBadIteration_=value;
    01280      }
    01282      inline int progressFlag() const {
    01283           return (progressFlag_ & 3);
    01284      }
    01286      inline ClpSimplexProgress * progress()
    01287      { return &progress_;}
    01289      inline int forceFactorization() const {
    01290           return forceFactorization_ ;
    01291      }
    01293      inline void forceFactorization(int value) {
    01294           forceFactorization_ = value;
    01295      }
    01297      inline double rawObjectiveValue() const {
    01298           return objectiveValue_;
    01299      }
    01301      void computeObjectiveValue(bool useWorkingSolution = false);
    01303      double computeInternalObjectiveValue();
    01306      double * infeasibilityRay(bool fullRay=false) const;
    01310      inline int numberExtraRows() const {
    01311           return numberExtraRows_;
    01312      }
    01315      inline int maximumBasic() const {
    01316           return maximumBasic_;
    01317      }
    01319      inline int baseIteration() const {
    01320           return baseIteration_;
    01321      }
    01323      void generateCpp( FILE * fp, bool defaultFactor = false);
    01325      ClpFactorization * getEmptyFactorization();
    01327      void setEmptyFactorization();
    01329      void moveInfo(const ClpSimplex & rhs, bool justStatus = false);
    01331
    01333      // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
    01334      // *** At present only without scaling
    01335      // *** Slacks havve -1.0 element (so == row activity) - take care
    01337      void getBInvARow(int row, double* z, double * slack = NULL);
    01338
    01340      void getBInvRow(int row, double* z);
    01341
    01343      void getBInvACol(int col, double* vec);
    01344
    01346      void getBInvCol(int col, double* vec);
    01347
    01352      void getBasics(int* index);
    01353
    01355      //-------------------------------------------------------------------------
    01359      void setObjectiveCoefficient( int elementIndex, double elementValue );
    01361      inline void setObjCoeff( int elementIndex, double elementValue ) {
    01362           setObjectiveCoefficient( elementIndex, elementValue);
    01363      }
    01364
    01367      void setColumnLower( int elementIndex, double elementValue );
    01368
    01371      void setColumnUpper( int elementIndex, double elementValue );
    01372
    01374      void setColumnBounds( int elementIndex,
    01375                            double lower, double upper );
    01376
    01385      void setColumnSetBounds(const int* indexFirst,
    01386                              const int* indexLast,
    01387                              const double* boundList);
    01388
    01391      inline void setColLower( int elementIndex, double elementValue ) {
    01392           setColumnLower(elementIndex, elementValue);
    01393      }
    01396      inline void setColUpper( int elementIndex, double elementValue ) {
    01397           setColumnUpper(elementIndex, elementValue);
    01398      }
    01399
    01401      inline void setColBounds( int elementIndex,
    01402                                double newlower, double newupper ) {
    01403           setColumnBounds(elementIndex, newlower, newupper);
    01404      }
    01405
    01412      inline void setColSetBounds(const int* indexFirst,
    01413                                  const int* indexLast,
    01414                                  const double* boundList) {
    01415           setColumnSetBounds(indexFirst, indexLast, boundList);
    01416      }
    01417
    01420      void setRowLower( int elementIndex, double elementValue );
    01421
    01424      void setRowUpper( int elementIndex, double elementValue ) ;
    01425
    01427      void setRowBounds( int elementIndex,
    01428                         double lower, double upper ) ;
    01429
    01436      void setRowSetBounds(const int* indexFirst,
    01437                           const int* indexLast,
    01438                           const double* boundList);
    01440      void resize (int newNumberRows, int newNumberColumns);
    01441
    01443
    01445 protected:
    01446
    01455      double bestPossibleImprovement_;
    01457      double zeroTolerance_;
    01459      int columnPrimalSequence_;
    01461      int rowPrimalSequence_;
    01463      double bestObjectiveValue_;
    01465      int moreSpecialOptions_;
    01467      int baseIteration_;
    01469      double primalToleranceToGetOptimal_;
    01471      double largeValue_;
    01473      double largestPrimalError_;
    01475      double largestDualError_;
    01477      double alphaAccuracy_;
    01479      double dualBound_;
    01481      double alpha_;
    01483      double theta_;
    01485      double lowerIn_;
    01487      double valueIn_;
    01489      double upperIn_;
    01491      double dualIn_;
    01493      double lowerOut_;
    01495      double valueOut_;
    01497      double upperOut_;
    01499      double dualOut_;
    01501      double dualTolerance_;
    01503      double primalTolerance_;
    01505      double sumDualInfeasibilities_;
    01507      double sumPrimalInfeasibilities_;
    01509      double infeasibilityCost_;
    01511      double sumOfRelaxedDualInfeasibilities_;
    01513      double sumOfRelaxedPrimalInfeasibilities_;
    01515      double acceptablePivot_;
    01517      double * lower_;
    01519      double * rowLowerWork_;
    01521      double * columnLowerWork_;
    01523      double * upper_;
    01525      double * rowUpperWork_;
    01527      double * columnUpperWork_;
    01529      double * cost_;
    01531      double * rowObjectiveWork_;
    01533      double * objectiveWork_;
    01535      CoinIndexedVector * rowArray_[6];
    01537      CoinIndexedVector * columnArray_[6];
    01539      int sequenceIn_;
    01541      int directionIn_;
    01543      int sequenceOut_;
    01545      int directionOut_;
    01547      int pivotRow_;
    01549      int lastGoodIteration_;
    01551      double * dj_;
    01553      double * rowReducedCost_;
    01555      double * reducedCostWork_;
    01557      double * solution_;
    01559      double * rowActivityWork_;
    01561      double * columnActivityWork_;
    01563      int numberDualInfeasibilities_;
    01565      int numberDualInfeasibilitiesWithoutFree_;
    01567      int numberPrimalInfeasibilities_;
    01569      int numberRefinements_;
    01571      ClpDualRowPivot * dualRowPivot_;
    01573      ClpPrimalColumnPivot * primalColumnPivot_;
    01575      int * pivotVariable_;
    01577      ClpFactorization * factorization_;
    01579      double * savedSolution_;
    01581      int numberTimesOptimal_;
    01583      ClpDisasterHandler * disasterArea_;
    01585      int changeMade_;
    01587      int algorithm_;
    01590      int forceFactorization_;
    01598      int perturbation_;
    01600      unsigned char * saveStatus_;
    01605      ClpNonLinearCost * nonLinearCost_;
    01607      int lastBadIteration_;
    01609      int lastFlaggedIteration_;
    01611      int numberFake_;
    01613      int numberChanged_;
    01615      int progressFlag_;
    01617      int firstFree_;
    01621      int numberExtraRows_;
    01624      int maximumBasic_;
    01626      int dontFactorizePivots_;
    01636      double incomingInfeasibility_;
    01637      double allowedInfeasibility_;
    01639      int automaticScale_;
    01641      int maximumPerturbationSize_;
    01643      double * perturbationArray_;
    01645      ClpSimplex * baseModel_;
    01647      ClpSimplexProgress progress_;
    01648 #ifdef ABC_INHERIT
    01649   AbcSimplex * abcSimplex_;
    01650 #define CLP_ABC_WANTED 1
    01651 #define CLP_ABC_WANTED_PARALLEL 2
    01652 #define CLP_ABC_FULL_DONE 8
    01653   // bits 256,512,1024 for crash
    01654 #endif
    01655 #define CLP_ABC_BEEN_FEASIBLE 65536
    01656   int abcState_;
    01657 public:
    01659      mutable int spareIntArray_[4];
    01661      mutable double spareDoubleArray_[4];
    01662 protected:
    01664      friend class OsiClpSolverInterface;
    01666 };
    01667 //#############################################################################
    01676 void
    01677 ClpSimplexUnitTest(const std::string & mpsDir);
    01678
    01679 // For Devex stuff
    01680 #define DEVEX_TRY_NORM 1.0e-4
    01681 #define DEVEX_ADD_ONE 1.0
    01682 #endif