# ClpSimplex.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpSimplex.hpp 2006 2013-12-12 15:40:41Z forrest $ */
    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      }
    01188      inline int moreSpecialOptions() const {
    01189           return moreSpecialOptions_;
    01190      }
    01211      inline void setMoreSpecialOptions(int value) {
    01212           moreSpecialOptions_ = value;
    01213      }
    01215
    01217      inline void setFakeBound(int sequence, FakeBound fakeBound) {
    01218           unsigned char & st_byte = status_[sequence];
    01219           st_byte = static_cast<unsigned char>(st_byte & ~24);
    01220           st_byte = static_cast<unsigned char>(st_byte | (fakeBound << 3));
    01221      }
    01222      inline FakeBound getFakeBound(int sequence) const {
    01223           return static_cast<FakeBound> ((status_[sequence] >> 3) & 3);
    01224      }
    01225      inline void setRowStatus(int sequence, Status newstatus) {
    01226           unsigned char & st_byte = status_[sequence+numberColumns_];
    01227           st_byte = static_cast<unsigned char>(st_byte & ~7);
    01228           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    01229      }
    01230      inline Status getRowStatus(int sequence) const {
    01231           return static_cast<Status> (status_[sequence+numberColumns_] & 7);
    01232      }
    01233      inline void setColumnStatus(int sequence, Status newstatus) {
    01234           unsigned char & st_byte = status_[sequence];
    01235           st_byte = static_cast<unsigned char>(st_byte & ~7);
    01236           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    01237      }
    01238      inline Status getColumnStatus(int sequence) const {
    01239           return static_cast<Status> (status_[sequence] & 7);
    01240      }
    01241      inline void setPivoted( int sequence) {
    01242           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 32);
    01243      }
    01244      inline void clearPivoted( int sequence) {
    01245           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~32);
    01246      }
    01247      inline bool pivoted(int sequence) const {
    01248           return (((status_[sequence] >> 5) & 1) != 0);
    01249      }
    01251      void setFlagged( int sequence);
    01252      inline void clearFlagged( int sequence) {
    01253           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~64);
    01254      }
    01255      inline bool flagged(int sequence) const {
    01256           return ((status_[sequence] & 64) != 0);
    01257      }
    01259      inline void setActive( int iRow) {
    01260           status_[iRow] = static_cast<unsigned char>(status_[iRow] | 128);
    01261      }
    01262      inline void clearActive( int iRow) {
    01263           status_[iRow] = static_cast<unsigned char>(status_[iRow] & ~128);
    01264      }
    01265      inline bool active(int iRow) const {
    01266           return ((status_[iRow] & 128) != 0);
    01267      }
    01270      void createStatus() ;
    01273      void allSlackBasis(bool resetSolution = false);
    01274
    01276      inline int lastBadIteration() const {
    01277           return lastBadIteration_;
    01278      }
    01280      inline void setLastBadIteration(int value) {
    01281           lastBadIteration_=value;
    01282      }
    01284      inline int progressFlag() const {
    01285           return (progressFlag_ & 3);
    01286      }
    01288      inline ClpSimplexProgress * progress()
    01289      { return &progress_;}
    01291      inline int forceFactorization() const {
    01292           return forceFactorization_ ;
    01293      }
    01295      inline void forceFactorization(int value) {
    01296           forceFactorization_ = value;
    01297      }
    01299      inline double rawObjectiveValue() const {
    01300           return objectiveValue_;
    01301      }
    01303      void computeObjectiveValue(bool useWorkingSolution = false);
    01305      double computeInternalObjectiveValue();
    01308      double * infeasibilityRay(bool fullRay=false) const;
    01312      inline int numberExtraRows() const {
    01313           return numberExtraRows_;
    01314      }
    01317      inline int maximumBasic() const {
    01318           return maximumBasic_;
    01319      }
    01321      inline int baseIteration() const {
    01322           return baseIteration_;
    01323      }
    01325      void generateCpp( FILE * fp, bool defaultFactor = false);
    01327      ClpFactorization * getEmptyFactorization();
    01329      void setEmptyFactorization();
    01331      void moveInfo(const ClpSimplex & rhs, bool justStatus = false);
    01333
    01335      // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
    01336      // *** At present only without scaling
    01337      // *** Slacks havve -1.0 element (so == row activity) - take care
    01339      void getBInvARow(int row, double* z, double * slack = NULL);
    01340
    01342      void getBInvRow(int row, double* z);
    01343
    01345      void getBInvACol(int col, double* vec);
    01346
    01348      void getBInvCol(int col, double* vec);
    01349
    01354      void getBasics(int* index);
    01355
    01357      //-------------------------------------------------------------------------
    01361      void setObjectiveCoefficient( int elementIndex, double elementValue );
    01363      inline void setObjCoeff( int elementIndex, double elementValue ) {
    01364           setObjectiveCoefficient( elementIndex, elementValue);
    01365      }
    01366
    01369      void setColumnLower( int elementIndex, double elementValue );
    01370
    01373      void setColumnUpper( int elementIndex, double elementValue );
    01374
    01376      void setColumnBounds( int elementIndex,
    01377                            double lower, double upper );
    01378
    01387      void setColumnSetBounds(const int* indexFirst,
    01388                              const int* indexLast,
    01389                              const double* boundList);
    01390
    01393      inline void setColLower( int elementIndex, double elementValue ) {
    01394           setColumnLower(elementIndex, elementValue);
    01395      }
    01398      inline void setColUpper( int elementIndex, double elementValue ) {
    01399           setColumnUpper(elementIndex, elementValue);
    01400      }
    01401
    01403      inline void setColBounds( int elementIndex,
    01404                                double newlower, double newupper ) {
    01405           setColumnBounds(elementIndex, newlower, newupper);
    01406      }
    01407
    01414      inline void setColSetBounds(const int* indexFirst,
    01415                                  const int* indexLast,
    01416                                  const double* boundList) {
    01417           setColumnSetBounds(indexFirst, indexLast, boundList);
    01418      }
    01419
    01422      void setRowLower( int elementIndex, double elementValue );
    01423
    01426      void setRowUpper( int elementIndex, double elementValue ) ;
    01427
    01429      void setRowBounds( int elementIndex,
    01430                         double lower, double upper ) ;
    01431
    01438      void setRowSetBounds(const int* indexFirst,
    01439                           const int* indexLast,
    01440                           const double* boundList);
    01442      void resize (int newNumberRows, int newNumberColumns);
    01443
    01445
    01447 protected:
    01448
    01457      double bestPossibleImprovement_;
    01459      double zeroTolerance_;
    01461      int columnPrimalSequence_;
    01463      int rowPrimalSequence_;
    01465      double bestObjectiveValue_;
    01467      int moreSpecialOptions_;
    01469      int baseIteration_;
    01471      double primalToleranceToGetOptimal_;
    01473      double largeValue_;
    01475      double largestPrimalError_;
    01477      double largestDualError_;
    01479      double alphaAccuracy_;
    01481      double dualBound_;
    01483      double alpha_;
    01485      double theta_;
    01487      double lowerIn_;
    01489      double valueIn_;
    01491      double upperIn_;
    01493      double dualIn_;
    01495      double lowerOut_;
    01497      double valueOut_;
    01499      double upperOut_;
    01501      double dualOut_;
    01503      double dualTolerance_;
    01505      double primalTolerance_;
    01507      double sumDualInfeasibilities_;
    01509      double sumPrimalInfeasibilities_;
    01511      double infeasibilityCost_;
    01513      double sumOfRelaxedDualInfeasibilities_;
    01515      double sumOfRelaxedPrimalInfeasibilities_;
    01517      double acceptablePivot_;
    01519      double * lower_;
    01521      double * rowLowerWork_;
    01523      double * columnLowerWork_;
    01525      double * upper_;
    01527      double * rowUpperWork_;
    01529      double * columnUpperWork_;
    01531      double * cost_;
    01533      double * rowObjectiveWork_;
    01535      double * objectiveWork_;
    01537      CoinIndexedVector * rowArray_[6];
    01539      CoinIndexedVector * columnArray_[6];
    01541      int sequenceIn_;
    01543      int directionIn_;
    01545      int sequenceOut_;
    01547      int directionOut_;
    01549      int pivotRow_;
    01551      int lastGoodIteration_;
    01553      double * dj_;
    01555      double * rowReducedCost_;
    01557      double * reducedCostWork_;
    01559      double * solution_;
    01561      double * rowActivityWork_;
    01563      double * columnActivityWork_;
    01565      int numberDualInfeasibilities_;
    01567      int numberDualInfeasibilitiesWithoutFree_;
    01569      int numberPrimalInfeasibilities_;
    01571      int numberRefinements_;
    01573      ClpDualRowPivot * dualRowPivot_;
    01575      ClpPrimalColumnPivot * primalColumnPivot_;
    01577      int * pivotVariable_;
    01579      ClpFactorization * factorization_;
    01581      double * savedSolution_;
    01583      int numberTimesOptimal_;
    01585      ClpDisasterHandler * disasterArea_;
    01587      int changeMade_;
    01589      int algorithm_;
    01592      int forceFactorization_;
    01600      int perturbation_;
    01602      unsigned char * saveStatus_;
    01607      ClpNonLinearCost * nonLinearCost_;
    01609      int lastBadIteration_;
    01611      int lastFlaggedIteration_;
    01613      int numberFake_;
    01615      int numberChanged_;
    01617      int progressFlag_;
    01619      int firstFree_;
    01623      int numberExtraRows_;
    01626      int maximumBasic_;
    01628      int dontFactorizePivots_;
    01638      double incomingInfeasibility_;
    01639      double allowedInfeasibility_;
    01641      int automaticScale_;
    01643      int maximumPerturbationSize_;
    01645      double * perturbationArray_;
    01647      ClpSimplex * baseModel_;
    01649      ClpSimplexProgress progress_;
    01650 #ifdef ABC_INHERIT
    01651   AbcSimplex * abcSimplex_;
    01652 #define CLP_ABC_WANTED 1
    01653 #define CLP_ABC_WANTED_PARALLEL 2
    01654 #define CLP_ABC_FULL_DONE 8
    01655   // bits 256,512,1024 for crash
    01656 #endif
    01657 #define CLP_ABC_BEEN_FEASIBLE 65536
    01658   int abcState_;
    01659 public:
    01661      mutable int spareIntArray_[4];
    01663      mutable double spareDoubleArray_[4];
    01664 protected:
    01666      friend class OsiClpSolverInterface;
    01668 };
    01669 //#############################################################################
    01678 void
    01679 ClpSimplexUnitTest(const std::string & mpsDir);
    01680
    01681 // For Devex stuff
    01682 #define DEVEX_TRY_NORM 1.0e-4
    01683 #define DEVEX_ADD_ONE 1.0
    01684 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines