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

- File List
- File Members

# /home/coin/SVN-release/Alps-1.2.1/Clp/src/ClpSimplex.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpSimplex.hpp 1551 2010-05-24 23:34:44Z mjs $ */
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004
    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 class ClpDualRowPivot;
    00020 class ClpPrimalColumnPivot;
    00021 class ClpFactorization;
    00022 class CoinIndexedVector;
    00023 class ClpNonLinearCost;
    00024 class ClpNodeStuff;
    00025 class CoinStructuredModel;
    00026 class OsiClpSolverInterface;
    00027 class CoinWarmStartBasis;
    00028 class ClpDisasterHandler;
    00029 class ClpConstraint;
    00030
    00049 class ClpSimplex : public ClpModel {
    00050      friend void ClpSimplexUnitTest(const std::string & mpsDir);
    00051
    00052 public:
    00057      enum Status {
    00058           isFree = 0x00,
    00059           basic = 0x01,
    00060           atUpperBound = 0x02,
    00061           atLowerBound = 0x03,
    00062           superBasic = 0x04,
    00063           isFixed = 0x05
    00064      };
    00065      // For Dual
    00066      enum FakeBound {
    00067           noFake = 0x00,
    00068           lowerFake = 0x01,
    00069           upperFake = 0x02,
    00070           bothFake = 0x03
    00071      };
    00072
    00075
    00076      ClpSimplex (bool emptyMessages = false  );
    00077
    00082      ClpSimplex(const ClpSimplex & rhs, int scalingMode = -1);
    00087      ClpSimplex(const ClpModel & rhs, int scalingMode = -1);
    00094      ClpSimplex (const ClpModel * wholeModel,
    00095                  int numberRows, const int * whichRows,
    00096                  int numberColumns, const int * whichColumns,
    00097                  bool dropNames = true, bool dropIntegers = true,
    00098                  bool fixOthers = false);
    00105      ClpSimplex (const ClpSimplex * wholeModel,
    00106                  int numberRows, const int * whichRows,
    00107                  int numberColumns, const int * whichColumns,
    00108                  bool dropNames = true, bool dropIntegers = true,
    00109                  bool fixOthers = false);
    00113      ClpSimplex (ClpSimplex * wholeModel,
    00114                  int numberColumns, const int * whichColumns);
    00117      void originalModel(ClpSimplex * miniModel);
    00123      void setPersistenceFlag(int value);
    00125      void makeBaseModel();
    00127      void deleteBaseModel();
    00129      inline ClpSimplex *  baseModel() const {
    00130           return baseModel_;
    00131      }
    00135      void setToBaseModel(ClpSimplex * model = NULL);
    00137      ClpSimplex & operator=(const ClpSimplex & rhs);
    00139      ~ClpSimplex (  );
    00140      // Ones below are just ClpModel with some changes
    00152      void loadProblem (  const ClpMatrixBase& matrix,
    00153                          const double* collb, const double* colub,
    00154                          const double* obj,
    00155                          const double* rowlb, const double* rowub,
    00156                          const double * rowObjective = NULL);
    00157      void loadProblem (  const CoinPackedMatrix& matrix,
    00158                          const double* collb, const double* colub,
    00159                          const double* obj,
    00160                          const double* rowlb, const double* rowub,
    00161                          const double * rowObjective = NULL);
    00162
    00165      void loadProblem (  const int numcols, const int numrows,
    00166                          const CoinBigIndex* start, const int* index,
    00167                          const double* value,
    00168                          const double* collb, const double* colub,
    00169                          const double* obj,
    00170                          const double* rowlb, const double* rowub,
    00171                          const double * rowObjective = NULL);
    00173      void loadProblem (  const int numcols, const int numrows,
    00174                          const CoinBigIndex* start, const int* index,
    00175                          const double* value, const int * length,
    00176                          const double* collb, const double* colub,
    00177                          const double* obj,
    00178                          const double* rowlb, const double* rowub,
    00179                          const double * rowObjective = NULL);
    00184      int loadProblem (  CoinModel & modelObject, bool keepSolution = false);
    00186      int readMps(const char *filename,
    00187                  bool keepNames = false,
    00188                  bool ignoreErrors = false);
    00190      int readGMPL(const char *filename, const char * dataName,
    00191                   bool keepNames = false);
    00194      int readLp(const char *filename, const double epsilon = 1e-5);
    00199      void borrowModel(ClpModel & otherModel);
    00200      void borrowModel(ClpSimplex & otherModel);
    00202      void passInEventHandler(const ClpEventHandler * eventHandler);
    00204      void getbackSolution(const ClpSimplex & smallModel, const int * whichRow, const int * whichColumn);
    00213      int loadNonLinear(void * info, int & numberConstraints,
    00214                        ClpConstraint ** & constraints);
    00216
    00222      int initialSolve(ClpSolve & options);
    00224      int initialSolve();
    00226      int initialDualSolve();
    00228      int initialPrimalSolve();
    00230      int initialBarrierSolve();
    00232      int initialBarrierNoCrossSolve();
    00243      int dual(int ifValuesPass = 0, int startFinishOptions = 0);
    00244      // If using Debug
    00245      int dualDebug(int ifValuesPass = 0, int startFinishOptions = 0);
    00256      int primal(int ifValuesPass = 0, int startFinishOptions = 0);
    00262      int nonlinearSLP(int numberPasses, double deltaTolerance);
    00268      int nonlinearSLP(int numberConstraints, ClpConstraint ** constraints,
    00269                       int numberPasses, double deltaTolerance);
    00272      int barrier(bool crossover = true);
    00275      int reducedGradient(int phase = 0);
    00277      int solve(CoinStructuredModel * model);
    00284      int loadProblem (  CoinStructuredModel & modelObject,
    00285                         bool originalOrder = true, bool keepSolution = false);
    00300      int cleanup(int cleanupScaling);
    00321      int dualRanging(int numberCheck, const int * which,
    00322                      double * costIncrease, int * sequenceIncrease,
    00323                      double * costDecrease, int * sequenceDecrease,
    00324                      double * valueIncrease = NULL, double * valueDecrease = NULL);
    00339      int primalRanging(int numberCheck, const int * which,
    00340                        double * valueIncrease, int * sequenceIncrease,
    00341                        double * valueDecrease, int * sequenceDecrease);
    00356      int writeBasis(const char *filename,
    00357                     bool writeValues = false,
    00358                     int formatType = 0) const;
    00361      int readBasis(const char *filename);
    00363      CoinWarmStartBasis * getBasis() const;
    00365      void setFactorization( ClpFactorization & factorization);
    00366      // Swaps factorization
    00367      ClpFactorization * swapFactorization( ClpFactorization * factorization);
    00369      void copyFactorization( ClpFactorization & factorization);
    00379      int tightenPrimalBounds(double factor = 0.0, int doTight = 0, bool tightIntegers = false);
    00396      int crash(double gap, int pivot);
    00398      void setDualRowPivotAlgorithm(ClpDualRowPivot & choice);
    00400      void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot & choice);
    00409      int strongBranching(int numberVariables, const int * variables,
    00410                          double * newLower, double * newUpper,
    00411                          double ** outputSolution,
    00412                          int * outputStatus, int * outputIterations,
    00413                          bool stopOnFirstInfeasible = true,
    00414                          bool alwaysFinish = false,
    00415                          int startFinishOptions = 0);
    00417      int fathom(void * stuff);
    00423      int fathomMany(void * stuff);
    00425      double doubleCheck();
    00427      int startFastDual2(ClpNodeStuff * stuff);
    00429      int fastDual2(ClpNodeStuff * stuff);
    00431      void stopFastDual2(ClpNodeStuff * stuff);
    00438      ClpSimplex * fastCrunch(ClpNodeStuff * stuff, int mode);
    00440
    00448      int pivot();
    00449
    00455      int primalPivotResult();
    00456
    00463      int dualPivotResult();
    00464
    00476      int startup(int ifValuesPass, int startFinishOptions = 0);
    00477      void finish(int startFinishOptions = 0);
    00478
    00480      bool statusOfProblem(bool initial = false);
    00482      void defaultFactorizationFrequency();
    00484
    00487
    00488      inline bool primalFeasible() const {
    00489           return (numberPrimalInfeasibilities_ == 0);
    00490      }
    00492      inline bool dualFeasible() const {
    00493           return (numberDualInfeasibilities_ == 0);
    00494      }
    00496      inline ClpFactorization * factorization() const {
    00497           return factorization_;
    00498      }
    00500      bool sparseFactorization() const;
    00501      void setSparseFactorization(bool value);
    00503      int factorizationFrequency() const;
    00504      void setFactorizationFrequency(int value);
    00506      inline double dualBound() const {
    00507           return dualBound_;
    00508      }
    00509      void setDualBound(double value);
    00511      inline double infeasibilityCost() const {
    00512           return infeasibilityCost_;
    00513      }
    00514      void setInfeasibilityCost(double value);
    00531      inline int perturbation() const {
    00532           return perturbation_;
    00533      }
    00534      void setPerturbation(int value);
    00536      inline int algorithm() const {
    00537           return algorithm_;
    00538      }
    00540      inline void setAlgorithm(int value) {
    00541           algorithm_ = value;
    00542      }
    00544      bool isObjectiveLimitTestValid() const ;
    00546      inline double sumDualInfeasibilities() const {
    00547           return sumDualInfeasibilities_;
    00548      }
    00549      inline void setSumDualInfeasibilities(double value) {
    00550           sumDualInfeasibilities_ = value;
    00551      }
    00553      inline double sumOfRelaxedDualInfeasibilities() const {
    00554           return sumOfRelaxedDualInfeasibilities_;
    00555      }
    00556      inline void setSumOfRelaxedDualInfeasibilities(double value) {
    00557           sumOfRelaxedDualInfeasibilities_ = value;
    00558      }
    00560      inline int numberDualInfeasibilities() const {
    00561           return numberDualInfeasibilities_;
    00562      }
    00563      inline void setNumberDualInfeasibilities(int value) {
    00564           numberDualInfeasibilities_ = value;
    00565      }
    00567      inline int numberDualInfeasibilitiesWithoutFree() const {
    00568           return numberDualInfeasibilitiesWithoutFree_;
    00569      }
    00571      inline double sumPrimalInfeasibilities() const {
    00572           return sumPrimalInfeasibilities_;
    00573      }
    00574      inline void setSumPrimalInfeasibilities(double value) {
    00575           sumPrimalInfeasibilities_ = value;
    00576      }
    00578      inline double sumOfRelaxedPrimalInfeasibilities() const {
    00579           return sumOfRelaxedPrimalInfeasibilities_;
    00580      }
    00581      inline void setSumOfRelaxedPrimalInfeasibilities(double value) {
    00582           sumOfRelaxedPrimalInfeasibilities_ = value;
    00583      }
    00585      inline int numberPrimalInfeasibilities() const {
    00586           return numberPrimalInfeasibilities_;
    00587      }
    00588      inline void setNumberPrimalInfeasibilities(int value) {
    00589           numberPrimalInfeasibilities_ = value;
    00590      }
    00597      int saveModel(const char * fileName);
    00600      int restoreModel(const char * fileName);
    00601
    00609      void checkSolution(int setToBounds = 0);
    00612      void checkSolutionInternal();
    00614      inline CoinIndexedVector * rowArray(int index) const {
    00615           return rowArray_[index];
    00616      }
    00618      inline CoinIndexedVector * columnArray(int index) const {
    00619           return columnArray_[index];
    00620      }
    00622
    00623      /******************** End of most useful part **************/
    00629      int getSolution (  const double * rowActivities,
    00630                         const double * columnActivities);
    00634      int getSolution ();
    00641      int createPiecewiseLinearCosts(const int * starts,
    00642                                     const double * lower, const double * gradient);
    00644      inline ClpDualRowPivot * dualRowPivot() const {
    00645           return dualRowPivot_;
    00646      }
    00648      inline ClpPrimalColumnPivot * primalColumnPivot() const {
    00649           return primalColumnPivot_;
    00650      }
    00652      inline bool goodAccuracy() const {
    00653           return (largestPrimalError_ < 1.0e-7 && largestDualError_ < 1.0e-7);
    00654      }
    00656      void returnModel(ClpSimplex & otherModel);
    00664      int internalFactorize(int solveType);
    00666      ClpDataSave saveData() ;
    00668      void restoreData(ClpDataSave saved);
    00670      void cleanStatus();
    00672      int factorize();
    00675      void computeDuals(double * givenDjs);
    00677      void computePrimals (  const double * rowActivities,
    00678                             const double * columnActivities);
    00680      void add(double * array,
    00681               int column, double multiplier) const;
    00687      void unpack(CoinIndexedVector * rowArray) const ;
    00693      void unpack(CoinIndexedVector * rowArray, int sequence) const;
    00700      void unpackPacked(CoinIndexedVector * rowArray) ;
    00707      void unpackPacked(CoinIndexedVector * rowArray, int sequence);
    00708 protected:
    00713      int housekeeping(double objectiveChange);
    00716      void checkPrimalSolution(const double * rowActivities = NULL,
    00717                               const double * columnActivies = NULL);
    00720      void checkDualSolution();
    00722      void checkBothSolutions();
    00727      double scaleObjective(double value);
    00729      int solveDW(CoinStructuredModel * model);
    00731      int solveBenders(CoinStructuredModel * model);
    00732 public:
    00743      void setValuesPassAction(double incomingInfeasibility,
    00744                               double allowedInfeasibility);
    00746
    00748 public:
    00750      inline double alphaAccuracy() const {
    00751           return alphaAccuracy_;
    00752      }
    00753      inline void setAlphaAccuracy(double value) {
    00754           alphaAccuracy_ = value;
    00755      }
    00756 public:
    00758      //inline double objectiveValue() const {
    00759      //return (objectiveValue_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset];
    00760      //}
    00762      inline void setDisasterHandler(ClpDisasterHandler * handler) {
    00763           disasterArea_ = handler;
    00764      }
    00766      inline ClpDisasterHandler * disasterHandler() const {
    00767           return disasterArea_;
    00768      }
    00770      inline double largeValue() const {
    00771           return largeValue_;
    00772      }
    00773      void setLargeValue( double value) ;
    00775      inline double largestPrimalError() const {
    00776           return largestPrimalError_;
    00777      }
    00779      inline double largestDualError() const {
    00780           return largestDualError_;
    00781      }
    00783      inline void setLargestPrimalError(double value) {
    00784           largestPrimalError_ = value;
    00785      }
    00787      inline void setLargestDualError(double value) {
    00788           largestDualError_ = value;
    00789      }
    00791      inline double zeroTolerance() const {
    00792           return zeroTolerance_;/*factorization_->zeroTolerance();*/
    00793      }
    00795      inline void setZeroTolerance( double value) {
    00796           zeroTolerance_ = value;
    00797      }
    00799      inline int * pivotVariable() const {
    00800           return pivotVariable_;
    00801      }
    00803      inline bool automaticScaling() const {
    00804           return automaticScale_ != 0;
    00805      }
    00806      inline void setAutomaticScaling(bool onOff) {
    00807           automaticScale_ = onOff ? 1 : 0;
    00808      }
    00810      inline double currentDualTolerance() const {
    00811           return dualTolerance_;
    00812      }
    00813      inline void setCurrentDualTolerance(double value) {
    00814           dualTolerance_ = value;
    00815      }
    00817      inline double currentPrimalTolerance() const {
    00818           return primalTolerance_;
    00819      }
    00820      inline void setCurrentPrimalTolerance(double value) {
    00821           primalTolerance_ = value;
    00822      }
    00824      inline int numberRefinements() const {
    00825           return numberRefinements_;
    00826      }
    00827      void setNumberRefinements( int value) ;
    00829      inline double alpha() const {
    00830           return alpha_;
    00831      }
    00832      inline void setAlpha(double value) {
    00833           alpha_ = value;
    00834      }
    00836      inline double dualIn() const {
    00837           return dualIn_;
    00838      }
    00840      inline int pivotRow() const {
    00841           return pivotRow_;
    00842      }
    00843      inline void setPivotRow(int value) {
    00844           pivotRow_ = value;
    00845      }
    00847      double valueIncomingDual() const;
    00849
    00850 protected:
    00856      int gutsOfSolution ( double * givenDuals,
    00857                           const double * givenPrimals,
    00858                           bool valuesPass = false);
    00860      void gutsOfDelete(int type);
    00862      void gutsOfCopy(const ClpSimplex & rhs);
    00874      bool createRim(int what, bool makeRowCopy = false, int startFinishOptions = 0);
    00876      void createRim1(bool initial);
    00878      void createRim4(bool initial);
    00880      void createRim5(bool initial);
    00885      void deleteRim(int getRidOfFactorizationData = 2);
    00887      bool sanityCheck();
    00889 public:
    00894      inline double * solutionRegion(int section) const {
    00895           if (!section) return rowActivityWork_;
    00896           else return columnActivityWork_;
    00897      }
    00898      inline double * djRegion(int section) const {
    00899           if (!section) return rowReducedCost_;
    00900           else return reducedCostWork_;
    00901      }
    00902      inline double * lowerRegion(int section) const {
    00903           if (!section) return rowLowerWork_;
    00904           else return columnLowerWork_;
    00905      }
    00906      inline double * upperRegion(int section) const {
    00907           if (!section) return rowUpperWork_;
    00908           else return columnUpperWork_;
    00909      }
    00910      inline double * costRegion(int section) const {
    00911           if (!section) return rowObjectiveWork_;
    00912           else return objectiveWork_;
    00913      }
    00915      inline double * solutionRegion() const {
    00916           return solution_;
    00917      }
    00918      inline double * djRegion() const {
    00919           return dj_;
    00920      }
    00921      inline double * lowerRegion() const {
    00922           return lower_;
    00923      }
    00924      inline double * upperRegion() const {
    00925           return upper_;
    00926      }
    00927      inline double * costRegion() const {
    00928           return cost_;
    00929      }
    00930      inline Status getStatus(int sequence) const {
    00931           return static_cast<Status> (status_[sequence] & 7);
    00932      }
    00933      inline void setStatus(int sequence, Status newstatus) {
    00934           unsigned char & st_byte = status_[sequence];
    00935           st_byte = static_cast<unsigned char>(st_byte & ~7);
    00936           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    00937      }
    00939      bool startPermanentArrays();
    00944      void setInitialDenseFactorization(bool onOff);
    00945      bool  initialDenseFactorization() const;
    00947      inline int sequenceIn() const {
    00948           return sequenceIn_;
    00949      }
    00950      inline int sequenceOut() const {
    00951           return sequenceOut_;
    00952      }
    00954      inline void  setSequenceIn(int sequence) {
    00955           sequenceIn_ = sequence;
    00956      }
    00957      inline void  setSequenceOut(int sequence) {
    00958           sequenceOut_ = sequence;
    00959      }
    00961      inline int directionIn() const {
    00962           return directionIn_;
    00963      }
    00964      inline int directionOut() const {
    00965           return directionOut_;
    00966      }
    00968      inline void  setDirectionIn(int direction) {
    00969           directionIn_ = direction;
    00970      }
    00971      inline void  setDirectionOut(int direction) {
    00972           directionOut_ = direction;
    00973      }
    00975      inline double valueOut() const {
    00976           return valueOut_;
    00977      }
    00979      inline void setValueOut(double value) {
    00980           valueOut_ = value;
    00981      }
    00983      inline void setLowerOut(double value) {
    00984           lowerOut_ = value;
    00985      }
    00987      inline void setUpperOut(double value) {
    00988           upperOut_ = value;
    00989      }
    00991      inline void setTheta(double value) {
    00992           theta_ = value;
    00993      }
    00995      inline int isColumn(int sequence) const {
    00996           return sequence < numberColumns_ ? 1 : 0;
    00997      }
    00999      inline int sequenceWithin(int sequence) const {
    01000           return sequence < numberColumns_ ? sequence : sequence - numberColumns_;
    01001      }
    01003      inline double solution(int sequence) {
    01004           return solution_[sequence];
    01005      }
    01007      inline double & solutionAddress(int sequence) {
    01008           return solution_[sequence];
    01009      }
    01010      inline double reducedCost(int sequence) {
    01011           return dj_[sequence];
    01012      }
    01013      inline double & reducedCostAddress(int sequence) {
    01014           return dj_[sequence];
    01015      }
    01016      inline double lower(int sequence) {
    01017           return lower_[sequence];
    01018      }
    01020      inline double & lowerAddress(int sequence) {
    01021           return lower_[sequence];
    01022      }
    01023      inline double upper(int sequence) {
    01024           return upper_[sequence];
    01025      }
    01027      inline double & upperAddress(int sequence) {
    01028           return upper_[sequence];
    01029      }
    01030      inline double cost(int sequence) {
    01031           return cost_[sequence];
    01032      }
    01034      inline double & costAddress(int sequence) {
    01035           return cost_[sequence];
    01036      }
    01038      inline double originalLower(int iSequence) const {
    01039           if (iSequence < numberColumns_) return columnLower_[iSequence];
    01040           else
    01041                return rowLower_[iSequence-numberColumns_];
    01042      }
    01044      inline double originalUpper(int iSequence) const {
    01045           if (iSequence < numberColumns_) return columnUpper_[iSequence];
    01046           else
    01047                return rowUpper_[iSequence-numberColumns_];
    01048      }
    01050      inline double theta() const {
    01051           return theta_;
    01052      }
    01055      inline double bestPossibleImprovement() const {
    01056           return bestPossibleImprovement_;
    01057      }
    01059      inline ClpNonLinearCost * nonLinearCost() const {
    01060           return nonLinearCost_;
    01061      }
    01074      inline int moreSpecialOptions() const {
    01075           return moreSpecialOptions_;
    01076      }
    01089      inline void setMoreSpecialOptions(int value) {
    01090           moreSpecialOptions_ = value;
    01091      }
    01093
    01095      inline void setFakeBound(int sequence, FakeBound fakeBound) {
    01096           unsigned char & st_byte = status_[sequence];
    01097           st_byte = static_cast<unsigned char>(st_byte & ~24);
    01098           st_byte = static_cast<unsigned char>(st_byte | (fakeBound << 3));
    01099      }
    01100      inline FakeBound getFakeBound(int sequence) const {
    01101           return static_cast<FakeBound> ((status_[sequence] >> 3) & 3);
    01102      }
    01103      inline void setRowStatus(int sequence, Status newstatus) {
    01104           unsigned char & st_byte = status_[sequence+numberColumns_];
    01105           st_byte = static_cast<unsigned char>(st_byte & ~7);
    01106           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    01107      }
    01108      inline Status getRowStatus(int sequence) const {
    01109           return static_cast<Status> (status_[sequence+numberColumns_] & 7);
    01110      }
    01111      inline void setColumnStatus(int sequence, Status newstatus) {
    01112           unsigned char & st_byte = status_[sequence];
    01113           st_byte = static_cast<unsigned char>(st_byte & ~7);
    01114           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    01115      }
    01116      inline Status getColumnStatus(int sequence) const {
    01117           return static_cast<Status> (status_[sequence] & 7);
    01118      }
    01119      inline void setPivoted( int sequence) {
    01120           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 32);
    01121      }
    01122      inline void clearPivoted( int sequence) {
    01123           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~32);
    01124      }
    01125      inline bool pivoted(int sequence) const {
    01126           return (((status_[sequence] >> 5) & 1) != 0);
    01127      }
    01129      void setFlagged( int sequence);
    01130      inline void clearFlagged( int sequence) {
    01131           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~64);
    01132      }
    01133      inline bool flagged(int sequence) const {
    01134           return ((status_[sequence] & 64) != 0);
    01135      }
    01137      inline void setActive( int iRow) {
    01138           status_[iRow] = static_cast<unsigned char>(status_[iRow] | 128);
    01139      }
    01140      inline void clearActive( int iRow) {
    01141           status_[iRow] = static_cast<unsigned char>(status_[iRow] & ~128);
    01142      }
    01143      inline bool active(int iRow) const {
    01144           return ((status_[iRow] & 128) != 0);
    01145      }
    01148      void createStatus() ;
    01151      void allSlackBasis(bool resetSolution = false);
    01152
    01154      inline int lastBadIteration() const {
    01155           return lastBadIteration_;
    01156      }
    01158      inline int progressFlag() const {
    01159           return (progressFlag_ & 3);
    01160      }
    01162      inline void forceFactorization(int value) {
    01163           forceFactorization_ = value;
    01164      }
    01166      inline double rawObjectiveValue() const {
    01167           return objectiveValue_;
    01168      }
    01170      void computeObjectiveValue(bool useWorkingSolution = false);
    01172      double computeInternalObjectiveValue();
    01176      inline int numberExtraRows() const {
    01177           return numberExtraRows_;
    01178      }
    01181      inline int maximumBasic() const {
    01182           return maximumBasic_;
    01183      }
    01185      inline int baseIteration() const {
    01186           return baseIteration_;
    01187      }
    01189      void generateCpp( FILE * fp, bool defaultFactor = false);
    01191      ClpFactorization * getEmptyFactorization();
    01193      void setEmptyFactorization();
    01195      void moveInfo(const ClpSimplex & rhs, bool justStatus = false);
    01197
    01199      // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
    01200      // *** At present only without scaling
    01201      // *** Slacks havve -1.0 element (so == row activity) - take care
    01203      void getBInvARow(int row, double* z, double * slack = NULL);
    01204
    01206      void getBInvRow(int row, double* z);
    01207
    01209      void getBInvACol(int col, double* vec);
    01210
    01212      void getBInvCol(int col, double* vec);
    01213
    01218      void getBasics(int* index);
    01219
    01221      //-------------------------------------------------------------------------
    01225      void setObjectiveCoefficient( int elementIndex, double elementValue );
    01227      inline void setObjCoeff( int elementIndex, double elementValue ) {
    01228           setObjectiveCoefficient( elementIndex, elementValue);
    01229      }
    01230
    01233      void setColumnLower( int elementIndex, double elementValue );
    01234
    01237      void setColumnUpper( int elementIndex, double elementValue );
    01238
    01240      void setColumnBounds( int elementIndex,
    01241                            double lower, double upper );
    01242
    01251      void setColumnSetBounds(const int* indexFirst,
    01252                              const int* indexLast,
    01253                              const double* boundList);
    01254
    01257      inline void setColLower( int elementIndex, double elementValue ) {
    01258           setColumnLower(elementIndex, elementValue);
    01259      }
    01262      inline void setColUpper( int elementIndex, double elementValue ) {
    01263           setColumnUpper(elementIndex, elementValue);
    01264      }
    01265
    01267      inline void setColBounds( int elementIndex,
    01268                                double newlower, double newupper ) {
    01269           setColumnBounds(elementIndex, newlower, newupper);
    01270      }
    01271
    01278      inline void setColSetBounds(const int* indexFirst,
    01279                                  const int* indexLast,
    01280                                  const double* boundList) {
    01281           setColumnSetBounds(indexFirst, indexLast, boundList);
    01282      }
    01283
    01286      void setRowLower( int elementIndex, double elementValue );
    01287
    01290      void setRowUpper( int elementIndex, double elementValue ) ;
    01291
    01293      void setRowBounds( int elementIndex,
    01294                         double lower, double upper ) ;
    01295
    01302      void setRowSetBounds(const int* indexFirst,
    01303                           const int* indexLast,
    01304                           const double* boundList);
    01306      void resize (int newNumberRows, int newNumberColumns);
    01307
    01309
    01311 protected:
    01312
    01321      double bestPossibleImprovement_;
    01323      double zeroTolerance_;
    01325      int columnPrimalSequence_;
    01327      int rowPrimalSequence_;
    01329      double bestObjectiveValue_;
    01331      int moreSpecialOptions_;
    01333      int baseIteration_;
    01335      double primalToleranceToGetOptimal_;
    01337      double largeValue_;
    01339      double largestPrimalError_;
    01341      double largestDualError_;
    01343      double alphaAccuracy_;
    01345      double dualBound_;
    01347      double alpha_;
    01349      double theta_;
    01351      double lowerIn_;
    01353      double valueIn_;
    01355      double upperIn_;
    01357      double dualIn_;
    01359      double lowerOut_;
    01361      double valueOut_;
    01363      double upperOut_;
    01365      double dualOut_;
    01367      double dualTolerance_;
    01369      double primalTolerance_;
    01371      double sumDualInfeasibilities_;
    01373      double sumPrimalInfeasibilities_;
    01375      double infeasibilityCost_;
    01377      double sumOfRelaxedDualInfeasibilities_;
    01379      double sumOfRelaxedPrimalInfeasibilities_;
    01381      double acceptablePivot_;
    01383      double * lower_;
    01385      double * rowLowerWork_;
    01387      double * columnLowerWork_;
    01389      double * upper_;
    01391      double * rowUpperWork_;
    01393      double * columnUpperWork_;
    01395      double * cost_;
    01397      double * rowObjectiveWork_;
    01399      double * objectiveWork_;
    01401      CoinIndexedVector * rowArray_[6];
    01403      CoinIndexedVector * columnArray_[6];
    01405      int sequenceIn_;
    01407      int directionIn_;
    01409      int sequenceOut_;
    01411      int directionOut_;
    01413      int pivotRow_;
    01415      int lastGoodIteration_;
    01417      double * dj_;
    01419      double * rowReducedCost_;
    01421      double * reducedCostWork_;
    01423      double * solution_;
    01425      double * rowActivityWork_;
    01427      double * columnActivityWork_;
    01429      int numberDualInfeasibilities_;
    01431      int numberDualInfeasibilitiesWithoutFree_;
    01433      int numberPrimalInfeasibilities_;
    01435      int numberRefinements_;
    01437      ClpDualRowPivot * dualRowPivot_;
    01439      ClpPrimalColumnPivot * primalColumnPivot_;
    01441      int * pivotVariable_;
    01443      ClpFactorization * factorization_;
    01445      double * savedSolution_;
    01447      int numberTimesOptimal_;
    01449      ClpDisasterHandler * disasterArea_;
    01451      int changeMade_;
    01453      int algorithm_;
    01456      int forceFactorization_;
    01464      int perturbation_;
    01466      unsigned char * saveStatus_;
    01471      ClpNonLinearCost * nonLinearCost_;
    01473      int lastBadIteration_;
    01475      int lastFlaggedIteration_;
    01477      int numberFake_;
    01479      int numberChanged_;
    01481      int progressFlag_;
    01483      int firstFree_;
    01487      int numberExtraRows_;
    01490      int maximumBasic_;
    01492      int dontFactorizePivots_;
    01502      double incomingInfeasibility_;
    01503      double allowedInfeasibility_;
    01505      int automaticScale_;
    01507      int maximumPerturbationSize_;
    01509      double * perturbationArray_;
    01511      ClpSimplex * baseModel_;
    01513      ClpSimplexProgress progress_;
    01514 public:
    01516      mutable int spareIntArray_[4];
    01518      mutable double spareDoubleArray_[4];
    01519 protected:
    01521      friend class OsiClpSolverInterface;
    01523 };
    01524 //#############################################################################
    01533 void
    01534 ClpSimplexUnitTest(const std::string & mpsDir);
    01535
    01536 // For Devex stuff
    01537 #define DEVEX_TRY_NORM 1.0e-4
    01538 #define DEVEX_ADD_ONE 1.0
    01539 #endif