Ignore:
Timestamp:
Jan 6, 2019 2:43:06 PM (4 months ago)
Author:
unxusr
Message:

formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpSimplex.hpp

    r2322 r2385  
    105105
    106106class ClpSimplex : public ClpModel {
    107      friend void ClpSimplexUnitTest(const std::string & mpsDir);
     107  friend void ClpSimplexUnitTest(const std::string &mpsDir);
    108108
    109109public:
    110      /** enums for status of various sorts.
     110  /** enums for status of various sorts.
    111111         First 4 match CoinWarmStartBasis,
    112112         isFixed means fixed at lower bound and out of basis
    113113     */
    114      enum Status {
    115           isFree = 0x00,
    116           basic = 0x01,
    117           atUpperBound = 0x02,
    118           atLowerBound = 0x03,
    119           superBasic = 0x04,
    120           isFixed = 0x05
    121      };
    122      // For Dual
    123      enum FakeBound {
    124           noFake = 0x00,
    125           lowerFake = 0x01,
    126           upperFake = 0x02,
    127           bothFake = 0x03
    128      };
    129 
    130      /**@name Constructors and destructor and copy */
    131      //@{
    132      /// Default constructor
    133      ClpSimplex (bool emptyMessages = false  );
    134 
    135      /** Copy constructor. May scale depending on mode
     114  enum Status {
     115    isFree = 0x00,
     116    basic = 0x01,
     117    atUpperBound = 0x02,
     118    atLowerBound = 0x03,
     119    superBasic = 0x04,
     120    isFixed = 0x05
     121  };
     122  // For Dual
     123  enum FakeBound {
     124    noFake = 0x00,
     125    lowerFake = 0x01,
     126    upperFake = 0x02,
     127    bothFake = 0x03
     128  };
     129
     130  /**@name Constructors and destructor and copy */
     131  //@{
     132  /// Default constructor
     133  ClpSimplex(bool emptyMessages = false);
     134
     135  /** Copy constructor. May scale depending on mode
    136136         -1 leave mode as is
    137137         0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 dynamic(later)
    138138     */
    139      ClpSimplex(const ClpSimplex & rhs, int scalingMode = -1);
    140      /** Copy constructor from model. May scale depending on mode
     139  ClpSimplex(const ClpSimplex &rhs, int scalingMode = -1);
     140  /** Copy constructor from model. May scale depending on mode
    141141         -1 leave mode as is
    142142         0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 dynamic(later)
    143143     */
    144      ClpSimplex(const ClpModel & rhs, int scalingMode = -1);
    145      /** Subproblem constructor.  A subset of whole model is created from the
     144  ClpSimplex(const ClpModel &rhs, int scalingMode = -1);
     145  /** Subproblem constructor.  A subset of whole model is created from the
    146146         row and column lists given.  The new order is given by list order and
    147147         duplicates are allowed.  Name and integer information can be dropped
     
    149149         in this case duplicates are not allowed (also see getbackSolution)
    150150     */
    151      ClpSimplex (const ClpModel * wholeModel,
    152                  int numberRows, const int * whichRows,
    153                  int numberColumns, const int * whichColumns,
    154                  bool dropNames = true, bool dropIntegers = true,
    155                  bool fixOthers = false);
    156      /** Subproblem constructor.  A subset of whole model is created from the
     151  ClpSimplex(const ClpModel *wholeModel,
     152    int numberRows, const int *whichRows,
     153    int numberColumns, const int *whichColumns,
     154    bool dropNames = true, bool dropIntegers = true,
     155    bool fixOthers = false);
     156  /** Subproblem constructor.  A subset of whole model is created from the
    157157         row and column lists given.  The new order is given by list order and
    158158         duplicates are allowed.  Name and integer information can be dropped
     
    160160         in this case duplicates are not allowed (also see getbackSolution)
    161161     */
    162      ClpSimplex (const ClpSimplex * wholeModel,
    163                  int numberRows, const int * whichRows,
    164                  int numberColumns, const int * whichColumns,
    165                  bool dropNames = true, bool dropIntegers = true,
    166                  bool fixOthers = false);
    167      /** This constructor modifies original ClpSimplex and stores
     162  ClpSimplex(const ClpSimplex *wholeModel,
     163    int numberRows, const int *whichRows,
     164    int numberColumns, const int *whichColumns,
     165    bool dropNames = true, bool dropIntegers = true,
     166    bool fixOthers = false);
     167  /** This constructor modifies original ClpSimplex and stores
    168168         original stuff in created ClpSimplex.  It is only to be used in
    169169         conjunction with originalModel */
    170      ClpSimplex (ClpSimplex * wholeModel,
    171                  int numberColumns, const int * whichColumns);
    172      /** This copies back stuff from miniModel and then deletes miniModel.
     170  ClpSimplex(ClpSimplex *wholeModel,
     171    int numberColumns, const int *whichColumns);
     172  /** This copies back stuff from miniModel and then deletes miniModel.
    173173         Only to be used with mini constructor */
    174      void originalModel(ClpSimplex * miniModel);
     174  void originalModel(ClpSimplex *miniModel);
    175175#ifdef ABC_INHERIT
    176176  inline int abcState() const
    177   { return abcState_;}
     177  {
     178    return abcState_;
     179  }
    178180  inline void setAbcState(int state)
    179   { abcState_=state;}
    180   inline AbcSimplex * abcSimplex() const
    181   { return abcSimplex_;}
    182   inline void setAbcSimplex(AbcSimplex * simplex)
    183   { abcSimplex_=simplex;}
     181  {
     182    abcState_ = state;
     183  }
     184  inline AbcSimplex *abcSimplex() const
     185  {
     186    return abcSimplex_;
     187  }
     188  inline void setAbcSimplex(AbcSimplex *simplex)
     189  {
     190    abcSimplex_ = simplex;
     191  }
    184192  /// Returns 0 if dual can be skipped
    185193  int doAbcDual();
     
    187195  int doAbcPrimal(int ifValuesPass);
    188196#endif
    189      /** Array persistence flag
     197  /** Array persistence flag
    190198         If 0 then as now (delete/new)
    191199         1 then only do arrays if bigger needed
    192200         2 as 1 but give a bit extra if bigger needed
    193201     */
    194      void setPersistenceFlag(int value);
    195      /// Save a copy of model with certain state - normally without cuts
    196      void makeBaseModel();
    197      /// Switch off base model
    198      void deleteBaseModel();
    199      /// See if we have base model
    200      inline ClpSimplex *  baseModel() const {
    201           return baseModel_;
    202      }
    203      /** Reset to base model (just size and arrays needed)
     202  void setPersistenceFlag(int value);
     203  /// Save a copy of model with certain state - normally without cuts
     204  void makeBaseModel();
     205  /// Switch off base model
     206  void deleteBaseModel();
     207  /// See if we have base model
     208  inline ClpSimplex *baseModel() const
     209  {
     210    return baseModel_;
     211  }
     212  /** Reset to base model (just size and arrays needed)
    204213         If model NULL use internal copy
    205214     */
    206      void setToBaseModel(ClpSimplex * model = NULL);
    207      /// Assignment operator. This copies the data
    208      ClpSimplex & operator=(const ClpSimplex & rhs);
    209      /// Destructor
    210      ~ClpSimplex (  );
    211      // Ones below are just ClpModel with some changes
    212      /** Loads a problem (the constraints on the
     215  void setToBaseModel(ClpSimplex *model = NULL);
     216  /// Assignment operator. This copies the data
     217  ClpSimplex &operator=(const ClpSimplex &rhs);
     218  /// Destructor
     219  ~ClpSimplex();
     220  // Ones below are just ClpModel with some changes
     221  /** Loads a problem (the constraints on the
    213222           rows are given by lower and upper bounds). If a pointer is 0 then the
    214223           following values are the default:
     
    221230           </ul>
    222231       */
    223      void loadProblem (  const ClpMatrixBase& matrix,
    224                          const double* collb, const double* colub,
    225                          const double* obj,
    226                          const double* rowlb, const double* rowub,
    227                          const double * rowObjective = NULL);
    228      void loadProblem (  const CoinPackedMatrix& matrix,
    229                          const double* collb, const double* colub,
    230                          const double* obj,
    231                          const double* rowlb, const double* rowub,
    232                          const double * rowObjective = NULL);
    233 
    234      /** Just like the other loadProblem() method except that the matrix is
     232  void loadProblem(const ClpMatrixBase &matrix,
     233    const double *collb, const double *colub,
     234    const double *obj,
     235    const double *rowlb, const double *rowub,
     236    const double *rowObjective = NULL);
     237  void loadProblem(const CoinPackedMatrix &matrix,
     238    const double *collb, const double *colub,
     239    const double *obj,
     240    const double *rowlb, const double *rowub,
     241    const double *rowObjective = NULL);
     242
     243  /** Just like the other loadProblem() method except that the matrix is
    235244       given in a standard column major ordered format (without gaps). */
    236      void loadProblem (  const int numcols, const int numrows,
    237                          const CoinBigIndex* start, const int* index,
    238                          const double* value,
    239                          const double* collb, const double* colub,
    240                          const double* obj,
    241                          const double* rowlb, const double* rowub,
    242                          const double * rowObjective = NULL);
    243      /// This one is for after presolve to save memory
    244      void loadProblem (  const int numcols, const int numrows,
    245                          const CoinBigIndex* start, const int* index,
    246                          const double* value, const int * length,
    247                          const double* collb, const double* colub,
    248                          const double* obj,
    249                          const double* rowlb, const double* rowub,
    250                          const double * rowObjective = NULL);
    251      /** This loads a model from a coinModel object - returns number of errors.
     245  void loadProblem(const int numcols, const int numrows,
     246    const CoinBigIndex *start, const int *index,
     247    const double *value,
     248    const double *collb, const double *colub,
     249    const double *obj,
     250    const double *rowlb, const double *rowub,
     251    const double *rowObjective = NULL);
     252  /// This one is for after presolve to save memory
     253  void loadProblem(const int numcols, const int numrows,
     254    const CoinBigIndex *start, const int *index,
     255    const double *value, const int *length,
     256    const double *collb, const double *colub,
     257    const double *obj,
     258    const double *rowlb, const double *rowub,
     259    const double *rowObjective = NULL);
     260  /** This loads a model from a coinModel object - returns number of errors.
    252261         If keepSolution true and size is same as current then
    253262         keeps current status and solution
    254263     */
    255      int loadProblem (  CoinModel & modelObject, bool keepSolution = false);
    256      /// Read an mps file from the given filename
    257      int readMps(const char *filename,
    258                  bool keepNames = false,
    259                  bool ignoreErrors = false);
    260      /// Read GMPL files from the given filenames
    261      int readGMPL(const char *filename, const char * dataName,
    262                   bool keepNames = false);
    263      /// Read file in LP format from file with name filename.
    264      /// See class CoinLpIO for description of this format.
    265      int readLp(const char *filename, const double epsilon = 1e-5);
    266       /** Write the problem into an Lp file of the given filename.
     264  int loadProblem(CoinModel &modelObject, bool keepSolution = false);
     265  /// Read an mps file from the given filename
     266  int readMps(const char *filename,
     267    bool keepNames = false,
     268    bool ignoreErrors = false);
     269  /// Read GMPL files from the given filenames
     270  int readGMPL(const char *filename, const char *dataName,
     271    bool keepNames = false);
     272  /// Read file in LP format from file with name filename.
     273  /// See class CoinLpIO for description of this format.
     274  int readLp(const char *filename, const double epsilon = 1e-5);
     275  /** Write the problem into an Lp file of the given filename.
    267276          If objSense is non zero then -1.0 forces the code to write a
    268277          maximization objective and +1.0 to write a minimization one.
    269278          If 0.0 then solver can do what it wants.*/
    270       void writeLp(const char *filename,
    271                    const char *extension = "lp",
    272                    double epsilon = 1e-5,
    273                    int numberAcross = 10,
    274                    int decimals = 5,
    275                    double objSense = 0.0,
    276                    bool useRowNames = true) const;
    277      /** Borrow model.  This is so we dont have to copy large amounts
     279  void writeLp(const char *filename,
     280    const char *extension = "lp",
     281    double epsilon = 1e-5,
     282    int numberAcross = 10,
     283    int decimals = 5,
     284    double objSense = 0.0,
     285    bool useRowNames = true) const;
     286  /** Borrow model.  This is so we dont have to copy large amounts
    278287         of data around.  It assumes a derived class wants to overwrite
    279288         an empty model with a real one - while it does an algorithm.
    280289         This is same as ClpModel one, but sets scaling on etc. */
    281      void borrowModel(ClpModel & otherModel);
    282      void borrowModel(ClpSimplex & otherModel);
    283      /// Pass in Event handler (cloned and deleted at end)
    284      void passInEventHandler(const ClpEventHandler * eventHandler);
    285      /// Puts solution back into small model
    286      void getbackSolution(const ClpSimplex & smallModel, const int * whichRow, const int * whichColumn);
    287      /** Load nonlinear part of problem from AMPL info
     290  void borrowModel(ClpModel &otherModel);
     291  void borrowModel(ClpSimplex &otherModel);
     292  /// Pass in Event handler (cloned and deleted at end)
     293  void passInEventHandler(const ClpEventHandler *eventHandler);
     294  /// Puts solution back into small model
     295  void getbackSolution(const ClpSimplex &smallModel, const int *whichRow, const int *whichColumn);
     296  /** Load nonlinear part of problem from AMPL info
    288297         Returns 0 if linear
    289298         1 if quadratic objective
     
    293302         -1 on failure
    294303     */
    295      int loadNonLinear(void * info, int & numberConstraints,
    296                        ClpConstraint ** & constraints);
     304  int loadNonLinear(void *info, int &numberConstraints,
     305    ClpConstraint **&constraints);
    297306#ifdef ABC_INHERIT
    298307  /// Loads tolerances etc
    299   void loadTolerancesEtc(const AbcTolerancesEtc & data);
     308  void loadTolerancesEtc(const AbcTolerancesEtc &data);
    300309  /// Unloads tolerances etc
    301   void unloadTolerancesEtc(AbcTolerancesEtc & data);
    302 #endif
    303      //@}
    304 
    305      /**@name Functions most useful to user */
    306      //@{
    307      /** General solve algorithm which can do presolve.
     310  void unloadTolerancesEtc(AbcTolerancesEtc &data);
     311#endif
     312  //@}
     313
     314  /**@name Functions most useful to user */
     315  //@{
     316  /** General solve algorithm which can do presolve.
    308317         See  ClpSolve.hpp for options
    309318      */
    310      int initialSolve(ClpSolve & options);
    311      /// Default initial solve
    312      int initialSolve();
    313      /// Dual initial solve
    314      int initialDualSolve();
    315      /// Primal initial solve
    316      int initialPrimalSolve();
    317      /// Barrier initial solve
    318      int initialBarrierSolve();
    319      /// Barrier initial solve, not to be followed by crossover
    320      int initialBarrierNoCrossSolve();
    321      /** Dual algorithm - see ClpSimplexDual.hpp for method.
     319  int initialSolve(ClpSolve &options);
     320  /// Default initial solve
     321  int initialSolve();
     322  /// Dual initial solve
     323  int initialDualSolve();
     324  /// Primal initial solve
     325  int initialPrimalSolve();
     326  /// Barrier initial solve
     327  int initialBarrierSolve();
     328  /// Barrier initial solve, not to be followed by crossover
     329  int initialBarrierNoCrossSolve();
     330  /** Dual algorithm - see ClpSimplexDual.hpp for method.
    322331         ifValuesPass==2 just does values pass and then stops.
    323332
     
    329338         maybe other bits later
    330339     */
    331      int dual(int ifValuesPass = 0, int startFinishOptions = 0);
    332      // If using Debug
    333      int dualDebug(int ifValuesPass = 0, int startFinishOptions = 0);
    334      /** Primal algorithm - see ClpSimplexPrimal.hpp for method.
     340  int dual(int ifValuesPass = 0, int startFinishOptions = 0);
     341  // If using Debug
     342  int dualDebug(int ifValuesPass = 0, int startFinishOptions = 0);
     343  /** Primal algorithm - see ClpSimplexPrimal.hpp for method.
    335344         ifValuesPass==2 just does values pass and then stops.
    336345
     
    342351         maybe other bits later
    343352     */
    344      int primal(int ifValuesPass = 0, int startFinishOptions = 0);
    345      /** Solves nonlinear problem using SLP - may be used as crash
     353  int primal(int ifValuesPass = 0, int startFinishOptions = 0);
     354  /** Solves nonlinear problem using SLP - may be used as crash
    346355         for other algorithms when number of iterations small.
    347356         Also exits if all problematical variables are changing
    348357         less than deltaTolerance
    349358     */
    350      int nonlinearSLP(int numberPasses, double deltaTolerance);
    351      /** Solves problem with nonlinear constraints using SLP - may be used as crash
     359  int nonlinearSLP(int numberPasses, double deltaTolerance);
     360  /** Solves problem with nonlinear constraints using SLP - may be used as crash
    352361         for other algorithms when number of iterations small.
    353362         Also exits if all problematical variables are changing
    354363         less than deltaTolerance
    355364     */
    356      int nonlinearSLP(int numberConstraints, ClpConstraint ** constraints,
    357                       int numberPasses, double deltaTolerance);
    358      /** Solves using barrier (assumes you have good cholesky factor code).
     365  int nonlinearSLP(int numberConstraints, ClpConstraint **constraints,
     366    int numberPasses, double deltaTolerance);
     367  /** Solves using barrier (assumes you have good cholesky factor code).
    359368         Does crossover to simplex if asked*/
    360      int barrier(bool crossover = true);
    361      /** Solves non-linear using reduced gradient.  Phase = 0 get feasible,
     369  int barrier(bool crossover = true);
     370  /** Solves non-linear using reduced gradient.  Phase = 0 get feasible,
    362371         =1 use solution */
    363      int reducedGradient(int phase = 0);
    364      /// Solve using structure of model and maybe in parallel
    365      int solve(CoinStructuredModel * model);
     372  int reducedGradient(int phase = 0);
     373  /// Solve using structure of model and maybe in parallel
     374  int solve(CoinStructuredModel *model);
    366375#ifdef ABC_INHERIT
    367376  /** solvetype 0 for dual, 1 for primal
     
    370379      add 10 to return AbcSimplex
    371380  */
    372   AbcSimplex * dealWithAbc(int solveType,int startUp,bool interrupt=false);
     381  AbcSimplex *dealWithAbc(int solveType, int startUp, bool interrupt = false);
    373382  //void dealWithAbc(int solveType,int startUp,bool interrupt=false);
    374383#endif
    375      /** This loads a model from a CoinStructuredModel object - returns number of errors.
     384  /** This loads a model from a CoinStructuredModel object - returns number of errors.
    376385         If originalOrder then keep to order stored in blocks,
    377386         otherwise first column/rows correspond to first block - etc.
     
    379388         keeps current status and solution
    380389     */
    381      int loadProblem (  CoinStructuredModel & modelObject,
    382                         bool originalOrder = true, bool keepSolution = false);
    383      /**
     390  int loadProblem(CoinStructuredModel &modelObject,
     391    bool originalOrder = true, bool keepSolution = false);
     392  /**
    384393        When scaling is on it is possible that the scaled problem
    385394        is feasible but the unscaled is not.  Clp returns a secondary
     
    395404        return code as dual/primal
    396405     */
    397      int cleanup(int cleanupScaling);
    398      /** Clean primal solution
     406  int cleanup(int cleanupScaling);
     407  /** Clean primal solution
    399408         If you expect solution to only have exact multiples of "exactMultiple" then
    400409         this tries moving solution values to nearest multiple.  If still feasible
     
    406415         The dual version may be written if this gets used.
    407416      */
    408       int cleanPrimalSolution(double exactMultiple);
    409      /** Dual ranging.
     417  int cleanPrimalSolution(double exactMultiple);
     418  /** Dual ranging.
    410419         This computes increase/decrease in cost for each given variable and corresponding
    411420         sequence numbers which would change basis.  Sequence numbers are 0..numberColumns
     
    427436         Returns non-zero if infeasible unbounded etc
    428437     */
    429      int dualRanging(int numberCheck, const int * which,
    430                      double * costIncrease, int * sequenceIncrease,
    431                      double * costDecrease, int * sequenceDecrease,
    432                      double * valueIncrease = NULL, double * valueDecrease = NULL);
    433      /** Primal ranging.
     438  int dualRanging(int numberCheck, const int *which,
     439    double *costIncrease, int *sequenceIncrease,
     440    double *costDecrease, int *sequenceDecrease,
     441    double *valueIncrease = NULL, double *valueDecrease = NULL);
     442  /** Primal ranging.
    434443         This computes increase/decrease in value for each given variable and corresponding
    435444         sequence numbers which would change basis.  Sequence numbers are 0..numberColumns
     
    445454         Returns non-zero if infeasible unbounded etc
    446455     */
    447      int primalRanging(int numberCheck, const int * which,
    448                        double * valueIncrease, int * sequenceIncrease,
    449                        double * valueDecrease, int * sequenceDecrease);
    450      /**
     456  int primalRanging(int numberCheck, const int *which,
     457    double *valueIncrease, int *sequenceIncrease,
     458    double *valueDecrease, int *sequenceDecrease);
     459  /**
    451460        Modifies coefficients etc and if necessary pivots in and out.
    452461        All at same status will be done (basis may go singular).
     
    457466        status array is (char) Status enum
    458467     */
    459      int modifyCoefficientsAndPivot(int number,
    460                                  const int * which,
    461                                  const CoinBigIndex * start,
    462                                  const int * row,
    463                                  const double * newCoefficient,
    464                                  const unsigned char * newStatus=NULL,
    465                                  const double * newLower=NULL,
    466                                  const double * newUpper=NULL,
    467                                  const double * newObjective=NULL);
    468      /** Take out duplicate rows (includes scaled rows and intersections).
     468  int modifyCoefficientsAndPivot(int number,
     469    const int *which,
     470    const CoinBigIndex *start,
     471    const int *row,
     472    const double *newCoefficient,
     473    const unsigned char *newStatus = NULL,
     474    const double *newLower = NULL,
     475    const double *newUpper = NULL,
     476    const double *newObjective = NULL);
     477  /** Take out duplicate rows (includes scaled rows and intersections).
    469478         On exit whichRows has rows to delete - return code is number can be deleted
    470479         or -1 if would be infeasible.
     
    473482         and make row bounds exact multiple of cleanUp if close enough
    474483     */
    475      int outDuplicateRows(int numberLook,int * whichRows, bool noOverlaps=false, double tolerance=-1.0,
    476                           double cleanUp=0.0);
    477      /** Try simple crash like techniques to get closer to primal feasibility
     484  int outDuplicateRows(int numberLook, int *whichRows, bool noOverlaps = false, double tolerance = -1.0,
     485    double cleanUp = 0.0);
     486  /** Try simple crash like techniques to get closer to primal feasibility
    478487         returns final sum of infeasibilities */
    479      double moveTowardsPrimalFeasible();
    480      /** Try simple crash like techniques to remove super basic slacks
     488  double moveTowardsPrimalFeasible();
     489  /** Try simple crash like techniques to remove super basic slacks
    481490         but only if > threshold */
    482      void removeSuperBasicSlacks(int threshold=0);
    483      /** Mini presolve (faster)
     491  void removeSuperBasicSlacks(int threshold = 0);
     492  /** Mini presolve (faster)
    484493         Char arrays must be numberRows and numberColumns long
    485494         on entry second part must be filled in as follows -
     
    493502         user must delete struct
    494503     */
    495      ClpSimplex * miniPresolve(char * rowType, char * columnType,void ** info);
    496      /// After mini presolve
    497      void miniPostsolve(const ClpSimplex * presolvedModel,void * info);
    498      /// mini presolve and solve
    499      void miniSolve(char * rowType, char *columnType,int algorithm, int startUp);
    500      /** Write the basis in MPS format to the specified file.
     504  ClpSimplex *miniPresolve(char *rowType, char *columnType, void **info);
     505  /// After mini presolve
     506  void miniPostsolve(const ClpSimplex *presolvedModel, void *info);
     507  /// mini presolve and solve
     508  void miniSolve(char *rowType, char *columnType, int algorithm, int startUp);
     509  /** Write the basis in MPS format to the specified file.
    501510         If writeValues true writes values of structurals
    502511         (and adds VALUES to end of NAME card)
     
    512521         Returns non-zero on I/O error
    513522     */
    514      int writeBasis(const char *filename,
    515                     bool writeValues = false,
    516                     int formatType = 0) const;
    517      /** Read a basis from the given filename,
     523  int writeBasis(const char *filename,
     524    bool writeValues = false,
     525    int formatType = 0) const;
     526  /** Read a basis from the given filename,
    518527         returns -1 on file error, 0 if no values, 1 if values */
    519      int readBasis(const char *filename);
    520      /// Returns a basis (to be deleted by user)
    521      CoinWarmStartBasis * getBasis() const;
    522      /// Passes in factorization
    523      void setFactorization( ClpFactorization & factorization);
    524      // Swaps factorization
    525      ClpFactorization * swapFactorization( ClpFactorization * factorization);
    526      /// Copies in factorization to existing one
    527      void copyFactorization( ClpFactorization & factorization);
    528      /** Tightens primal bounds to make dual faster.  Unless
     528  int readBasis(const char *filename);
     529  /// Returns a basis (to be deleted by user)
     530  CoinWarmStartBasis *getBasis() const;
     531  /// Passes in factorization
     532  void setFactorization(ClpFactorization &factorization);
     533  // Swaps factorization
     534  ClpFactorization *swapFactorization(ClpFactorization *factorization);
     535  /// Copies in factorization to existing one
     536  void copyFactorization(ClpFactorization &factorization);
     537  /** Tightens primal bounds to make dual faster.  Unless
    529538         fixed or doTight>10, bounds are slightly looser than they could be.
    530539         This is to make dual go faster and is probably not needed
     
    535544         in branch and bound on infeasible branches (0.0 is off)
    536545     */
    537      int tightenPrimalBounds(double factor = 0.0, int doTight = 0, bool tightIntegers = false);
    538      /** Crash - at present just aimed at dual, returns
     546  int tightenPrimalBounds(double factor = 0.0, int doTight = 0, bool tightIntegers = false);
     547  /** Crash - at present just aimed at dual, returns
    539548         -2 if dual preferred and crash basis created
    540549         -1 if dual preferred and all slack basis preferred
     
    552561          2 Mini iterations
    553562     */
    554      int crash(double gap, int pivot);
    555      /// Sets row pivot choice algorithm in dual
    556      void setDualRowPivotAlgorithm(ClpDualRowPivot & choice);
    557      /// Sets column pivot choice algorithm in primal
    558      void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot & choice);
    559      /// Create a hotstart point of the optimization process
    560      void markHotStart(void * & saveStuff);
    561      /// Optimize starting from the hotstart
    562      void solveFromHotStart(void * saveStuff);
    563      /// Delete the snapshot
    564      void unmarkHotStart(void * saveStuff);
    565      /** For strong branching.  On input lower and upper are new bounds
     563  int crash(double gap, int pivot);
     564  /// Sets row pivot choice algorithm in dual
     565  void setDualRowPivotAlgorithm(ClpDualRowPivot &choice);
     566  /// Sets column pivot choice algorithm in primal
     567  void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot &choice);
     568  /// Create a hotstart point of the optimization process
     569  void markHotStart(void *&saveStuff);
     570  /// Optimize starting from the hotstart
     571  void solveFromHotStart(void *saveStuff);
     572  /// Delete the snapshot
     573  void unmarkHotStart(void *saveStuff);
     574  /** For strong branching.  On input lower and upper are new bounds
    566575         while on output they are change in objective function values
    567576         (>1.0e50 infeasible).
     
    571580         status and number of iterations
    572581     */
    573      int strongBranching(int numberVariables, const int * variables,
    574                          double * newLower, double * newUpper,
    575                          double ** outputSolution,
    576                          int * outputStatus, int * outputIterations,
    577                          bool stopOnFirstInfeasible = true,
    578                          bool alwaysFinish = false,
    579                          int startFinishOptions = 0);
    580      /// Fathom - 1 if solution
    581      int fathom(void * stuff);
    582      /** Do up to N deep - returns
     582  int strongBranching(int numberVariables, const int *variables,
     583    double *newLower, double *newUpper,
     584    double **outputSolution,
     585    int *outputStatus, int *outputIterations,
     586    bool stopOnFirstInfeasible = true,
     587    bool alwaysFinish = false,
     588    int startFinishOptions = 0);
     589  /// Fathom - 1 if solution
     590  int fathom(void *stuff);
     591  /** Do up to N deep - returns
    583592         -1 - no solution nNodes_ valid nodes
    584593         >= if solution and that node gives solution
    585594         ClpNode array is 2**N long.  Values for N and
    586595         array are in stuff (nNodes_ also in stuff) */
    587      int fathomMany(void * stuff);
    588      /// Double checks OK
    589      double doubleCheck();
    590      /// Starts Fast dual2
    591      int startFastDual2(ClpNodeStuff * stuff);
    592      /// Like Fast dual
    593      int fastDual2(ClpNodeStuff * stuff);
    594      /// Stops Fast dual2
    595      void stopFastDual2(ClpNodeStuff * stuff);
    596      /** Deals with crunch aspects
     596  int fathomMany(void *stuff);
     597  /// Double checks OK
     598  double doubleCheck();
     599  /// Starts Fast dual2
     600  int startFastDual2(ClpNodeStuff *stuff);
     601  /// Like Fast dual
     602  int fastDual2(ClpNodeStuff *stuff);
     603  /// Stops Fast dual2
     604  void stopFastDual2(ClpNodeStuff *stuff);
     605  /** Deals with crunch aspects
    597606         mode 0 - in
    598607              1 - out with solution
     
    600609         returns small model or NULL
    601610     */
    602      ClpSimplex * fastCrunch(ClpNodeStuff * stuff, int mode);
    603      //@}
    604 
    605      /**@name Needed for functionality of OsiSimplexInterface */
    606      //@{
    607      /** Pivot in a variable and out a variable.  Returns 0 if okay,
     611  ClpSimplex *fastCrunch(ClpNodeStuff *stuff, int mode);
     612  //@}
     613
     614  /**@name Needed for functionality of OsiSimplexInterface */
     615  //@{
     616  /** Pivot in a variable and out a variable.  Returns 0 if okay,
    608617         1 if inaccuracy forced re-factorization, -1 if would be singular.
    609618         Also updates primal/dual infeasibilities.
    610619         Assumes sequenceIn_ and pivotRow_ set and also directionIn and Out.
    611620     */
    612      int pivot();
    613 
    614      /** Pivot in a variable and choose an outgoing one.  Assumes primal
     621  int pivot();
     622
     623  /** Pivot in a variable and choose an outgoing one.  Assumes primal
    615624         feasible - will not go through a bound.  Returns step length in theta
    616625         Returns ray in ray_ (or NULL if no pivot)
    617626         Return codes as before but -1 means no acceptable pivot
    618627     */
    619      int primalPivotResult();
    620 
    621      /** Pivot out a variable and choose an incoing one.  Assumes dual
     628  int primalPivotResult();
     629
     630  /** Pivot out a variable and choose an incoing one.  Assumes dual
    622631         feasible - will not go through a reduced cost.
    623632         Returns step length in theta
    624633         Return codes as before but -1 means no acceptable pivot
    625634     */
    626      int dualPivotResultPart1();
    627      /** Do actual pivot
     635  int dualPivotResultPart1();
     636  /** Do actual pivot
    628637         state is 0 if need tableau column, 1 if in rowArray_[1]
    629638     */
    630   int pivotResultPart2(int algorithm,int state);
    631 
    632      /** Common bits of coding for dual and primal.  Return 0 if okay,
     639  int pivotResultPart2(int algorithm, int state);
     640
     641  /** Common bits of coding for dual and primal.  Return 0 if okay,
    633642         1 if bad matrix, 2 if very bad factorization
    634643
     
    641650
    642651     */
    643      int startup(int ifValuesPass, int startFinishOptions = 0);
    644      void finish(int startFinishOptions = 0);
    645 
    646      /** Factorizes and returns true if optimal.  Used by user */
    647      bool statusOfProblem(bool initial = false);
    648      /// If user left factorization frequency then compute
    649      void defaultFactorizationFrequency();
    650      /// Copy across enabled stuff from one solver to another
    651      void copyEnabledStuff(const ClpSimplex * rhs);
    652      //@}
    653 
    654      /**@name most useful gets and sets */
    655      //@{
    656      /// If problem is primal feasible
    657      inline bool primalFeasible() const {
    658           return (numberPrimalInfeasibilities_ == 0);
    659      }
    660      /// If problem is dual feasible
    661      inline bool dualFeasible() const {
    662           return (numberDualInfeasibilities_ == 0);
    663      }
    664      /// factorization
    665      inline ClpFactorization * factorization() const {
    666           return factorization_;
    667      }
    668      /// Sparsity on or off
    669      bool sparseFactorization() const;
    670      void setSparseFactorization(bool value);
    671      /// Factorization frequency
    672      int factorizationFrequency() const;
    673      void setFactorizationFrequency(int value);
    674      /// Dual bound
    675      inline double dualBound() const {
    676           return dualBound_;
    677      }
    678      void setDualBound(double value);
    679      /// Infeasibility cost
    680      inline double infeasibilityCost() const {
    681           return infeasibilityCost_;
    682      }
    683      void setInfeasibilityCost(double value);
    684      /** Amount of print out:
     652  int startup(int ifValuesPass, int startFinishOptions = 0);
     653  void finish(int startFinishOptions = 0);
     654
     655  /** Factorizes and returns true if optimal.  Used by user */
     656  bool statusOfProblem(bool initial = false);
     657  /// If user left factorization frequency then compute
     658  void defaultFactorizationFrequency();
     659  /// Copy across enabled stuff from one solver to another
     660  void copyEnabledStuff(const ClpSimplex *rhs);
     661  //@}
     662
     663  /**@name most useful gets and sets */
     664  //@{
     665  /// If problem is primal feasible
     666  inline bool primalFeasible() const
     667  {
     668    return (numberPrimalInfeasibilities_ == 0);
     669  }
     670  /// If problem is dual feasible
     671  inline bool dualFeasible() const
     672  {
     673    return (numberDualInfeasibilities_ == 0);
     674  }
     675  /// factorization
     676  inline ClpFactorization *factorization() const
     677  {
     678    return factorization_;
     679  }
     680  /// Sparsity on or off
     681  bool sparseFactorization() const;
     682  void setSparseFactorization(bool value);
     683  /// Factorization frequency
     684  int factorizationFrequency() const;
     685  void setFactorizationFrequency(int value);
     686  /// Dual bound
     687  inline double dualBound() const
     688  {
     689    return dualBound_;
     690  }
     691  void setDualBound(double value);
     692  /// Infeasibility cost
     693  inline double infeasibilityCost() const
     694  {
     695    return infeasibilityCost_;
     696  }
     697  void setInfeasibilityCost(double value);
     698  /** Amount of print out:
    685699         0 - none
    686700         1 - just final
     
    690704         above that 8,16,32 etc just for selective debug
    691705     */
    692      /** Perturbation:
     706  /** Perturbation:
    693707         50  - switch on perturbation
    694708         100 - auto perturb if takes too long (1.0e-6 largest nonzero)
     
    698712         others are for playing
    699713     */
    700      inline int perturbation() const {
    701           return perturbation_;
    702      }
    703      void setPerturbation(int value);
    704      /// Current (or last) algorithm
    705      inline int algorithm() const {
    706           return algorithm_;
    707      }
    708      /// Set algorithm
    709      inline void setAlgorithm(int value) {
    710           algorithm_ = value;
    711      }
    712      /// Return true if the objective limit test can be relied upon
    713      bool isObjectiveLimitTestValid() const ;
    714      /// Sum of dual infeasibilities
    715      inline double sumDualInfeasibilities() const {
    716           return sumDualInfeasibilities_;
    717      }
    718      inline void setSumDualInfeasibilities(double value) {
    719           sumDualInfeasibilities_ = value;
    720      }
    721      /// Sum of relaxed dual infeasibilities
    722      inline double sumOfRelaxedDualInfeasibilities() const {
    723           return sumOfRelaxedDualInfeasibilities_;
    724      }
    725      inline void setSumOfRelaxedDualInfeasibilities(double value) {
    726           sumOfRelaxedDualInfeasibilities_ = value;
    727      }
    728      /// Number of dual infeasibilities
    729      inline int numberDualInfeasibilities() const {
    730           return numberDualInfeasibilities_;
    731      }
    732      inline void setNumberDualInfeasibilities(int value) {
    733           numberDualInfeasibilities_ = value;
    734      }
    735      /// Number of dual infeasibilities (without free)
    736      inline int numberDualInfeasibilitiesWithoutFree() const {
    737           return numberDualInfeasibilitiesWithoutFree_;
    738      }
    739      /// Sum of primal infeasibilities
    740      inline double sumPrimalInfeasibilities() const {
    741           return sumPrimalInfeasibilities_;
    742      }
    743      inline void setSumPrimalInfeasibilities(double value) {
    744           sumPrimalInfeasibilities_ = value;
    745      }
    746      /// Sum of relaxed primal infeasibilities
    747      inline double sumOfRelaxedPrimalInfeasibilities() const {
    748           return sumOfRelaxedPrimalInfeasibilities_;
    749      }
    750      inline void setSumOfRelaxedPrimalInfeasibilities(double value) {
    751           sumOfRelaxedPrimalInfeasibilities_ = value;
    752      }
    753      /// Number of primal infeasibilities
    754      inline int numberPrimalInfeasibilities() const {
    755           return numberPrimalInfeasibilities_;
    756      }
    757      inline void setNumberPrimalInfeasibilities(int value) {
    758           numberPrimalInfeasibilities_ = value;
    759      }
    760      /** Save model to file, returns 0 if success.  This is designed for
     714  inline int perturbation() const
     715  {
     716    return perturbation_;
     717  }
     718  void setPerturbation(int value);
     719  /// Current (or last) algorithm
     720  inline int algorithm() const
     721  {
     722    return algorithm_;
     723  }
     724  /// Set algorithm
     725  inline void setAlgorithm(int value)
     726  {
     727    algorithm_ = value;
     728  }
     729  /// Return true if the objective limit test can be relied upon
     730  bool isObjectiveLimitTestValid() const;
     731  /// Sum of dual infeasibilities
     732  inline double sumDualInfeasibilities() const
     733  {
     734    return sumDualInfeasibilities_;
     735  }
     736  inline void setSumDualInfeasibilities(double value)
     737  {
     738    sumDualInfeasibilities_ = value;
     739  }
     740  /// Sum of relaxed dual infeasibilities
     741  inline double sumOfRelaxedDualInfeasibilities() const
     742  {
     743    return sumOfRelaxedDualInfeasibilities_;
     744  }
     745  inline void setSumOfRelaxedDualInfeasibilities(double value)
     746  {
     747    sumOfRelaxedDualInfeasibilities_ = value;
     748  }
     749  /// Number of dual infeasibilities
     750  inline int numberDualInfeasibilities() const
     751  {
     752    return numberDualInfeasibilities_;
     753  }
     754  inline void setNumberDualInfeasibilities(int value)
     755  {
     756    numberDualInfeasibilities_ = value;
     757  }
     758  /// Number of dual infeasibilities (without free)
     759  inline int numberDualInfeasibilitiesWithoutFree() const
     760  {
     761    return numberDualInfeasibilitiesWithoutFree_;
     762  }
     763  /// Sum of primal infeasibilities
     764  inline double sumPrimalInfeasibilities() const
     765  {
     766    return sumPrimalInfeasibilities_;
     767  }
     768  inline void setSumPrimalInfeasibilities(double value)
     769  {
     770    sumPrimalInfeasibilities_ = value;
     771  }
     772  /// Sum of relaxed primal infeasibilities
     773  inline double sumOfRelaxedPrimalInfeasibilities() const
     774  {
     775    return sumOfRelaxedPrimalInfeasibilities_;
     776  }
     777  inline void setSumOfRelaxedPrimalInfeasibilities(double value)
     778  {
     779    sumOfRelaxedPrimalInfeasibilities_ = value;
     780  }
     781  /// Number of primal infeasibilities
     782  inline int numberPrimalInfeasibilities() const
     783  {
     784    return numberPrimalInfeasibilities_;
     785  }
     786  inline void setNumberPrimalInfeasibilities(int value)
     787  {
     788    numberPrimalInfeasibilities_ = value;
     789  }
     790  /** Save model to file, returns 0 if success.  This is designed for
    761791         use outside algorithms so does not save iterating arrays etc.
    762792     It does not save any messaging information.
     
    764794     It does not know about all types of virtual functions.
    765795     */
    766      int saveModel(const char * fileName);
    767      /** Restore model from file, returns 0 if success,
     796  int saveModel(const char *fileName);
     797  /** Restore model from file, returns 0 if success,
    768798         deletes current model */
    769      int restoreModel(const char * fileName);
    770 
    771      /** Just check solution (for external use) - sets sum of
     799  int restoreModel(const char *fileName);
     800
     801  /** Just check solution (for external use) - sets sum of
    772802         infeasibilities etc.
    773803         If setToBounds 0 then primal column values not changed
     
    776806         indicated bound and if any values changed (or ==2)  basic values re-computed.
    777807     */
    778      void checkSolution(int setToBounds = 0);
    779      /** Just check solution (for internal use) - sets sum of
     808  void checkSolution(int setToBounds = 0);
     809  /** Just check solution (for internal use) - sets sum of
    780810         infeasibilities etc. */
    781      void checkSolutionInternal();
    782      /// Check unscaled primal solution but allow for rounding error
    783      void checkUnscaledSolution();
    784      /// Useful row length arrays (0,1,2,3,4,5)
    785      inline CoinIndexedVector * rowArray(int index) const {
    786           return rowArray_[index];
    787      }
    788      /// Useful column length arrays (0,1,2,3,4,5)
    789      inline CoinIndexedVector * columnArray(int index) const {
    790           return columnArray_[index];
    791      }
    792      //@}
    793 
    794      /******************** End of most useful part **************/
    795      /**@name Functions less likely to be useful to casual user */
    796      //@{
    797      /** Given an existing factorization computes and checks
     811  void checkSolutionInternal();
     812  /// Check unscaled primal solution but allow for rounding error
     813  void checkUnscaledSolution();
     814  /// Useful row length arrays (0,1,2,3,4,5)
     815  inline CoinIndexedVector *rowArray(int index) const
     816  {
     817    return rowArray_[index];
     818  }
     819  /// Useful column length arrays (0,1,2,3,4,5)
     820  inline CoinIndexedVector *columnArray(int index) const
     821  {
     822    return columnArray_[index];
     823  }
     824  //@}
     825
     826  /******************** End of most useful part **************/
     827  /**@name Functions less likely to be useful to casual user */
     828  //@{
     829  /** Given an existing factorization computes and checks
    798830         primal and dual solutions.  Uses input arrays for variables at
    799831         bounds.  Returns feasibility states */
    800      int getSolution (  const double * rowActivities,
    801                         const double * columnActivities);
    802      /** Given an existing factorization computes and checks
     832  int getSolution(const double *rowActivities,
     833    const double *columnActivities);
     834  /** Given an existing factorization computes and checks
    803835         primal and dual solutions.  Uses current problem arrays for
    804836         bounds.  Returns feasibility states */
    805      int getSolution ();
    806      /** Constructs a non linear cost from list of non-linearities (columns only)
     837  int getSolution();
     838  /** Constructs a non linear cost from list of non-linearities (columns only)
    807839         First lower of each column is taken as real lower
    808840         Last lower is taken as real upper and cost ignored
     
    810842         Returns nonzero if bad data e.g. lowers not monotonic
    811843     */
    812      int createPiecewiseLinearCosts(const int * starts,
    813                                     const double * lower, const double * gradient);
    814      /// dual row pivot choice
    815      inline ClpDualRowPivot * dualRowPivot() const {
    816           return dualRowPivot_;
    817      }
    818      /// primal column pivot choice
    819      inline ClpPrimalColumnPivot * primalColumnPivot() const {
    820           return primalColumnPivot_;
    821      }
    822      /// Returns true if model looks OK
    823      inline bool goodAccuracy() const {
    824           return (largestPrimalError_ < 1.0e-7 && largestDualError_ < 1.0e-7);
    825      }
    826      /** Return model - updates any scalars */
    827      void returnModel(ClpSimplex & otherModel);
    828      /** Factorizes using current basis.
     844  int createPiecewiseLinearCosts(const int *starts,
     845    const double *lower, const double *gradient);
     846  /// dual row pivot choice
     847  inline ClpDualRowPivot *dualRowPivot() const
     848  {
     849    return dualRowPivot_;
     850  }
     851  /// primal column pivot choice
     852  inline ClpPrimalColumnPivot *primalColumnPivot() const
     853  {
     854    return primalColumnPivot_;
     855  }
     856  /// Returns true if model looks OK
     857  inline bool goodAccuracy() const
     858  {
     859    return (largestPrimalError_ < 1.0e-7 && largestDualError_ < 1.0e-7);
     860  }
     861  /** Return model - updates any scalars */
     862  void returnModel(ClpSimplex &otherModel);
     863  /** Factorizes using current basis.
    829864         solveType - 1 iterating, 0 initial, -1 external
    830865         If 10 added then in primal values pass
     
    833868         Special case is numberRows_+1 -> all slack basis.
    834869     */
    835      int internalFactorize(int solveType);
    836      /// Save data
    837      ClpDataSave saveData() ;
    838      /// Restore data
    839      void restoreData(ClpDataSave saved);
    840      /// Clean up status
    841      void cleanStatus();
    842      /// Factorizes using current basis. For external use
    843      int factorize();
    844      /** Computes duals from scratch. If givenDjs then
     870  int internalFactorize(int solveType);
     871  /// Save data
     872  ClpDataSave saveData();
     873  /// Restore data
     874  void restoreData(ClpDataSave saved);
     875  /// Clean up status
     876  void cleanStatus();
     877  /// Factorizes using current basis. For external use
     878  int factorize();
     879  /** Computes duals from scratch. If givenDjs then
    845880         allows for nonzero basic djs */
    846      void computeDuals(double * givenDjs);
    847      /// Computes primals from scratch
    848      void computePrimals (  const double * rowActivities,
    849                             const double * columnActivities);
    850      /** Adds multiple of a column into an array */
    851      void add(double * array,
    852               int column, double multiplier) const;
    853      /**
     881  void computeDuals(double *givenDjs);
     882  /// Computes primals from scratch
     883  void computePrimals(const double *rowActivities,
     884    const double *columnActivities);
     885  /** Adds multiple of a column into an array */
     886  void add(double *array,
     887    int column, double multiplier) const;
     888  /**
    854889        Unpacks one column of the matrix into indexed array
    855890        Uses sequenceIn_
    856891        Also applies scaling if needed
    857892     */
    858      void unpack(CoinIndexedVector * rowArray) const ;
    859      /**
     893  void unpack(CoinIndexedVector *rowArray) const;
     894  /**
    860895        Unpacks one column of the matrix into indexed array
    861896        Slack if sequence>= numberColumns
    862897        Also applies scaling if needed
    863898     */
    864      void unpack(CoinIndexedVector * rowArray, int sequence) const;
    865      /**
     899  void unpack(CoinIndexedVector *rowArray, int sequence) const;
     900  /**
    866901        Unpacks one column of the matrix into indexed array
    867902        ** as packed vector
     
    869904        Also applies scaling if needed
    870905     */
    871      void unpackPacked(CoinIndexedVector * rowArray) ;
    872      /**
     906  void unpackPacked(CoinIndexedVector *rowArray);
     907  /**
    873908        Unpacks one column of the matrix into indexed array
    874909        ** as packed vector
     
    876911        Also applies scaling if needed
    877912     */
    878      void unpackPacked(CoinIndexedVector * rowArray, int sequence);
     913  void unpackPacked(CoinIndexedVector *rowArray, int sequence);
    879914#ifndef CLP_USER_DRIVEN
    880915protected:
    881916#endif
    882      /**
     917  /**
    883918         This does basis housekeeping and does values for in/out variables.
    884919         Can also decide to re-factorize
    885920     */
    886      int housekeeping(double objectiveChange);
    887      /** This sets largest infeasibility and most infeasible and sum
     921  int housekeeping(double objectiveChange);
     922  /** This sets largest infeasibility and most infeasible and sum
    888923         and number of infeasibilities (Primal) */
    889      void checkPrimalSolution(const double * rowActivities = NULL,
    890                               const double * columnActivies = NULL);
    891      /** This sets largest infeasibility and most infeasible and sum
     924  void checkPrimalSolution(const double *rowActivities = NULL,
     925    const double *columnActivies = NULL);
     926  /** This sets largest infeasibility and most infeasible and sum
    892927         and number of infeasibilities (Dual) */
    893      void checkDualSolution();
    894      /** This sets sum and number of infeasibilities (Dual and Primal) */
    895      void checkBothSolutions();
    896      /**  If input negative scales objective so maximum <= -value
     928  void checkDualSolution();
     929  /** This sets sum and number of infeasibilities (Dual and Primal) */
     930  void checkBothSolutions();
     931  /**  If input negative scales objective so maximum <= -value
    897932          and returns scale factor used.  If positive unscales and also
    898933          redoes dual stuff
    899934     */
    900      double scaleObjective(double value);
    901      /// Solve using Dantzig-Wolfe decomposition and maybe in parallel
    902     int solveDW(CoinStructuredModel * model, ClpSolve & options);
    903      /// Solve using Benders decomposition and maybe in parallel
    904      int solveBenders(CoinStructuredModel * model, ClpSolve & options);
     935  double scaleObjective(double value);
     936  /// Solve using Dantzig-Wolfe decomposition and maybe in parallel
     937  int solveDW(CoinStructuredModel *model, ClpSolve &options);
     938  /// Solve using Benders decomposition and maybe in parallel
     939  int solveBenders(CoinStructuredModel *model, ClpSolve &options);
     940
    905941public:
    906      /** For advanced use.  When doing iterative solves things can get
     942  /** For advanced use.  When doing iterative solves things can get
    907943         nasty so on values pass if incoming solution has largest
    908944         infeasibility < incomingInfeasibility throw out variables
     
    914950         Defaults are 1.0,10.0
    915951     */
    916      void setValuesPassAction(double incomingInfeasibility,
    917                               double allowedInfeasibility);
    918      /** Get a clean factorization - i.e. throw out singularities
     952  void setValuesPassAction(double incomingInfeasibility,
     953    double allowedInfeasibility);
     954  /** Get a clean factorization - i.e. throw out singularities
    919955         may do more later */
    920      int cleanFactorization(int ifValuesPass);
    921      //@}
    922      /**@name most useful gets and sets */
    923      //@{
     956  int cleanFactorization(int ifValuesPass);
     957  //@}
     958  /**@name most useful gets and sets */
     959  //@{
    924960public:
    925      /// Initial value for alpha accuracy calculation (-1.0 off)
    926      inline double alphaAccuracy() const {
    927           return alphaAccuracy_;
    928      }
    929      inline void setAlphaAccuracy(double value) {
    930           alphaAccuracy_ = value;
    931      }
     961  /// Initial value for alpha accuracy calculation (-1.0 off)
     962  inline double alphaAccuracy() const
     963  {
     964    return alphaAccuracy_;
     965  }
     966  inline void setAlphaAccuracy(double value)
     967  {
     968    alphaAccuracy_ = value;
     969  }
     970
    932971public:
    933      /// Objective value
    934      //inline double objectiveValue() const {
    935      //return (objectiveValue_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset];
    936      //}
    937      /// Set disaster handler
    938      inline void setDisasterHandler(ClpDisasterHandler * handler) {
    939           disasterArea_ = handler;
    940      }
    941      /// Get disaster handler
    942      inline ClpDisasterHandler * disasterHandler() const {
    943           return disasterArea_;
    944      }
    945      /// Large bound value (for complementarity etc)
    946      inline double largeValue() const {
    947           return largeValue_;
    948      }
    949      void setLargeValue( double value) ;
    950      /// Largest error on Ax-b
    951      inline double largestPrimalError() const {
    952           return largestPrimalError_;
    953      }
    954      /// Largest error on basic duals
    955      inline double largestDualError() const {
    956           return largestDualError_;
    957      }
    958      /// Largest error on Ax-b
    959      inline void setLargestPrimalError(double value) {
    960           largestPrimalError_ = value;
    961      }
    962      /// Largest error on basic duals
    963      inline void setLargestDualError(double value) {
    964           largestDualError_ = value;
    965      }
    966      /// Get zero tolerance
    967      inline double zeroTolerance() const {
    968           return zeroTolerance_;/*factorization_->zeroTolerance();*/
    969      }
    970      /// Set zero tolerance
    971      inline void setZeroTolerance( double value) {
    972           zeroTolerance_ = value;
    973      }
    974      /// Basic variables pivoting on which rows
    975      inline int * pivotVariable() const {
    976           return pivotVariable_;
    977      }
    978      /// If automatic scaling on
    979      inline bool automaticScaling() const {
    980           return automaticScale_ != 0;
    981      }
    982      inline void setAutomaticScaling(bool onOff) {
    983           automaticScale_ = onOff ? 1 : 0;
    984      }
    985      /// Current dual tolerance
    986      inline double currentDualTolerance() const {
    987           return dualTolerance_;
    988      }
    989      inline void setCurrentDualTolerance(double value) {
    990           dualTolerance_ = value;
    991      }
    992      /// Current primal tolerance
    993      inline double currentPrimalTolerance() const {
    994           return primalTolerance_;
    995      }
    996      inline void setCurrentPrimalTolerance(double value) {
    997           primalTolerance_ = value;
    998      }
    999      /// How many iterative refinements to do
    1000      inline int numberRefinements() const {
    1001           return numberRefinements_;
    1002      }
    1003      void setNumberRefinements( int value) ;
    1004      /// Alpha (pivot element) for use by classes e.g. steepestedge
    1005      inline double alpha() const {
    1006           return alpha_;
    1007      }
    1008      inline void setAlpha(double value) {
    1009           alpha_ = value;
    1010      }
    1011      /// Reduced cost of last incoming for use by classes e.g. steepestedge
    1012      inline double dualIn() const {
    1013           return dualIn_;
    1014      }
    1015      /// Set reduced cost of last incoming to force error
    1016      inline void setDualIn(double value) {
    1017           dualIn_ = value;
    1018      }
    1019      /// Pivot Row for use by classes e.g. steepestedge
    1020      inline int pivotRow() const {
    1021           return pivotRow_;
    1022      }
    1023      inline void setPivotRow(int value) {
    1024           pivotRow_ = value;
    1025      }
    1026      /// value of incoming variable (in Dual)
    1027      double valueIncomingDual() const;
    1028      //@}
     972  /// Objective value
     973  //inline double objectiveValue() const {
     974  //return (objectiveValue_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset];
     975  //}
     976  /// Set disaster handler
     977  inline void setDisasterHandler(ClpDisasterHandler *handler)
     978  {
     979    disasterArea_ = handler;
     980  }
     981  /// Get disaster handler
     982  inline ClpDisasterHandler *disasterHandler() const
     983  {
     984    return disasterArea_;
     985  }
     986  /// Large bound value (for complementarity etc)
     987  inline double largeValue() const
     988  {
     989    return largeValue_;
     990  }
     991  void setLargeValue(double value);
     992  /// Largest error on Ax-b
     993  inline double largestPrimalError() const
     994  {
     995    return largestPrimalError_;
     996  }
     997  /// Largest error on basic duals
     998  inline double largestDualError() const
     999  {
     1000    return largestDualError_;
     1001  }
     1002  /// Largest error on Ax-b
     1003  inline void setLargestPrimalError(double value)
     1004  {
     1005    largestPrimalError_ = value;
     1006  }
     1007  /// Largest error on basic duals
     1008  inline void setLargestDualError(double value)
     1009  {
     1010    largestDualError_ = value;
     1011  }
     1012  /// Get zero tolerance
     1013  inline double zeroTolerance() const
     1014  {
     1015    return zeroTolerance_; /*factorization_->zeroTolerance();*/
     1016  }
     1017  /// Set zero tolerance
     1018  inline void setZeroTolerance(double value)
     1019  {
     1020    zeroTolerance_ = value;
     1021  }
     1022  /// Basic variables pivoting on which rows
     1023  inline int *pivotVariable() const
     1024  {
     1025    return pivotVariable_;
     1026  }
     1027  /// If automatic scaling on
     1028  inline bool automaticScaling() const
     1029  {
     1030    return automaticScale_ != 0;
     1031  }
     1032  inline void setAutomaticScaling(bool onOff)
     1033  {
     1034    automaticScale_ = onOff ? 1 : 0;
     1035  }
     1036  /// Current dual tolerance
     1037  inline double currentDualTolerance() const
     1038  {
     1039    return dualTolerance_;
     1040  }
     1041  inline void setCurrentDualTolerance(double value)
     1042  {
     1043    dualTolerance_ = value;
     1044  }
     1045  /// Current primal tolerance
     1046  inline double currentPrimalTolerance() const
     1047  {
     1048    return primalTolerance_;
     1049  }
     1050  inline void setCurrentPrimalTolerance(double value)
     1051  {
     1052    primalTolerance_ = value;
     1053  }
     1054  /// How many iterative refinements to do
     1055  inline int numberRefinements() const
     1056  {
     1057    return numberRefinements_;
     1058  }
     1059  void setNumberRefinements(int value);
     1060  /// Alpha (pivot element) for use by classes e.g. steepestedge
     1061  inline double alpha() const
     1062  {
     1063    return alpha_;
     1064  }
     1065  inline void setAlpha(double value)
     1066  {
     1067    alpha_ = value;
     1068  }
     1069  /// Reduced cost of last incoming for use by classes e.g. steepestedge
     1070  inline double dualIn() const
     1071  {
     1072    return dualIn_;
     1073  }
     1074  /// Set reduced cost of last incoming to force error
     1075  inline void setDualIn(double value)
     1076  {
     1077    dualIn_ = value;
     1078  }
     1079  /// Pivot Row for use by classes e.g. steepestedge
     1080  inline int pivotRow() const
     1081  {
     1082    return pivotRow_;
     1083  }
     1084  inline void setPivotRow(int value)
     1085  {
     1086    pivotRow_ = value;
     1087  }
     1088  /// value of incoming variable (in Dual)
     1089  double valueIncomingDual() const;
     1090  //@}
    10291091
    10301092#ifndef CLP_USER_DRIVEN
    10311093protected:
    10321094#endif
    1033      /**@name protected methods */
    1034      //@{
    1035      /** May change basis and then returns number changed.
     1095  /**@name protected methods */
     1096  //@{
     1097  /** May change basis and then returns number changed.
    10361098         Computation of solutions may be overriden by given pi and solution
    10371099     */
    1038      int gutsOfSolution ( double * givenDuals,
    1039                           const double * givenPrimals,
    1040                           bool valuesPass = false);
    1041      /// Does most of deletion (0 = all, 1 = most, 2 most + factorization)
    1042      void gutsOfDelete(int type);
    1043      /// Does most of copying
    1044      void gutsOfCopy(const ClpSimplex & rhs);
    1045      /** puts in format I like (rowLower,rowUpper) also see StandardMatrix
     1100  int gutsOfSolution(double *givenDuals,
     1101    const double *givenPrimals,
     1102    bool valuesPass = false);
     1103  /// Does most of deletion (0 = all, 1 = most, 2 most + factorization)
     1104  void gutsOfDelete(int type);
     1105  /// Does most of copying
     1106  void gutsOfCopy(const ClpSimplex &rhs);
     1107  /** puts in format I like (rowLower,rowUpper) also see StandardMatrix
    10461108         1 bit does rows (now and columns), (2 bit does column bounds), 4 bit does objective(s).
    10471109         8 bit does solution scaling in
     
    10541116         so do arrays but keep pivotVariable_
    10551117     */
    1056      bool createRim(int what, bool makeRowCopy = false, int startFinishOptions = 0);
    1057      /// Does rows and columns
    1058      void createRim1(bool initial);
    1059      /// Does objective
    1060      void createRim4(bool initial);
    1061      /// Does rows and columns and objective
    1062      void createRim5(bool initial);
    1063      /** releases above arrays and does solution scaling out.  May also
     1118  bool createRim(int what, bool makeRowCopy = false, int startFinishOptions = 0);
     1119  /// Does rows and columns
     1120  void createRim1(bool initial);
     1121  /// Does objective
     1122  void createRim4(bool initial);
     1123  /// Does rows and columns and objective
     1124  void createRim5(bool initial);
     1125  /** releases above arrays and does solution scaling out.  May also
    10641126         get rid of factorization data -
    10651127         0 get rid of nothing, 1 get rid of arrays, 2 also factorization
    10661128     */
    1067      void deleteRim(int getRidOfFactorizationData = 2);
    1068      /// Sanity check on input rim data (after scaling) - returns true if okay
    1069      bool sanityCheck();
    1070      //@}
     1129  void deleteRim(int getRidOfFactorizationData = 2);
     1130  /// Sanity check on input rim data (after scaling) - returns true if okay
     1131  bool sanityCheck();
     1132  //@}
    10711133public:
    1072      /**@name public methods */
    1073      //@{
    1074      /** Return row or column sections - not as much needed as it
     1134  /**@name public methods */
     1135  //@{
     1136  /** Return row or column sections - not as much needed as it
    10751137         once was.  These just map into single arrays */
    1076      inline double * solutionRegion(int section) const {
    1077           if (!section) return rowActivityWork_;
    1078           else return columnActivityWork_;
    1079      }
    1080      inline double * djRegion(int section) const {
    1081           if (!section) return rowReducedCost_;
    1082           else return reducedCostWork_;
    1083      }
    1084      inline double * lowerRegion(int section) const {
    1085           if (!section) return rowLowerWork_;
    1086           else return columnLowerWork_;
    1087      }
    1088      inline double * upperRegion(int section) const {
    1089           if (!section) return rowUpperWork_;
    1090           else return columnUpperWork_;
    1091      }
    1092      inline double * costRegion(int section) const {
    1093           if (!section) return rowObjectiveWork_;
    1094           else return objectiveWork_;
    1095      }
    1096      /// Return region as single array
    1097      inline double * solutionRegion() const {
    1098           return solution_;
    1099      }
    1100      inline double * djRegion() const {
    1101           return dj_;
    1102      }
    1103      inline double * lowerRegion() const {
    1104           return lower_;
    1105      }
    1106      inline double * upperRegion() const {
    1107           return upper_;
    1108      }
    1109      inline double * costRegion() const {
    1110           return cost_;
    1111      }
    1112      inline Status getStatus(int sequence) const {
    1113           return static_cast<Status> (status_[sequence] & 7);
    1114      }
    1115      inline void setStatus(int sequence, Status newstatus) {
    1116           unsigned char & st_byte = status_[sequence];
    1117           st_byte = static_cast<unsigned char>(st_byte & ~7);
    1118           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    1119      }
    1120      /// Start or reset using maximumRows_ and Columns_ - true if change
    1121      bool startPermanentArrays();
    1122      /** Normally the first factorization does sparse coding because
     1138  inline double *solutionRegion(int section) const
     1139  {
     1140    if (!section)
     1141      return rowActivityWork_;
     1142    else
     1143      return columnActivityWork_;
     1144  }
     1145  inline double *djRegion(int section) const
     1146  {
     1147    if (!section)
     1148      return rowReducedCost_;
     1149    else
     1150      return reducedCostWork_;
     1151  }
     1152  inline double *lowerRegion(int section) const
     1153  {
     1154    if (!section)
     1155      return rowLowerWork_;
     1156    else
     1157      return columnLowerWork_;
     1158  }
     1159  inline double *upperRegion(int section) const
     1160  {
     1161    if (!section)
     1162      return rowUpperWork_;
     1163    else
     1164      return columnUpperWork_;
     1165  }
     1166  inline double *costRegion(int section) const
     1167  {
     1168    if (!section)
     1169      return rowObjectiveWork_;
     1170    else
     1171      return objectiveWork_;
     1172  }
     1173  /// Return region as single array
     1174  inline double *solutionRegion() const
     1175  {
     1176    return solution_;
     1177  }
     1178  inline double *djRegion() const
     1179  {
     1180    return dj_;
     1181  }
     1182  inline double *lowerRegion() const
     1183  {
     1184    return lower_;
     1185  }
     1186  inline double *upperRegion() const
     1187  {
     1188    return upper_;
     1189  }
     1190  inline double *costRegion() const
     1191  {
     1192    return cost_;
     1193  }
     1194  inline Status getStatus(int sequence) const
     1195  {
     1196    return static_cast< Status >(status_[sequence] & 7);
     1197  }
     1198  inline void setStatus(int sequence, Status newstatus)
     1199  {
     1200    unsigned char &st_byte = status_[sequence];
     1201    st_byte = static_cast< unsigned char >(st_byte & ~7);
     1202    st_byte = static_cast< unsigned char >(st_byte | newstatus);
     1203  }
     1204  /// Start or reset using maximumRows_ and Columns_ - true if change
     1205  bool startPermanentArrays();
     1206  /** Normally the first factorization does sparse coding because
    11231207         the factorization could be singular.  This allows initial dense
    11241208         factorization when it is known to be safe
    11251209     */
    1126      void setInitialDenseFactorization(bool onOff);
    1127      bool  initialDenseFactorization() const;
    1128      /** Return sequence In or Out */
    1129      inline int sequenceIn() const {
    1130           return sequenceIn_;
    1131      }
    1132      inline int sequenceOut() const {
    1133           return sequenceOut_;
    1134      }
    1135      /** Set sequenceIn or Out */
    1136      inline void  setSequenceIn(int sequence) {
    1137           sequenceIn_ = sequence;
    1138      }
    1139      inline void  setSequenceOut(int sequence) {
    1140           sequenceOut_ = sequence;
    1141      }
    1142      /** Return direction In or Out */
    1143      inline int directionIn() const {
    1144           return directionIn_;
    1145      }
    1146      inline int directionOut() const {
    1147           return directionOut_;
    1148      }
    1149      /** Set directionIn or Out */
    1150      inline void  setDirectionIn(int direction) {
    1151           directionIn_ = direction;
    1152      }
    1153      inline void  setDirectionOut(int direction) {
    1154           directionOut_ = direction;
    1155      }
    1156      /// Value of Out variable
    1157      inline double valueOut() const {
    1158           return valueOut_;
    1159      }
    1160      /// Lower of out variable
    1161      inline double lowerOut() const {
    1162           return lowerOut_ ;
    1163      }
    1164      /// Upper of out variable
    1165      inline double upperOut() const {
    1166           return upperOut_ ;
    1167      }
    1168      /// Set value of out variable
    1169      inline void setValueOut(double value) {
    1170           valueOut_ = value;
    1171      }
    1172      /// Dual value of Out variable
    1173      inline double dualOut() const {
    1174           return dualOut_;
    1175      }
    1176      /// Set dual value of out variable
    1177      inline void setDualOut(double value) {
    1178           dualOut_ = value;
    1179      }
    1180      /// Set lower of out variable
    1181      inline void setLowerOut(double value) {
    1182           lowerOut_ = value;
    1183      }
    1184      /// Set upper of out variable
    1185      inline void setUpperOut(double value) {
    1186           upperOut_ = value;
    1187      }
    1188      /// Set theta of out variable
    1189      inline void setTheta(double value) {
    1190           theta_ = value;
    1191      }
    1192      /// Returns 1 if sequence indicates column
    1193      inline int isColumn(int sequence) const {
    1194           return sequence < numberColumns_ ? 1 : 0;
    1195      }
    1196      /// Returns sequence number within section
    1197      inline int sequenceWithin(int sequence) const {
    1198           return sequence < numberColumns_ ? sequence : sequence - numberColumns_;
    1199      }
    1200      /// Return row or column values
    1201      inline double solution(int sequence) {
    1202           return solution_[sequence];
    1203      }
    1204      /// Return address of row or column values
    1205      inline double & solutionAddress(int sequence) {
    1206           return solution_[sequence];
    1207      }
    1208      inline double reducedCost(int sequence) {
    1209           return dj_[sequence];
    1210      }
    1211      inline double & reducedCostAddress(int sequence) {
    1212           return dj_[sequence];
    1213      }
    1214      inline double lower(int sequence) {
    1215           return lower_[sequence];
    1216      }
    1217      /// Return address of row or column lower bound
    1218      inline double & lowerAddress(int sequence) {
    1219           return lower_[sequence];
    1220      }
    1221      inline double upper(int sequence) {
    1222           return upper_[sequence];
    1223      }
    1224      /// Return address of row or column upper bound
    1225      inline double & upperAddress(int sequence) {
    1226           return upper_[sequence];
    1227      }
    1228      inline double cost(int sequence) {
    1229           return cost_[sequence];
    1230      }
    1231      /// Return address of row or column cost
    1232      inline double & costAddress(int sequence) {
    1233           return cost_[sequence];
    1234      }
    1235      /// Return original lower bound
    1236      inline double originalLower(int iSequence) const {
    1237           if (iSequence < numberColumns_) return columnLower_[iSequence];
    1238           else
    1239                return rowLower_[iSequence-numberColumns_];
    1240      }
    1241      /// Return original lower bound
    1242      inline double originalUpper(int iSequence) const {
    1243           if (iSequence < numberColumns_) return columnUpper_[iSequence];
    1244           else
    1245                return rowUpper_[iSequence-numberColumns_];
    1246      }
    1247      /// Theta (pivot change)
    1248      inline double theta() const {
    1249           return theta_;
    1250      }
    1251      /// Lower Bound on In variable
    1252      inline double lowerIn() const
    1253      { return lowerIn_;}
    1254      /// Value of In variable
    1255      inline double valueIn() const
    1256      { return valueIn_;}
    1257      /// Upper Bound on In variable
    1258      inline double upperIn() const
    1259      { return upperIn_;}
    1260      /** Best possible improvement using djs (primal) or
     1210  void setInitialDenseFactorization(bool onOff);
     1211  bool initialDenseFactorization() const;
     1212  /** Return sequence In or Out */
     1213  inline int sequenceIn() const
     1214  {
     1215    return sequenceIn_;
     1216  }
     1217  inline int sequenceOut() const
     1218  {
     1219    return sequenceOut_;
     1220  }
     1221  /** Set sequenceIn or Out */
     1222  inline void setSequenceIn(int sequence)
     1223  {
     1224    sequenceIn_ = sequence;
     1225  }
     1226  inline void setSequenceOut(int sequence)
     1227  {
     1228    sequenceOut_ = sequence;
     1229  }
     1230  /** Return direction In or Out */
     1231  inline int directionIn() const
     1232  {
     1233    return directionIn_;
     1234  }
     1235  inline int directionOut() const
     1236  {
     1237    return directionOut_;
     1238  }
     1239  /** Set directionIn or Out */
     1240  inline void setDirectionIn(int direction)
     1241  {
     1242    directionIn_ = direction;
     1243  }
     1244  inline void setDirectionOut(int direction)
     1245  {
     1246    directionOut_ = direction;
     1247  }
     1248  /// Value of Out variable
     1249  inline double valueOut() const
     1250  {
     1251    return valueOut_;
     1252  }
     1253  /// Lower of out variable
     1254  inline double lowerOut() const
     1255  {
     1256    return lowerOut_;
     1257  }
     1258  /// Upper of out variable
     1259  inline double upperOut() const
     1260  {
     1261    return upperOut_;
     1262  }
     1263  /// Set value of out variable
     1264  inline void setValueOut(double value)
     1265  {
     1266    valueOut_ = value;
     1267  }
     1268  /// Dual value of Out variable
     1269  inline double dualOut() const
     1270  {
     1271    return dualOut_;
     1272  }
     1273  /// Set dual value of out variable
     1274  inline void setDualOut(double value)
     1275  {
     1276    dualOut_ = value;
     1277  }
     1278  /// Set lower of out variable
     1279  inline void setLowerOut(double value)
     1280  {
     1281    lowerOut_ = value;
     1282  }
     1283  /// Set upper of out variable
     1284  inline void setUpperOut(double value)
     1285  {
     1286    upperOut_ = value;
     1287  }
     1288  /// Set theta of out variable
     1289  inline void setTheta(double value)
     1290  {
     1291    theta_ = value;
     1292  }
     1293  /// Returns 1 if sequence indicates column
     1294  inline int isColumn(int sequence) const
     1295  {
     1296    return sequence < numberColumns_ ? 1 : 0;
     1297  }
     1298  /// Returns sequence number within section
     1299  inline int sequenceWithin(int sequence) const
     1300  {
     1301    return sequence < numberColumns_ ? sequence : sequence - numberColumns_;
     1302  }
     1303  /// Return row or column values
     1304  inline double solution(int sequence)
     1305  {
     1306    return solution_[sequence];
     1307  }
     1308  /// Return address of row or column values
     1309  inline double &solutionAddress(int sequence)
     1310  {
     1311    return solution_[sequence];
     1312  }
     1313  inline double reducedCost(int sequence)
     1314  {
     1315    return dj_[sequence];
     1316  }
     1317  inline double &reducedCostAddress(int sequence)
     1318  {
     1319    return dj_[sequence];
     1320  }
     1321  inline double lower(int sequence)
     1322  {
     1323    return lower_[sequence];
     1324  }
     1325  /// Return address of row or column lower bound
     1326  inline double &lowerAddress(int sequence)
     1327  {
     1328    return lower_[sequence];
     1329  }
     1330  inline double upper(int sequence)
     1331  {
     1332    return upper_[sequence];
     1333  }
     1334  /// Return address of row or column upper bound
     1335  inline double &upperAddress(int sequence)
     1336  {
     1337    return upper_[sequence];
     1338  }
     1339  inline double cost(int sequence)
     1340  {
     1341    return cost_[sequence];
     1342  }
     1343  /// Return address of row or column cost
     1344  inline double &costAddress(int sequence)
     1345  {
     1346    return cost_[sequence];
     1347  }
     1348  /// Return original lower bound
     1349  inline double originalLower(int iSequence) const
     1350  {
     1351    if (iSequence < numberColumns_)
     1352      return columnLower_[iSequence];
     1353    else
     1354      return rowLower_[iSequence - numberColumns_];
     1355  }
     1356  /// Return original lower bound
     1357  inline double originalUpper(int iSequence) const
     1358  {
     1359    if (iSequence < numberColumns_)
     1360      return columnUpper_[iSequence];
     1361    else
     1362      return rowUpper_[iSequence - numberColumns_];
     1363  }
     1364  /// Theta (pivot change)
     1365  inline double theta() const
     1366  {
     1367    return theta_;
     1368  }
     1369  /// Lower Bound on In variable
     1370  inline double lowerIn() const
     1371  {
     1372    return lowerIn_;
     1373  }
     1374  /// Value of In variable
     1375  inline double valueIn() const
     1376  {
     1377    return valueIn_;
     1378  }
     1379  /// Upper Bound on In variable
     1380  inline double upperIn() const
     1381  {
     1382    return upperIn_;
     1383  }
     1384  /** Best possible improvement using djs (primal) or
    12611385         obj change by flipping bounds to make dual feasible (dual) */
    1262      inline double bestPossibleImprovement() const {
    1263           return bestPossibleImprovement_;
    1264      }
    1265      /// Return pointer to details of costs
    1266      inline ClpNonLinearCost * nonLinearCost() const {
    1267           return nonLinearCost_;
    1268      }
    1269      /// Set pointer to details of costs
    1270      void setNonLinearCost(ClpNonLinearCost & nonLinearCost);
    1271      /** Return more special options
     1386  inline double bestPossibleImprovement() const
     1387  {
     1388    return bestPossibleImprovement_;
     1389  }
     1390  /// Return pointer to details of costs
     1391  inline ClpNonLinearCost *nonLinearCost() const
     1392  {
     1393    return nonLinearCost_;
     1394  }
     1395  /// Set pointer to details of costs
     1396  void setNonLinearCost(ClpNonLinearCost &nonLinearCost);
     1397  /** Return more special options
    12721398         1 bit - if presolve says infeasible in ClpSolve return
    12731399         2 bit - if presolved problem infeasible return
     
    12951421         16777216 bit - if factorization kept can still declare optimal at once
    12961422     */
    1297      inline int moreSpecialOptions() const {
    1298           return moreSpecialOptions_;
    1299      }
    1300      /// Get vector mode
    1301      inline int vectorMode() const {
    1302           return vectorMode_;
    1303      }
    1304      /** Set more special options
     1423  inline int moreSpecialOptions() const
     1424  {
     1425    return moreSpecialOptions_;
     1426  }
     1427  /// Get vector mode
     1428  inline int vectorMode() const
     1429  {
     1430    return vectorMode_;
     1431  }
     1432  /** Set more special options
    13051433         1 bit - if presolve says infeasible in ClpSolve return
    13061434         2 bit - if presolved problem infeasible return
     
    13281456         16777216 bit - if factorization kept can still declare optimal at once
    13291457     */
    1330      inline void setMoreSpecialOptions(int value) {
    1331           moreSpecialOptions_ = value;
    1332      }
    1333      /// Set vector mode
    1334      inline void setVectorMode(int value) {
    1335           vectorMode_ = value;
    1336      }
    1337      //@}
    1338      /**@name status methods */
    1339      //@{
    1340      inline void setFakeBound(int sequence, FakeBound fakeBound) {
    1341           unsigned char & st_byte = status_[sequence];
    1342           st_byte = static_cast<unsigned char>(st_byte & ~24);
    1343           st_byte = static_cast<unsigned char>(st_byte | (fakeBound << 3));
    1344      }
    1345      inline FakeBound getFakeBound(int sequence) const {
    1346           return static_cast<FakeBound> ((status_[sequence] >> 3) & 3);
    1347      }
    1348      inline void setRowStatus(int sequence, Status newstatus) {
    1349           unsigned char & st_byte = status_[sequence+numberColumns_];
    1350           st_byte = static_cast<unsigned char>(st_byte & ~7);
    1351           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    1352      }
    1353      inline Status getRowStatus(int sequence) const {
    1354           return static_cast<Status> (status_[sequence+numberColumns_] & 7);
    1355      }
    1356      inline void setColumnStatus(int sequence, Status newstatus) {
    1357           unsigned char & st_byte = status_[sequence];
    1358           st_byte = static_cast<unsigned char>(st_byte & ~7);
    1359           st_byte = static_cast<unsigned char>(st_byte | newstatus);
    1360      }
    1361      inline Status getColumnStatus(int sequence) const {
    1362           return static_cast<Status> (status_[sequence] & 7);
    1363      }
    1364      inline void setPivoted( int sequence) {
    1365           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 32);
    1366      }
    1367      inline void clearPivoted( int sequence) {
    1368           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~32);
    1369      }
    1370      inline bool pivoted(int sequence) const {
    1371           return (((status_[sequence] >> 5) & 1) != 0);
    1372      }
    1373      /// To flag a variable (not inline to allow for column generation)
    1374      void setFlagged( int sequence);
    1375      inline void clearFlagged( int sequence) {
    1376           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~64);
    1377      }
    1378      inline bool flagged(int sequence) const {
    1379           return ((status_[sequence] & 64) != 0);
    1380      }
    1381      /// To say row active in primal pivot row choice
    1382      inline void setActive( int iRow) {
    1383           status_[iRow] = static_cast<unsigned char>(status_[iRow] | 128);
    1384      }
    1385      inline void clearActive( int iRow) {
    1386           status_[iRow] = static_cast<unsigned char>(status_[iRow] & ~128);
    1387      }
    1388      inline bool active(int iRow) const {
    1389           return ((status_[iRow] & 128) != 0);
    1390      }
    1391      /// To say perturbed
    1392      inline void setPerturbed( int iSequence) {
    1393           status_[iSequence] = static_cast<unsigned char>(status_[iSequence] | 128);
    1394      }
    1395      inline void clearPerturbed( int iSequence) {
    1396           status_[iSequence] = static_cast<unsigned char>(status_[iSequence] & ~128);
    1397      }
    1398      inline bool perturbed(int iSequence) const {
    1399           return ((status_[iSequence] & 128) != 0);
    1400      }
    1401      /** Set up status array (can be used by OsiClp).
     1458  inline void setMoreSpecialOptions(int value)
     1459  {
     1460    moreSpecialOptions_ = value;
     1461  }
     1462  /// Set vector mode
     1463  inline void setVectorMode(int value)
     1464  {
     1465    vectorMode_ = value;
     1466  }
     1467  //@}
     1468  /**@name status methods */
     1469  //@{
     1470  inline void setFakeBound(int sequence, FakeBound fakeBound)
     1471  {
     1472    unsigned char &st_byte = status_[sequence];
     1473    st_byte = static_cast< unsigned char >(st_byte & ~24);
     1474    st_byte = static_cast< unsigned char >(st_byte | (fakeBound << 3));
     1475  }
     1476  inline FakeBound getFakeBound(int sequence) const
     1477  {
     1478    return static_cast< FakeBound >((status_[sequence] >> 3) & 3);
     1479  }
     1480  inline void setRowStatus(int sequence, Status newstatus)
     1481  {
     1482    unsigned char &st_byte = status_[sequence + numberColumns_];
     1483    st_byte = static_cast< unsigned char >(st_byte & ~7);
     1484    st_byte = static_cast< unsigned char >(st_byte | newstatus);
     1485  }
     1486  inline Status getRowStatus(int sequence) const
     1487  {
     1488    return static_cast< Status >(status_[sequence + numberColumns_] & 7);
     1489  }
     1490  inline void setColumnStatus(int sequence, Status newstatus)
     1491  {
     1492    unsigned char &st_byte = status_[sequence];
     1493    st_byte = static_cast< unsigned char >(st_byte & ~7);
     1494    st_byte = static_cast< unsigned char >(st_byte | newstatus);
     1495  }
     1496  inline Status getColumnStatus(int sequence) const
     1497  {
     1498    return static_cast< Status >(status_[sequence] & 7);
     1499  }
     1500  inline void setPivoted(int sequence)
     1501  {
     1502    status_[sequence] = static_cast< unsigned char >(status_[sequence] | 32);
     1503  }
     1504  inline void clearPivoted(int sequence)
     1505  {
     1506    status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~32);
     1507  }
     1508  inline bool pivoted(int sequence) const
     1509  {
     1510    return (((status_[sequence] >> 5) & 1) != 0);
     1511  }
     1512  /// To flag a variable (not inline to allow for column generation)
     1513  void setFlagged(int sequence);
     1514  inline void clearFlagged(int sequence)
     1515  {
     1516    status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~64);
     1517  }
     1518  inline bool flagged(int sequence) const
     1519  {
     1520    return ((status_[sequence] & 64) != 0);
     1521  }
     1522  /// To say row active in primal pivot row choice
     1523  inline void setActive(int iRow)
     1524  {
     1525    status_[iRow] = static_cast< unsigned char >(status_[iRow] | 128);
     1526  }
     1527  inline void clearActive(int iRow)
     1528  {
     1529    status_[iRow] = static_cast< unsigned char >(status_[iRow] & ~128);
     1530  }
     1531  inline bool active(int iRow) const
     1532  {
     1533    return ((status_[iRow] & 128) != 0);
     1534  }
     1535  /// To say perturbed
     1536  inline void setPerturbed(int iSequence)
     1537  {
     1538    status_[iSequence] = static_cast< unsigned char >(status_[iSequence] | 128);
     1539  }
     1540  inline void clearPerturbed(int iSequence)
     1541  {
     1542    status_[iSequence] = static_cast< unsigned char >(status_[iSequence] & ~128);
     1543  }
     1544  inline bool perturbed(int iSequence) const
     1545  {
     1546    return ((status_[iSequence] & 128) != 0);
     1547  }
     1548  /** Set up status array (can be used by OsiClp).
    14021549         Also can be used to set up all slack basis */
    1403      void createStatus() ;
    1404      /** Sets up all slack basis and resets solution to
     1550  void createStatus();
     1551  /** Sets up all slack basis and resets solution to
    14051552         as it was after initial load or readMps */
    1406      void allSlackBasis(bool resetSolution = false);
    1407 
    1408      /// So we know when to be cautious
    1409      inline int lastBadIteration() const {
    1410           return lastBadIteration_;
    1411      }
    1412      /// Set so we know when to be cautious
    1413      inline void setLastBadIteration(int value) {
    1414           lastBadIteration_=value;
    1415      }
    1416      /// Progress flag - at present 0 bit says artificials out
    1417      inline int progressFlag() const {
    1418           return (progressFlag_ & 3);
    1419      }
    1420      /// For dealing with all issues of cycling etc
    1421      inline ClpSimplexProgress * progress()
    1422      { return &progress_;}
    1423      /// Force re-factorization early value
    1424      inline int forceFactorization() const {
    1425           return forceFactorization_ ;
    1426      }
    1427      /// Force re-factorization early
    1428      inline void forceFactorization(int value) {
    1429           forceFactorization_ = value;
    1430      }
    1431      /// Raw objective value (so always minimize in primal)
    1432      inline double rawObjectiveValue() const {
    1433           return objectiveValue_;
    1434      }
    1435      /// Compute objective value from solution and put in objectiveValue_
    1436      void computeObjectiveValue(bool useWorkingSolution = false);
    1437      /// Compute minimization objective value from internal solution without perturbation
    1438      double computeInternalObjectiveValue();
    1439      /** Infeasibility/unbounded ray (NULL returned if none/wrong)
     1553  void allSlackBasis(bool resetSolution = false);
     1554
     1555  /// So we know when to be cautious
     1556  inline int lastBadIteration() const
     1557  {
     1558    return lastBadIteration_;
     1559  }
     1560  /// Set so we know when to be cautious
     1561  inline void setLastBadIteration(int value)
     1562  {
     1563    lastBadIteration_ = value;
     1564  }
     1565  /// Progress flag - at present 0 bit says artificials out
     1566  inline int progressFlag() const
     1567  {
     1568    return (progressFlag_ & 3);
     1569  }
     1570  /// For dealing with all issues of cycling etc
     1571  inline ClpSimplexProgress *progress()
     1572  {
     1573    return &progress_;
     1574  }
     1575  /// Force re-factorization early value
     1576  inline int forceFactorization() const
     1577  {
     1578    return forceFactorization_;
     1579  }
     1580  /// Force re-factorization early
     1581  inline void forceFactorization(int value)
     1582  {
     1583    forceFactorization_ = value;
     1584  }
     1585  /// Raw objective value (so always minimize in primal)
     1586  inline double rawObjectiveValue() const
     1587  {
     1588    return objectiveValue_;
     1589  }
     1590  /// Compute objective value from solution and put in objectiveValue_
     1591  void computeObjectiveValue(bool useWorkingSolution = false);
     1592  /// Compute minimization objective value from internal solution without perturbation
     1593  double computeInternalObjectiveValue();
     1594  /** Infeasibility/unbounded ray (NULL returned if none/wrong)
    14401595         Up to user to use delete [] on these arrays.  */
    1441      double * infeasibilityRay(bool fullRay=false) const;
    1442      /** Number of extra rows.  These are ones which will be dynamically created
     1596  double *infeasibilityRay(bool fullRay = false) const;
     1597  /** Number of extra rows.  These are ones which will be dynamically created
    14431598         each iteration.  This is for GUB but may have other uses.
    14441599     */
    1445      inline int numberExtraRows() const {
    1446           return numberExtraRows_;
    1447      }
    1448      /** Maximum number of basic variables - can be more than number of rows if GUB
    1449      */
    1450      inline int maximumBasic() const {
    1451           return maximumBasic_;
    1452      }
    1453      /// Iteration when we entered dual or primal
    1454      inline int baseIteration() const {
    1455           return baseIteration_;
    1456      }
    1457      /// Create C++ lines to get to current state
    1458      void generateCpp( FILE * fp, bool defaultFactor = false);
    1459      /// Gets clean and emptyish factorization
    1460      ClpFactorization * getEmptyFactorization();
    1461      /// May delete or may make clean and emptyish factorization
    1462      void setEmptyFactorization();
    1463      /// Move status and solution across
    1464      void moveInfo(const ClpSimplex & rhs, bool justStatus = false);
    1465      //@}
    1466 
    1467      ///@name Basis handling
    1468      // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
    1469      // *** At present only without scaling
    1470      // *** Slacks havve -1.0 element (so == row activity) - take care
    1471      ///Get a row of the tableau (slack part in slack if not NULL)
    1472      void getBInvARow(int row, double* z, double * slack = NULL);
    1473 
    1474      ///Get a row of the basis inverse
    1475      void getBInvRow(int row, double* z);
    1476 
    1477      ///Get a column of the tableau
    1478      void getBInvACol(int col, double* vec);
    1479 
    1480      ///Get a column of the basis inverse
    1481      void getBInvCol(int col, double* vec);
    1482 
    1483      /** Get basic indices (order of indices corresponds to the
     1600  inline int numberExtraRows() const
     1601  {
     1602    return numberExtraRows_;
     1603  }
     1604  /** Maximum number of basic variables - can be more than number of rows if GUB
     1605     */
     1606  inline int maximumBasic() const
     1607  {
     1608    return maximumBasic_;
     1609  }
     1610  /// Iteration when we entered dual or primal
     1611  inline int baseIteration() const
     1612  {
     1613    return baseIteration_;
     1614  }
     1615  /// Create C++ lines to get to current state
     1616  void generateCpp(FILE *fp, bool defaultFactor = false);
     1617  /// Gets clean and emptyish factorization
     1618  ClpFactorization *getEmptyFactorization();
     1619  /// May delete or may make clean and emptyish factorization
     1620  void setEmptyFactorization();
     1621  /// Move status and solution across
     1622  void moveInfo(const ClpSimplex &rhs, bool justStatus = false);
     1623  //@}
     1624
     1625  ///@name Basis handling
     1626  // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
     1627  // *** At present only without scaling
     1628  // *** Slacks havve -1.0 element (so == row activity) - take care
     1629  ///Get a row of the tableau (slack part in slack if not NULL)
     1630  void getBInvARow(int row, double *z, double *slack = NULL);
     1631
     1632  ///Get a row of the basis inverse
     1633  void getBInvRow(int row, double *z);
     1634
     1635  ///Get a column of the tableau
     1636  void getBInvACol(int col, double *vec);
     1637
     1638  ///Get a column of the basis inverse
     1639  void getBInvCol(int col, double *vec);
     1640
     1641  /** Get basic indices (order of indices corresponds to the
    14841642         order of elements in a vector retured by getBInvACol() and
    14851643         getBInvCol()).
    14861644     */
    1487      void getBasics(int* index);
    1488 
    1489      //@}
    1490      //-------------------------------------------------------------------------
    1491      /**@name Changing bounds on variables and constraints */
    1492      //@{
    1493      /** Set an objective function coefficient */
    1494      void setObjectiveCoefficient( int elementIndex, double elementValue );
    1495      /** Set an objective function coefficient */
    1496      inline void setObjCoeff( int elementIndex, double elementValue ) {
    1497           setObjectiveCoefficient( elementIndex, elementValue);
    1498      }
    1499 
    1500      /** Set a single column lower bound<br>
     1645  void getBasics(int *index);
     1646
     1647  //@}
     1648  //-------------------------------------------------------------------------
     1649  /**@name Changing bounds on variables and constraints */
     1650  //@{
     1651  /** Set an objective function coefficient */
     1652  void setObjectiveCoefficient(int elementIndex, double elementValue);
     1653  /** Set an objective function coefficient */
     1654  inline void setObjCoeff(int elementIndex, double elementValue)
     1655  {
     1656    setObjectiveCoefficient(elementIndex, elementValue);
     1657  }
     1658
     1659  /** Set a single column lower bound<br>
    15011660         Use -DBL_MAX for -infinity. */
    1502      void setColumnLower( int elementIndex, double elementValue );
    1503 
    1504      /** Set a single column upper bound<br>
     1661  void setColumnLower(int elementIndex, double elementValue);
     1662
     1663  /** Set a single column upper bound<br>
    15051664         Use DBL_MAX for infinity. */
    1506      void setColumnUpper( int elementIndex, double elementValue );
    1507 
    1508      /** Set a single column lower and upper bound */
    1509      void setColumnBounds( int elementIndex,
    1510                            double lower, double upper );
    1511 
    1512      /** Set the bounds on a number of columns simultaneously<br>
     1665  void setColumnUpper(int elementIndex, double elementValue);
     1666
     1667  /** Set a single column lower and upper bound */
     1668  void setColumnBounds(int elementIndex,
     1669    double lower, double upper);
     1670
     1671  /** Set the bounds on a number of columns simultaneously<br>
    15131672         The default implementation just invokes setColLower() and
    15141673         setColUpper() over and over again.
     
    15181677         @param boundList the new lower/upper bound pairs for the variables
    15191678     */
    1520      void setColumnSetBounds(const int* indexFirst,
    1521                              const int* indexLast,
    1522                              const double* boundList);
    1523 
    1524      /** Set a single column lower bound<br>
     1679  void setColumnSetBounds(const int *indexFirst,
     1680    const int *indexLast,
     1681    const double *boundList);
     1682
     1683  /** Set a single column lower bound<br>
    15251684         Use -DBL_MAX for -infinity. */
    1526      inline void setColLower( int elementIndex, double elementValue ) {
    1527           setColumnLower(elementIndex, elementValue);
    1528      }
    1529      /** Set a single column upper bound<br>
     1685  inline void setColLower(int elementIndex, double elementValue)
     1686  {
     1687    setColumnLower(elementIndex, elementValue);
     1688  }
     1689  /** Set a single column upper bound<br>
    15301690         Use DBL_MAX for infinity. */
    1531      inline void setColUpper( int elementIndex, double elementValue ) {
    1532           setColumnUpper(elementIndex, elementValue);
    1533      }
    1534 
    1535      /** Set a single column lower and upper bound */
    1536      inline void setColBounds( int elementIndex,
    1537                                double newlower, double newupper ) {
    1538           setColumnBounds(elementIndex, newlower, newupper);
    1539      }
    1540 
    1541      /** Set the bounds on a number of columns simultaneously<br>
     1691  inline void setColUpper(int elementIndex, double elementValue)
     1692  {
     1693    setColumnUpper(elementIndex, elementValue);
     1694  }
     1695
     1696  /** Set a single column lower and upper bound */
     1697  inline void setColBounds(int elementIndex,
     1698    double newlower, double newupper)
     1699  {
     1700    setColumnBounds(elementIndex, newlower, newupper);
     1701  }
     1702
     1703  /** Set the bounds on a number of columns simultaneously<br>
    15421704         @param indexFirst,indexLast pointers to the beginning and after the
    15431705            end of the array of the indices of the variables whose
     
    15451707         @param boundList the new lower/upper bound pairs for the variables
    15461708     */
    1547      inline void setColSetBounds(const int* indexFirst,
    1548                                  const int* indexLast,
    1549                                  const double* boundList) {
    1550           setColumnSetBounds(indexFirst, indexLast, boundList);
    1551      }
    1552 
    1553      /** Set a single row lower bound<br>
     1709  inline void setColSetBounds(const int *indexFirst,
     1710    const int *indexLast,
     1711    const double *boundList)
     1712  {
     1713    setColumnSetBounds(indexFirst, indexLast, boundList);
     1714  }
     1715
     1716  /** Set a single row lower bound<br>
    15541717         Use -DBL_MAX for -infinity. */
    1555      void setRowLower( int elementIndex, double elementValue );
    1556 
    1557      /** Set a single row upper bound<br>
     1718  void setRowLower(int elementIndex, double elementValue);
     1719
     1720  /** Set a single row upper bound<br>
    15581721         Use DBL_MAX for infinity. */
    1559      void setRowUpper( int elementIndex, double elementValue ) ;
    1560 
    1561      /** Set a single row lower and upper bound */
    1562      void setRowBounds( int elementIndex,
    1563                         double lower, double upper ) ;
    1564 
    1565      /** Set the bounds on a number of rows simultaneously<br>
     1722  void setRowUpper(int elementIndex, double elementValue);
     1723
     1724  /** Set a single row lower and upper bound */
     1725  void setRowBounds(int elementIndex,
     1726    double lower, double upper);
     1727
     1728  /** Set the bounds on a number of rows simultaneously<br>
    15661729         @param indexFirst,indexLast pointers to the beginning and after the
    15671730            end of the array of the indices of the constraints whose
     
    15691732         @param boundList the new lower/upper bound pairs for the constraints
    15701733     */
    1571      void setRowSetBounds(const int* indexFirst,
    1572                           const int* indexLast,
    1573                           const double* boundList);
    1574      /// Resizes rim part of model
    1575      void resize (int newNumberRows, int newNumberColumns);
    1576 
    1577      //@}
    1578 
    1579 ////////////////// data //////////////////
     1734  void setRowSetBounds(const int *indexFirst,
     1735    const int *indexLast,
     1736    const double *boundList);
     1737  /// Resizes rim part of model
     1738  void resize(int newNumberRows, int newNumberColumns);
     1739
     1740  //@}
     1741
     1742  ////////////////// data //////////////////
    15801743protected:
    1581 
    1582      /**@name data.  Many arrays have a row part and a column part.
     1744  /**@name data.  Many arrays have a row part and a column part.
    15831745      There is a single array with both - columns then rows and
    15841746      then normally two arrays pointing to rows and columns.  The
    15851747      single array is the owner of memory
    15861748     */
    1587      //@{
    1588      /** Best possible improvement using djs (primal) or
     1749  //@{
     1750  /** Best possible improvement using djs (primal) or
    15891751         obj change by flipping bounds to make dual feasible (dual) */
    1590      double bestPossibleImprovement_;
    1591      /// Zero tolerance
    1592      double zeroTolerance_;
    1593      /// Sequence of worst (-1 if feasible)
    1594      int columnPrimalSequence_;
    1595      /// Sequence of worst (-1 if feasible)
    1596      int rowPrimalSequence_;
    1597      /// "Best" objective value
    1598      double bestObjectiveValue_;
    1599      /// More special options - see set for details
    1600      int moreSpecialOptions_;
    1601      /// Iteration when we entered dual or primal
    1602      int baseIteration_;
    1603      /// Vector mode - try and use vector instructions
    1604      int vectorMode_;
    1605      /// Primal tolerance needed to make dual feasible (<largeTolerance)
    1606      double primalToleranceToGetOptimal_;
    1607      /// Large bound value (for complementarity etc)
    1608      double largeValue_;
    1609      /// Largest error on Ax-b
    1610      double largestPrimalError_;
    1611      /// Largest error on basic duals
    1612      double largestDualError_;
    1613      /// For computing whether to re-factorize
    1614      double alphaAccuracy_;
    1615      /// Dual bound
    1616      double dualBound_;
    1617      /// Alpha (pivot element)
    1618      double alpha_;
    1619      /// Theta (pivot change)
    1620      double theta_;
    1621      /// Lower Bound on In variable
    1622      double lowerIn_;
    1623      /// Value of In variable
    1624      double valueIn_;
    1625      /// Upper Bound on In variable
    1626      double upperIn_;
    1627      /// Reduced cost of In variable
    1628      double dualIn_;
    1629      /// Lower Bound on Out variable
    1630      double lowerOut_;
    1631      /// Value of Out variable
    1632      double valueOut_;
    1633      /// Upper Bound on Out variable
    1634      double upperOut_;
    1635      /// Infeasibility (dual) or ? (primal) of Out variable
    1636      double dualOut_;
    1637      /// Current dual tolerance for algorithm
    1638      double dualTolerance_;
    1639      /// Current primal tolerance for algorithm
    1640      double primalTolerance_;
    1641      /// Sum of dual infeasibilities
    1642      double sumDualInfeasibilities_;
    1643      /// Sum of primal infeasibilities
    1644      double sumPrimalInfeasibilities_;
    1645      /// Weight assigned to being infeasible in primal
    1646      double infeasibilityCost_;
    1647      /// Sum of Dual infeasibilities using tolerance based on error in duals
    1648      double sumOfRelaxedDualInfeasibilities_;
    1649      /// Sum of Primal infeasibilities using tolerance based on error in primals
    1650      double sumOfRelaxedPrimalInfeasibilities_;
    1651      /// Acceptable pivot value just after factorization
    1652      double acceptablePivot_;
    1653      /// Minimum primal tolerance
    1654      double minimumPrimalTolerance_;
    1655      /// Last few infeasibilities
     1752  double bestPossibleImprovement_;
     1753  /// Zero tolerance
     1754  double zeroTolerance_;
     1755  /// Sequence of worst (-1 if feasible)
     1756  int columnPrimalSequence_;
     1757  /// Sequence of worst (-1 if feasible)
     1758  int rowPrimalSequence_;
     1759  /// "Best" objective value
     1760  double bestObjectiveValue_;
     1761  /// More special options - see set for details
     1762  int moreSpecialOptions_;
     1763  /// Iteration when we entered dual or primal
     1764  int baseIteration_;
     1765  /// Vector mode - try and use vector instructions
     1766  int vectorMode_;
     1767  /// Primal tolerance needed to make dual feasible (<largeTolerance)
     1768  double primalToleranceToGetOptimal_;
     1769  /// Large bound value (for complementarity etc)
     1770  double largeValue_;
     1771  /// Largest error on Ax-b
     1772  double largestPrimalError_;
     1773  /// Largest error on basic duals
     1774  double largestDualError_;
     1775  /// For computing whether to re-factorize
     1776  double alphaAccuracy_;
     1777  /// Dual bound
     1778  double dualBound_;
     1779  /// Alpha (pivot element)
     1780  double alpha_;
     1781  /// Theta (pivot change)
     1782  double theta_;
     1783  /// Lower Bound on In variable
     1784  double lowerIn_;
     1785  /// Value of In variable
     1786  double valueIn_;
     1787  /// Upper Bound on In variable
     1788  double upperIn_;
     1789  /// Reduced cost of In variable
     1790  double dualIn_;
     1791  /// Lower Bound on Out variable
     1792  double lowerOut_;
     1793  /// Value of Out variable
     1794  double valueOut_;
     1795  /// Upper Bound on Out variable
     1796  double upperOut_;
     1797  /// Infeasibility (dual) or ? (primal) of Out variable
     1798  double dualOut_;
     1799  /// Current dual tolerance for algorithm
     1800  double dualTolerance_;
     1801  /// Current primal tolerance for algorithm
     1802  double primalTolerance_;
     1803  /// Sum of dual infeasibilities
     1804  double sumDualInfeasibilities_;
     1805  /// Sum of primal infeasibilities
     1806  double sumPrimalInfeasibilities_;
     1807  /// Weight assigned to being infeasible in primal
     1808  double infeasibilityCost_;
     1809  /// Sum of Dual infeasibilities using tolerance based on error in duals
     1810  double sumOfRelaxedDualInfeasibilities_;
     1811  /// Sum of Primal infeasibilities using tolerance based on error in primals
     1812  double sumOfRelaxedPrimalInfeasibilities_;
     1813  /// Acceptable pivot value just after factorization
     1814  double acceptablePivot_;
     1815  /// Minimum primal tolerance
     1816  double minimumPrimalTolerance_;
     1817  /// Last few infeasibilities
    16561818#define CLP_INFEAS_SAVE 5
    1657      double averageInfeasibility_[CLP_INFEAS_SAVE];
    1658      /// Working copy of lower bounds (Owner of arrays below)
    1659      double * lower_;
    1660      /// Row lower bounds - working copy
    1661      double * rowLowerWork_;
    1662      /// Column lower bounds - working copy
    1663      double * columnLowerWork_;
    1664      /// Working copy of upper bounds (Owner of arrays below)
    1665      double * upper_;
    1666      /// Row upper bounds - working copy
    1667      double * rowUpperWork_;
    1668      /// Column upper bounds - working copy
    1669      double * columnUpperWork_;
    1670      /// Working copy of objective (Owner of arrays below)
    1671      double * cost_;
    1672      /// Row objective - working copy
    1673      double * rowObjectiveWork_;
    1674      /// Column objective - working copy
    1675      double * objectiveWork_;
    1676      /// Useful row length arrays
    1677      CoinIndexedVector * rowArray_[6];
    1678      /// Useful column length arrays
    1679      CoinIndexedVector * columnArray_[6];
    1680      /// Sequence of In variable
    1681      int sequenceIn_;
    1682      /// Direction of In, 1 going up, -1 going down, 0 not a clue
    1683      int directionIn_;
    1684      /// Sequence of Out variable
    1685      int sequenceOut_;
    1686      /// Direction of Out, 1 to upper bound, -1 to lower bound, 0 - superbasic
    1687      int directionOut_;
    1688      /// Pivot Row
    1689      int pivotRow_;
    1690      /// Last good iteration (immediately after a re-factorization)
    1691      int lastGoodIteration_;
    1692      /// Working copy of reduced costs (Owner of arrays below)
    1693      double * dj_;
    1694      /// Reduced costs of slacks not same as duals (or - duals)
    1695      double * rowReducedCost_;
    1696      /// Possible scaled reduced costs
    1697      double * reducedCostWork_;
    1698      /// Working copy of primal solution (Owner of arrays below)
    1699      double * solution_;
    1700      /// Row activities - working copy
    1701      double * rowActivityWork_;
    1702      /// Column activities - working copy
    1703      double * columnActivityWork_;
    1704      /// Number of dual infeasibilities
    1705      int numberDualInfeasibilities_;
    1706      /// Number of dual infeasibilities (without free)
    1707      int numberDualInfeasibilitiesWithoutFree_;
    1708      /// Number of primal infeasibilities
    1709      int numberPrimalInfeasibilities_;
    1710      /// How many iterative refinements to do
    1711      int numberRefinements_;
    1712      /// dual row pivot choice
    1713      ClpDualRowPivot * dualRowPivot_;
    1714      /// primal column pivot choice
    1715      ClpPrimalColumnPivot * primalColumnPivot_;
    1716      /// Basic variables pivoting on which rows
    1717      int * pivotVariable_;
    1718      /// factorization
    1719      ClpFactorization * factorization_;
    1720      /// Saved version of solution
    1721      double * savedSolution_;
    1722      /// Number of times code has tentatively thought optimal
    1723      int numberTimesOptimal_;
    1724      /// Disaster handler
    1725      ClpDisasterHandler * disasterArea_;
    1726      /// If change has been made (first attempt at stopping looping)
    1727      int changeMade_;
    1728      /// Algorithm >0 == Primal, <0 == Dual
    1729      int algorithm_;
    1730      /** Now for some reliability aids
     1819  double averageInfeasibility_[CLP_INFEAS_SAVE];
     1820  /// Working copy of lower bounds (Owner of arrays below)
     1821  double *lower_;
     1822  /// Row lower bounds - working copy
     1823  double *rowLowerWork_;
     1824  /// Column lower bounds - working copy
     1825  double *columnLowerWork_;
     1826  /// Working copy of upper bounds (Owner of arrays below)
     1827  double *upper_;
     1828  /// Row upper bounds - working copy
     1829  double *rowUpperWork_;
     1830  /// Column upper bounds - working copy
     1831  double *columnUpperWork_;
     1832  /// Working copy of objective (Owner of arrays below)
     1833  double *cost_;
     1834  /// Row objective - working copy
     1835  double *rowObjectiveWork_;
     1836  /// Column objective - working copy
     1837  double *objectiveWork_;
     1838  /// Useful row length arrays
     1839  CoinIndexedVector *rowArray_[6];
     1840  /// Useful column length arrays
     1841  CoinIndexedVector *columnArray_[6];
     1842  /// Sequence of In variable
     1843  int sequenceIn_;
     1844  /// Direction of In, 1 going up, -1 going down, 0 not a clue
     1845  int directionIn_;
     1846  /// Sequence of Out variable
     1847  int sequenceOut_;
     1848  /// Direction of Out, 1 to upper bound, -1 to lower bound, 0 - superbasic
     1849  int directionOut_;
     1850  /// Pivot Row
     1851  int pivotRow_;
     1852  /// Last good iteration (immediately after a re-factorization)
     1853  int lastGoodIteration_;
     1854  /// Working copy of reduced costs (Owner of arrays below)
     1855  double *dj_;
     1856  /// Reduced costs of slacks not same as duals (or - duals)
     1857  double *rowReducedCost_;
     1858  /// Possible scaled reduced costs
     1859  double *reducedCostWork_;
     1860  /// Working copy of primal solution (Owner of arrays below)
     1861  double *solution_;
     1862  /// Row activities - working copy
     1863  double *rowActivityWork_;
     1864  /// Column activities - working copy
     1865  double *columnActivityWork_;
     1866  /// Number of dual infeasibilities
     1867  int numberDualInfeasibilities_;
     1868  /// Number of dual infeasibilities (without free)
     1869  int numberDualInfeasibilitiesWithoutFree_;
     1870  /// Number of primal infeasibilities
     1871  int numberPrimalInfeasibilities_;
     1872  /// How many iterative refinements to do
     1873  int numberRefinements_;
     1874  /// dual row pivot choice
     1875  ClpDualRowPivot *dualRowPivot_;
     1876  /// primal column pivot choice
     1877  ClpPrimalColumnPivot *primalColumnPivot_;
     1878  /// Basic variables pivoting on which rows
     1879  int *pivotVariable_;
     1880  /// factorization
     1881  ClpFactorization *factorization_;
     1882  /// Saved version of solution
     1883  double *savedSolution_;
     1884  /// Number of times code has tentatively thought optimal
     1885  int numberTimesOptimal_;
     1886  /// Disaster handler
     1887  ClpDisasterHandler *disasterArea_;
     1888  /// If change has been made (first attempt at stopping looping)
     1889  int changeMade_;
     1890  /// Algorithm >0 == Primal, <0 == Dual
     1891  int algorithm_;
     1892  /** Now for some reliability aids
    17311893         This forces re-factorization early */
    1732      int forceFactorization_;
    1733      /** Perturbation:
     1894  int forceFactorization_;
     1895  /** Perturbation:
    17341896         -50 to +50 - perturb by this power of ten (-6 sounds good)
    17351897         100 - auto perturb if takes too long (1.0e-6 largest nonzero)
     
    17381900         default is 100
    17391901     */
    1740      int perturbation_;
    1741      /// Saved status regions
    1742      unsigned char * saveStatus_;
    1743      /** Very wasteful way of dealing with infeasibilities in primal.
     1902  int perturbation_;
     1903  /// Saved status regions
     1904  unsigned char *saveStatus_;
     1905  /** Very wasteful way of dealing with infeasibilities in primal.
    17441906         However it will allow non-linearities and use of dual
    17451907         analysis.  If it doesn't work it can easily be replaced.
    17461908     */
    1747      ClpNonLinearCost * nonLinearCost_;
    1748      /// So we know when to be cautious
    1749      int lastBadIteration_;
    1750      /// So we know when to open up again
    1751      int lastFlaggedIteration_;
    1752      /// Can be used for count of fake bounds (dual) or fake costs (primal)
    1753      int numberFake_;
    1754      /// Can be used for count of changed costs (dual) or changed bounds (primal)
    1755      int numberChanged_;
    1756      /// Progress flag - at present 0 bit says artificials out, 1 free in
    1757      int progressFlag_;
    1758      /// First free/super-basic variable (-1 if none)
    1759      int firstFree_;
    1760      /** Number of extra rows.  These are ones which will be dynamically created
     1909  ClpNonLinearCost *nonLinearCost_;
     1910  /// So we know when to be cautious
     1911  int lastBadIteration_;
     1912  /// So we know when to open up again
     1913  int lastFlaggedIteration_;
     1914  /// Can be used for count of fake bounds (dual) or fake costs (primal)
     1915  int numberFake_;
     1916  /// Can be used for count of changed costs (dual) or changed bounds (primal)
     1917  int numberChanged_;
     1918  /// Progress flag - at present 0 bit says artificials out, 1 free in
     1919  int progressFlag_;
     1920  /// First free/super-basic variable (-1 if none)
     1921  int firstFree_;
     1922  /** Number of extra rows.  These are ones which will be dynamically created
    17611923         each iteration.  This is for GUB but may have other uses.
    17621924     */
    1763      int numberExtraRows_;
    1764      /** Maximum number of basic variables - can be more than number of rows if GUB
    1765      */
    1766      int maximumBasic_;
    1767      /// If may skip final factorize then allow up to this pivots (default 20)
    1768      int dontFactorizePivots_;
    1769      /** For advanced use.  When doing iterative solves things can get
     1925  int numberExtraRows_;
     1926  /** Maximum number of basic variables - can be more than number of rows if GUB
     1927     */
     1928  int maximumBasic_;
     1929  /// If may skip final factorize then allow up to this pivots (default 20)
     1930  int dontFactorizePivots_;
     1931  /** For advanced use.  When doing iterative solves things can get
    17701932         nasty so on values pass if incoming solution has largest
    17711933         infeasibility < incomingInfeasibility throw out variables
     
    17761938         Defaults are 1.0,10.0
    17771939     */
    1778      double incomingInfeasibility_;
    1779      double allowedInfeasibility_;
    1780      /// Automatic scaling of objective and rhs and bounds
    1781      int automaticScale_;
    1782      /// Maximum perturbation array size (take out when code rewritten)
    1783      int maximumPerturbationSize_;
    1784      /// Perturbation array (maximumPerturbationSize_)
    1785      double * perturbationArray_;
    1786      /// A copy of model with certain state - normally without cuts
    1787      ClpSimplex * baseModel_;
    1788      /// For dealing with all issues of cycling etc
    1789      ClpSimplexProgress progress_;
     1940  double incomingInfeasibility_;
     1941  double allowedInfeasibility_;
     1942  /// Automatic scaling of objective and rhs and bounds
     1943  int automaticScale_;
     1944  /// Maximum perturbation array size (take out when code rewritten)
     1945  int maximumPerturbationSize_;
     1946  /// Perturbation array (maximumPerturbationSize_)
     1947  double *perturbationArray_;
     1948  /// A copy of model with certain state - normally without cuts
     1949  ClpSimplex *baseModel_;
     1950  /// For dealing with all issues of cycling etc
     1951  ClpSimplexProgress progress_;
    17901952#ifdef ABC_INHERIT
    1791   AbcSimplex * abcSimplex_;
     1953  AbcSimplex *abcSimplex_;
    17921954  int abcState_;
    17931955#define CLP_ABC_WANTED 1
     
    17991961  /// Number of degenerate pivots since last perturbed
    18001962  int numberDegeneratePivots_;
     1963
    18011964public:
    1802      /// Spare int array for passing information [0]!=0 switches on
    1803      mutable int spareIntArray_[4];
    1804      /// Spare double array for passing information [0]!=0 switches on
    1805      mutable double spareDoubleArray_[4];
     1965  /// Spare int array for passing information [0]!=0 switches on
     1966  mutable int spareIntArray_[4];
     1967  /// Spare double array for passing information [0]!=0 switches on
     1968  mutable double spareDoubleArray_[4];
     1969
    18061970protected:
    1807      /// Allow OsiClp certain perks
    1808      friend class OsiClpSolverInterface;
    1809      /// And OsiCLP
    1810      friend class OsiCLPSolverInterface;
    1811      //@}
     1971  /// Allow OsiClp certain perks
     1972  friend class OsiClpSolverInterface;
     1973  /// And OsiCLP
     1974  friend class OsiCLPSolverInterface;
     1975  //@}
    18121976};
    18131977//#############################################################################
     
    18201984    It also does some testing of ClpFactorization class
    18211985 */
    1822 void
    1823 ClpSimplexUnitTest(const std::string & mpsDir);
     1986void ClpSimplexUnitTest(const std::string &mpsDir);
    18241987
    18251988// For Devex stuff
     
    18331996  //const CoinIndexedVector * constVector; // can get rid of
    18341997  //CoinIndexedVector * vectors[2]; // can get rid of
    1835   void * extraInfo;
    1836   void * extraInfo2;
     1998  void *extraInfo;
     1999  void *extraInfo2;
    18372000  int status;
    18382001  int stuff[4];
     
    18442007  /** Main constructor
    18452008  */
    1846   CoinPthreadStuff (int numberThreads=0,
    1847                     void * parallelManager(void * stuff)=NULL);
     2009  CoinPthreadStuff(int numberThreads = 0,
     2010    void *parallelManager(void *stuff) = NULL);
    18482011  /// Assignment operator. This copies the data
    1849   CoinPthreadStuff & operator=(const CoinPthreadStuff & rhs);
     2012  CoinPthreadStuff &operator=(const CoinPthreadStuff &rhs);
    18502013  /// Destructor
    1851   ~CoinPthreadStuff (  );
     2014  ~CoinPthreadStuff();
    18522015  /// set stop start
    18532016  inline void setStopStart(int value)
    1854   { stopStart_=value;}
    1855 #ifndef NUMBER_THREADS
     2017  {
     2018    stopStart_ = value;
     2019  }
     2020#ifndef NUMBER_THREADS
    18562021#define NUMBER_THREADS 8
    18572022#endif
    18582023  // For waking up thread
    1859   inline pthread_mutex_t * mutexPointer(int which,int thread=0)
    1860   { return mutex_+which+3*thread;}
     2024  inline pthread_mutex_t *mutexPointer(int which, int thread = 0)
     2025  {
     2026    return mutex_ + which + 3 * thread;
     2027  }
    18612028#ifdef PTHREAD_BARRIER_SERIAL_THREAD
    1862   inline pthread_barrier_t * barrierPointer()
    1863   { return &barrier_;}
    1864 #endif
    1865   inline int whichLocked(int thread=0) const
    1866   { return locked_[thread];}
    1867   inline CoinThreadInfo * threadInfoPointer(int thread=0)
    1868   { return threadInfo_+thread;}
    1869   void startParallelTask(int type,int iThread,void * info=NULL);
    1870   int waitParallelTask(int type, int & iThread,bool allowIdle);
     2029  inline pthread_barrier_t *barrierPointer()
     2030  {
     2031    return &barrier_;
     2032  }
     2033#endif
     2034  inline int whichLocked(int thread = 0) const
     2035  {
     2036    return locked_[thread];
     2037  }
     2038  inline CoinThreadInfo *threadInfoPointer(int thread = 0)
     2039  {
     2040    return threadInfo_ + thread;
     2041  }
     2042  void startParallelTask(int type, int iThread, void *info = NULL);
     2043  int waitParallelTask(int type, int &iThread, bool allowIdle);
    18712044  void waitAllTasks();
    1872   /// so thread can find out which one it is 
     2045  /// so thread can find out which one it is
    18732046  int whichThread() const;
    18742047  void sayIdle(int iThread);
     
    18762049  //void stopThreads();
    18772050  // For waking up thread
    1878   pthread_mutex_t mutex_[3*(NUMBER_THREADS+1)];
     2051  pthread_mutex_t mutex_[3 * (NUMBER_THREADS + 1)];
    18792052#ifdef PTHREAD_BARRIER_SERIAL_THREAD
    1880   pthread_barrier_t barrier_; 
    1881 #endif
    1882   CoinThreadInfo threadInfo_[NUMBER_THREADS+1];
    1883   pthread_t abcThread_[NUMBER_THREADS+1];
    1884   int locked_[NUMBER_THREADS+1];
     2053  pthread_barrier_t barrier_;
     2054#endif
     2055  CoinThreadInfo threadInfo_[NUMBER_THREADS + 1];
     2056  pthread_t abcThread_[NUMBER_THREADS + 1];
     2057  int locked_[NUMBER_THREADS + 1];
    18852058  int stopStart_;
    18862059  int numberThreads_;
    18872060};
    1888 void * clp_parallelManager(void * stuff);
     2061void *clp_parallelManager(void *stuff);
    18892062#endif
    18902063typedef struct {
     
    18922065  double bestPossible;
    18932066  double acceptablePivot;
    1894   double tolerance; 
    1895   double dualTolerance; 
    1896   double theta; 
     2067  double tolerance;
     2068  double dualTolerance;
     2069  double theta;
    18972070  double primalRatio;
    18982071  double changeObj;
    1899   const double * COIN_RESTRICT cost;
    1900   double  * COIN_RESTRICT solution;
    1901   double * COIN_RESTRICT reducedCost;
    1902   const double * COIN_RESTRICT lower;
    1903   const double * COIN_RESTRICT upper;
    1904   double * COIN_RESTRICT work;
    1905   int * COIN_RESTRICT index;
    1906   double * COIN_RESTRICT spare;
    1907   const unsigned char * COIN_RESTRICT status;
    1908   int * COIN_RESTRICT which;
    1909   double * COIN_RESTRICT infeas;
    1910   const int * COIN_RESTRICT pivotVariable;
    1911   const double * COIN_RESTRICT element;
    1912   const CoinBigIndex * COIN_RESTRICT start;
    1913   const int * COIN_RESTRICT row;
     2072  const double *COIN_RESTRICT cost;
     2073  double *COIN_RESTRICT solution;
     2074  double *COIN_RESTRICT reducedCost;
     2075  const double *COIN_RESTRICT lower;
     2076  const double *COIN_RESTRICT upper;
     2077  double *COIN_RESTRICT work;
     2078  int *COIN_RESTRICT index;
     2079  double *COIN_RESTRICT spare;
     2080  const unsigned char *COIN_RESTRICT status;
     2081  int *COIN_RESTRICT which;
     2082  double *COIN_RESTRICT infeas;
     2083  const int *COIN_RESTRICT pivotVariable;
     2084  const double *COIN_RESTRICT element;
     2085  const CoinBigIndex *COIN_RESTRICT start;
     2086  const int *COIN_RESTRICT row;
    19142087  int numberAdded;
    1915   int numberInfeasibilities; 
     2088  int numberInfeasibilities;
    19162089  int numberRemaining;
    19172090  int startColumn;
     
    19212094#ifndef ABC_INHERIT
    19222095#if ABOCA_LITE
    1923 void moveAndZero(clpTempInfo * info,int type,void * extra);
     2096void moveAndZero(clpTempInfo *info, int type, void *extra);
    19242097// 2 is owner of abcState_
    19252098#ifdef ABCSTATE_LITE
    1926 #if ABCSTATE_LITE==2
    1927 int abcState_=0;
     2099#if ABCSTATE_LITE == 2
     2100int abcState_ = 0;
    19282101#else
    19292102extern int abcState_;
    19302103#endif
    1931   inline int abcState()
    1932   { return abcState_;}
    1933   inline void setAbcState(int state)
    1934   { abcState_=state;}
     2104inline int abcState()
     2105{
     2106  return abcState_;
     2107}
     2108inline void setAbcState(int state)
     2109{
     2110  abcState_ = state;
     2111}
    19352112#endif
    19362113#else
     
    19562133#endif
    19572134#endif
     2135
     2136/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
     2137*/
Note: See TracChangeset for help on using the changeset viewer.