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

- File List
- File Members

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

Go to the documentation of this file.

    00001 /* $Id: ClpSimplex.hpp 1753 2011-06-19 16:27:26Z 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 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      void checkUnscaledSolution();
    00616      inline CoinIndexedVector * rowArray(int index) const {
    00617           return rowArray_[index];
    00618      }
    00620      inline CoinIndexedVector * columnArray(int index) const {
    00621           return columnArray_[index];
    00622      }
    00624
    00625      /******************** End of most useful part **************/
    00631      int getSolution (  const double * rowActivities,
    00632                         const double * columnActivities);
    00636      int getSolution ();
    00643      int createPiecewiseLinearCosts(const int * starts,
    00644                                     const double * lower, const double * gradient);
    00646      inline ClpDualRowPivot * dualRowPivot() const {
    00647           return dualRowPivot_;
    00648      }
    00650      inline ClpPrimalColumnPivot * primalColumnPivot() const {
    00651           return primalColumnPivot_;
    00652      }
    00654      inline bool goodAccuracy() const {
    00655           return (largestPrimalError_ < 1.0e-7 && largestDualError_ < 1.0e-7);
    00656      }
    00658      void returnModel(ClpSimplex & otherModel);
    00666      int internalFactorize(int solveType);
    00668      ClpDataSave saveData() ;
    00670      void restoreData(ClpDataSave saved);
    00672      void cleanStatus();
    00674      int factorize();
    00677      void computeDuals(double * givenDjs);
    00679      void computePrimals (  const double * rowActivities,
    00680                             const double * columnActivities);
    00682      void add(double * array,
    00683               int column, double multiplier) const;
    00689      void unpack(CoinIndexedVector * rowArray) const ;
    00695      void unpack(CoinIndexedVector * rowArray, int sequence) const;
    00702      void unpackPacked(CoinIndexedVector * rowArray) ;
    00709      void unpackPacked(CoinIndexedVector * rowArray, int sequence);
    00710 protected:
    00715      int housekeeping(double objectiveChange);
    00718      void checkPrimalSolution(const double * rowActivities = NULL,
    00719                               const double * columnActivies = NULL);
    00722      void checkDualSolution();
    00724      void checkBothSolutions();
    00729      double scaleObjective(double value);
    00731      int solveDW(CoinStructuredModel * model);
    00733      int solveBenders(CoinStructuredModel * model);
    00734 public:
    00745      void setValuesPassAction(double incomingInfeasibility,
    00746                               double allowedInfeasibility);
    00748
    00750 public:
    00752      inline double alphaAccuracy() const {
    00753           return alphaAccuracy_;
    00754      }
    00755      inline void setAlphaAccuracy(double value) {
    00756           alphaAccuracy_ = value;
    00757      }
    00758 public:
    00760      //inline double objectiveValue() const {
    00761      //return (objectiveValue_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset];
    00762      //}
    00764      inline void setDisasterHandler(ClpDisasterHandler * handler) {
    00765           disasterArea_ = handler;
    00766      }
    00768      inline ClpDisasterHandler * disasterHandler() const {
    00769           return disasterArea_;
    00770      }
    00772      inline double largeValue() const {
    00773           return largeValue_;
    00774      }
    00775      void setLargeValue( double value) ;
    00777      inline double largestPrimalError() const {
    00778           return largestPrimalError_;
    00779      }
    00781      inline double largestDualError() const {
    00782           return largestDualError_;
    00783      }
    00785      inline void setLargestPrimalError(double value) {
    00786           largestPrimalError_ = value;
    00787      }
    00789      inline void setLargestDualError(double value) {
    00790           largestDualError_ = value;
    00791      }
    00793      inline double zeroTolerance() const {
    00794           return zeroTolerance_;/*factorization_->zeroTolerance();*/
    00795      }
    00797      inline void setZeroTolerance( double value) {
    00798           zeroTolerance_ = value;
    00799      }
    00801      inline int * pivotVariable() const {
    00802           return pivotVariable_;
    00803      }
    00805      inline bool automaticScaling() const {
    00806           return automaticScale_ != 0;
    00807      }
    00808      inline void setAutomaticScaling(bool onOff) {
    00809           automaticScale_ = onOff ? 1 : 0;
    00810      }
    00812      inline double currentDualTolerance() const {
    00813           return dualTolerance_;
    00814      }
    00815      inline void setCurrentDualTolerance(double value) {
    00816           dualTolerance_ = value;
    00817      }
    00819      inline double currentPrimalTolerance() const {
    00820           return primalTolerance_;
    00821      }
    00822      inline void setCurrentPrimalTolerance(double value) {
    00823           primalTolerance_ = value;
    00824      }
    00826      inline int numberRefinements() const {
    00827           return numberRefinements_;
    00828      }
    00829      void setNumberRefinements( int value) ;
    00831      inline double alpha() const {
    00832           return alpha_;
    00833      }
    00834      inline void setAlpha(double value) {
    00835           alpha_ = value;
    00836      }
    00838      inline double dualIn() const {
    00839           return dualIn_;
    00840      }
    00842      inline int pivotRow() const {
    00843           return pivotRow_;
    00844      }
    00845      inline void setPivotRow(int value) {
    00846           pivotRow_ = value;
    00847      }
    00849      double valueIncomingDual() const;
    00851
    00852 protected:
    00858      int gutsOfSolution ( double * givenDuals,
    00859                           const double * givenPrimals,
    00860                           bool valuesPass = false);
    00862      void gutsOfDelete(int type);
    00864      void gutsOfCopy(const ClpSimplex & rhs);
    00876      bool createRim(int what, bool makeRowCopy = false, int startFinishOptions = 0);
    00878      void createRim1(bool initial);
    00880      void createRim4(bool initial);
    00882      void createRim5(bool initial);
    00887      void deleteRim(int getRidOfFactorizationData = 2);
    00889      bool sanityCheck();
    00891 public:
    00896      inline double * solutionRegion(int section) const {
    00897           if (!section) return rowActivityWork_;
    00898           else return columnActivityWork_;
    00899      }
    00900      inline double * djRegion(int section) const {
    00901           if (!section) return rowReducedCost_;
    00902           else return reducedCostWork_;
    00903      }
    00904      inline double * lowerRegion(int section) const {
    00905           if (!section) return rowLowerWork_;
    00906           else return columnLowerWork_;
    00907      }
    00908      inline double * upperRegion(int section) const {
    00909           if (!section) return rowUpperWork_;
    00910           else return columnUpperWork_;
    00911      }
    00912      inline double * costRegion(int section) const {
    00913           if (!section) return rowObjectiveWork_;
    00914           else return objectiveWork_;
    00915      }
    00917      inline double * solutionRegion() const {
    00918           return solution_;
    00919      }
    00920      inline double * djRegion() const {
    00921           return dj_;
    00922      }
    00923      inline double * lowerRegion() const {
    00924           return lower_;
    00925      }
    00926      inline double * upperRegion() const {
    00927           return upper_;
    00928      }
    00929      inline double * costRegion() const {
    00930           return cost_;
    00931      }
    00932      inline Status getStatus(int sequence) const {
    00933           return static_cast<Status> (status_[sequence] & 7);
    00934      }
    00935      inline void setStatus(int sequence, Status newstatus) {
    00936           unsigned char & st_byte = status_[sequence];
    00937           st_byte = static_cast<unsigned char>(st_byte & ~7);
    00938           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    00939      }
    00941      bool startPermanentArrays();
    00946      void setInitialDenseFactorization(bool onOff);
    00947      bool  initialDenseFactorization() const;
    00949      inline int sequenceIn() const {
    00950           return sequenceIn_;
    00951      }
    00952      inline int sequenceOut() const {
    00953           return sequenceOut_;
    00954      }
    00956      inline void  setSequenceIn(int sequence) {
    00957           sequenceIn_ = sequence;
    00958      }
    00959      inline void  setSequenceOut(int sequence) {
    00960           sequenceOut_ = sequence;
    00961      }
    00963      inline int directionIn() const {
    00964           return directionIn_;
    00965      }
    00966      inline int directionOut() const {
    00967           return directionOut_;
    00968      }
    00970      inline void  setDirectionIn(int direction) {
    00971           directionIn_ = direction;
    00972      }
    00973      inline void  setDirectionOut(int direction) {
    00974           directionOut_ = direction;
    00975      }
    00977      inline double valueOut() const {
    00978           return valueOut_;
    00979      }
    00981      inline void setValueOut(double value) {
    00982           valueOut_ = value;
    00983      }
    00985      inline void setLowerOut(double value) {
    00986           lowerOut_ = value;
    00987      }
    00989      inline void setUpperOut(double value) {
    00990           upperOut_ = value;
    00991      }
    00993      inline void setTheta(double value) {
    00994           theta_ = value;
    00995      }
    00997      inline int isColumn(int sequence) const {
    00998           return sequence < numberColumns_ ? 1 : 0;
    00999      }
    01001      inline int sequenceWithin(int sequence) const {
    01002           return sequence < numberColumns_ ? sequence : sequence - numberColumns_;
    01003      }
    01005      inline double solution(int sequence) {
    01006           return solution_[sequence];
    01007      }
    01009      inline double & solutionAddress(int sequence) {
    01010           return solution_[sequence];
    01011      }
    01012      inline double reducedCost(int sequence) {
    01013           return dj_[sequence];
    01014      }
    01015      inline double & reducedCostAddress(int sequence) {
    01016           return dj_[sequence];
    01017      }
    01018      inline double lower(int sequence) {
    01019           return lower_[sequence];
    01020      }
    01022      inline double & lowerAddress(int sequence) {
    01023           return lower_[sequence];
    01024      }
    01025      inline double upper(int sequence) {
    01026           return upper_[sequence];
    01027      }
    01029      inline double & upperAddress(int sequence) {
    01030           return upper_[sequence];
    01031      }
    01032      inline double cost(int sequence) {
    01033           return cost_[sequence];
    01034      }
    01036      inline double & costAddress(int sequence) {
    01037           return cost_[sequence];
    01038      }
    01040      inline double originalLower(int iSequence) const {
    01041           if (iSequence < numberColumns_) return columnLower_[iSequence];
    01042           else
    01043                return rowLower_[iSequence-numberColumns_];
    01044      }
    01046      inline double originalUpper(int iSequence) const {
    01047           if (iSequence < numberColumns_) return columnUpper_[iSequence];
    01048           else
    01049                return rowUpper_[iSequence-numberColumns_];
    01050      }
    01052      inline double theta() const {
    01053           return theta_;
    01054      }
    01057      inline double bestPossibleImprovement() const {
    01058           return bestPossibleImprovement_;
    01059      }
    01061      inline ClpNonLinearCost * nonLinearCost() const {
    01062           return nonLinearCost_;
    01063      }
    01079      inline int moreSpecialOptions() const {
    01080           return moreSpecialOptions_;
    01081      }
    01097      inline void setMoreSpecialOptions(int value) {
    01098           moreSpecialOptions_ = value;
    01099      }
    01101
    01103      inline void setFakeBound(int sequence, FakeBound fakeBound) {
    01104           unsigned char & st_byte = status_[sequence];
    01105           st_byte = static_cast<unsigned char>(st_byte & ~24);
    01106           st_byte = static_cast<unsigned char>(st_byte | (fakeBound << 3));
    01107      }
    01108      inline FakeBound getFakeBound(int sequence) const {
    01109           return static_cast<FakeBound> ((status_[sequence] >> 3) & 3);
    01110      }
    01111      inline void setRowStatus(int sequence, Status newstatus) {
    01112           unsigned char & st_byte = status_[sequence+numberColumns_];
    01113           st_byte = static_cast<unsigned char>(st_byte & ~7);
    01114           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    01115      }
    01116      inline Status getRowStatus(int sequence) const {
    01117           return static_cast<Status> (status_[sequence+numberColumns_] & 7);
    01118      }
    01119      inline void setColumnStatus(int sequence, Status newstatus) {
    01120           unsigned char & st_byte = status_[sequence];
    01121           st_byte = static_cast<unsigned char>(st_byte & ~7);
    01122           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    01123      }
    01124      inline Status getColumnStatus(int sequence) const {
    01125           return static_cast<Status> (status_[sequence] & 7);
    01126      }
    01127      inline void setPivoted( int sequence) {
    01128           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 32);
    01129      }
    01130      inline void clearPivoted( int sequence) {
    01131           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~32);
    01132      }
    01133      inline bool pivoted(int sequence) const {
    01134           return (((status_[sequence] >> 5) & 1) != 0);
    01135      }
    01137      void setFlagged( int sequence);
    01138      inline void clearFlagged( int sequence) {
    01139           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~64);
    01140      }
    01141      inline bool flagged(int sequence) const {
    01142           return ((status_[sequence] & 64) != 0);
    01143      }
    01145      inline void setActive( int iRow) {
    01146           status_[iRow] = static_cast<unsigned char>(status_[iRow] | 128);
    01147      }
    01148      inline void clearActive( int iRow) {
    01149           status_[iRow] = static_cast<unsigned char>(status_[iRow] & ~128);
    01150      }
    01151      inline bool active(int iRow) const {
    01152           return ((status_[iRow] & 128) != 0);
    01153      }
    01156      void createStatus() ;
    01159      void allSlackBasis(bool resetSolution = false);
    01160
    01162      inline int lastBadIteration() const {
    01163           return lastBadIteration_;
    01164      }
    01166      inline int progressFlag() const {
    01167           return (progressFlag_ & 3);
    01168      }
    01170      inline void forceFactorization(int value) {
    01171           forceFactorization_ = value;
    01172      }
    01174      inline double rawObjectiveValue() const {
    01175           return objectiveValue_;
    01176      }
    01178      void computeObjectiveValue(bool useWorkingSolution = false);
    01180      double computeInternalObjectiveValue();
    01184      inline int numberExtraRows() const {
    01185           return numberExtraRows_;
    01186      }
    01189      inline int maximumBasic() const {
    01190           return maximumBasic_;
    01191      }
    01193      inline int baseIteration() const {
    01194           return baseIteration_;
    01195      }
    01197      void generateCpp( FILE * fp, bool defaultFactor = false);
    01199      ClpFactorization * getEmptyFactorization();
    01201      void setEmptyFactorization();
    01203      void moveInfo(const ClpSimplex & rhs, bool justStatus = false);
    01205
    01207      // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
    01208      // *** At present only without scaling
    01209      // *** Slacks havve -1.0 element (so == row activity) - take care
    01211      void getBInvARow(int row, double* z, double * slack = NULL);
    01212
    01214      void getBInvRow(int row, double* z);
    01215
    01217      void getBInvACol(int col, double* vec);
    01218
    01220      void getBInvCol(int col, double* vec);
    01221
    01226      void getBasics(int* index);
    01227
    01229      //-------------------------------------------------------------------------
    01233      void setObjectiveCoefficient( int elementIndex, double elementValue );
    01235      inline void setObjCoeff( int elementIndex, double elementValue ) {
    01236           setObjectiveCoefficient( elementIndex, elementValue);
    01237      }
    01238
    01241      void setColumnLower( int elementIndex, double elementValue );
    01242
    01245      void setColumnUpper( int elementIndex, double elementValue );
    01246
    01248      void setColumnBounds( int elementIndex,
    01249                            double lower, double upper );
    01250
    01259      void setColumnSetBounds(const int* indexFirst,
    01260                              const int* indexLast,
    01261                              const double* boundList);
    01262
    01265      inline void setColLower( int elementIndex, double elementValue ) {
    01266           setColumnLower(elementIndex, elementValue);
    01267      }
    01270      inline void setColUpper( int elementIndex, double elementValue ) {
    01271           setColumnUpper(elementIndex, elementValue);
    01272      }
    01273
    01275      inline void setColBounds( int elementIndex,
    01276                                double newlower, double newupper ) {
    01277           setColumnBounds(elementIndex, newlower, newupper);
    01278      }
    01279
    01286      inline void setColSetBounds(const int* indexFirst,
    01287                                  const int* indexLast,
    01288                                  const double* boundList) {
    01289           setColumnSetBounds(indexFirst, indexLast, boundList);
    01290      }
    01291
    01294      void setRowLower( int elementIndex, double elementValue );
    01295
    01298      void setRowUpper( int elementIndex, double elementValue ) ;
    01299
    01301      void setRowBounds( int elementIndex,
    01302                         double lower, double upper ) ;
    01303
    01310      void setRowSetBounds(const int* indexFirst,
    01311                           const int* indexLast,
    01312                           const double* boundList);
    01314      void resize (int newNumberRows, int newNumberColumns);
    01315
    01317
    01319 protected:
    01320
    01329      double bestPossibleImprovement_;
    01331      double zeroTolerance_;
    01333      int columnPrimalSequence_;
    01335      int rowPrimalSequence_;
    01337      double bestObjectiveValue_;
    01339      int moreSpecialOptions_;
    01341      int baseIteration_;
    01343      double primalToleranceToGetOptimal_;
    01345      double largeValue_;
    01347      double largestPrimalError_;
    01349      double largestDualError_;
    01351      double alphaAccuracy_;
    01353      double dualBound_;
    01355      double alpha_;
    01357      double theta_;
    01359      double lowerIn_;
    01361      double valueIn_;
    01363      double upperIn_;
    01365      double dualIn_;
    01367      double lowerOut_;
    01369      double valueOut_;
    01371      double upperOut_;
    01373      double dualOut_;
    01375      double dualTolerance_;
    01377      double primalTolerance_;
    01379      double sumDualInfeasibilities_;
    01381      double sumPrimalInfeasibilities_;
    01383      double infeasibilityCost_;
    01385      double sumOfRelaxedDualInfeasibilities_;
    01387      double sumOfRelaxedPrimalInfeasibilities_;
    01389      double acceptablePivot_;
    01391      double * lower_;
    01393      double * rowLowerWork_;
    01395      double * columnLowerWork_;
    01397      double * upper_;
    01399      double * rowUpperWork_;
    01401      double * columnUpperWork_;
    01403      double * cost_;
    01405      double * rowObjectiveWork_;
    01407      double * objectiveWork_;
    01409      CoinIndexedVector * rowArray_[6];
    01411      CoinIndexedVector * columnArray_[6];
    01413      int sequenceIn_;
    01415      int directionIn_;
    01417      int sequenceOut_;
    01419      int directionOut_;
    01421      int pivotRow_;
    01423      int lastGoodIteration_;
    01425      double * dj_;
    01427      double * rowReducedCost_;
    01429      double * reducedCostWork_;
    01431      double * solution_;
    01433      double * rowActivityWork_;
    01435      double * columnActivityWork_;
    01437      int numberDualInfeasibilities_;
    01439      int numberDualInfeasibilitiesWithoutFree_;
    01441      int numberPrimalInfeasibilities_;
    01443      int numberRefinements_;
    01445      ClpDualRowPivot * dualRowPivot_;
    01447      ClpPrimalColumnPivot * primalColumnPivot_;
    01449      int * pivotVariable_;
    01451      ClpFactorization * factorization_;
    01453      double * savedSolution_;
    01455      int numberTimesOptimal_;
    01457      ClpDisasterHandler * disasterArea_;
    01459      int changeMade_;
    01461      int algorithm_;
    01464      int forceFactorization_;
    01472      int perturbation_;
    01474      unsigned char * saveStatus_;
    01479      ClpNonLinearCost * nonLinearCost_;
    01481      int lastBadIteration_;
    01483      int lastFlaggedIteration_;
    01485      int numberFake_;
    01487      int numberChanged_;
    01489      int progressFlag_;
    01491      int firstFree_;
    01495      int numberExtraRows_;
    01498      int maximumBasic_;
    01500      int dontFactorizePivots_;
    01510      double incomingInfeasibility_;
    01511      double allowedInfeasibility_;
    01513      int automaticScale_;
    01515      int maximumPerturbationSize_;
    01517      double * perturbationArray_;
    01519      ClpSimplex * baseModel_;
    01521      ClpSimplexProgress progress_;
    01522 public:
    01524      mutable int spareIntArray_[4];
    01526      mutable double spareDoubleArray_[4];
    01527 protected:
    01529      friend class OsiClpSolverInterface;
    01531 };
    01532 //#############################################################################
    01541 void
    01542 ClpSimplexUnitTest(const std::string & mpsDir);
    01543
    01544 // For Devex stuff
    01545 #define DEVEX_TRY_NORM 1.0e-4
    01546 #define DEVEX_ADD_ONE 1.0
    01547 #endif