source: trunk/include/CbcModel.hpp @ 164

Last change on this file since 164 was 164, checked in by forrest, 16 years ago

secondaryStatus

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 52.6 KB
Line 
1// Copyright (C) 2002, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef CbcModel_H
4#define CbcModel_H
5
6#include <string>
7#include <vector>
8
9#include "CoinFinite.hpp"
10#include "CoinMessageHandler.hpp"
11#include "OsiSolverInterface.hpp"
12#include "OsiCuts.hpp"
13#include "CoinWarmStartBasis.hpp"
14#include "CbcCompareBase.hpp"
15#include "CbcMessage.hpp"
16
17//class OsiSolverInterface;
18
19class CbcCutGenerator;
20class OsiRowCut;
21class OsiRowCutDebugger;
22class CglCutGenerator;
23class CbcHeuristic;
24class CbcObject;
25class CbcTree;
26class CbcStrategy;
27
28//#############################################################################
29
30/** Simple Branch and bound class
31
32  The initialSolve() method solves the initial LP relaxation of the MIP
33  problem. The branchAndBound() method can then be called to finish using
34  a branch and cut algorithm.
35
36  <h3>Search Tree Traversal</h3>
37
38  Subproblems (aka nodes) requiring additional evaluation are stored using
39  the CbcNode and CbcNodeInfo objects. Ancestry linkage is maintained in the
40  CbcNodeInfo object. Evaluation of a subproblem within branchAndBound()
41  proceeds as follows:
42  <ul>
43    <li> The node representing the most promising parent subproblem is popped
44         from the heap which holds the set of subproblems requiring further
45         evaluation.
46    <li> Using branching instructions stored in the node, and information in
47         its ancestors, the model and solver are adjusted to create the
48         active subproblem.
49    <li> If the parent subproblem will require further evaluation
50         (<i>i.e.</i>, there are branches remaining) its node is pushed back
51         on the heap. Otherwise, the node is deleted.  This may trigger
52         recursive deletion of ancestors.
53    <li> The newly created subproblem is evaluated.
54    <li> If the subproblem requires further evaluation, a node is created.
55         All information needed to recreate the subproblem (branching
56         information, row and column cuts) is placed in the node and the node
57         is added to the set of subproblems awaiting further evaluation.
58  </ul>
59  Note that there is never a node representing the active subproblem; the model
60  and solver represent the active subproblem.
61
62  <h3>Row (Constraint) Cut Handling</h3>
63
64  For a typical subproblem, the sequence of events is as follows:
65  <ul>
66    <li> The subproblem is rebuilt for further evaluation: One result of a
67         call to addCuts() is a traversal of ancestors, leaving a list of all
68         cuts used in the ancestors in #addedCuts_. This list is then scanned
69         to construct a basis that includes only tight cuts. Entries for
70         loose cuts are set to NULL.
71    <li> The subproblem is evaluated: One result of a call to solveWithCuts()
72         is the return of a set of newly generated cuts for the subproblem.
73         #addedCuts_ is also kept up-to-date as old cuts become loose.
74    <li> The subproblem is stored for further processing: A call to
75         CbcNodeInfo::addCuts() adds the newly generated cuts to the
76         CbcNodeInfo object associated with this node.
77  </ul>
78  See CbcCountRowCut for details of the bookkeeping associated with cut
79  management.
80*/
81
82class CbcModel  {
83 
84public:
85
86enum CbcIntParam {
87  /** The maximum number of nodes before terminating */
88  CbcMaxNumNode=0,
89  /** The maximum number of solutions before terminating */
90  CbcMaxNumSol,
91  /** Fathoming discipline
92
93    Controls objective function comparisons for purposes of fathoming by bound
94    or determining monotonic variables.
95
96    If 1, action is taken only when the current objective is strictly worse
97    than the target. Implementation is handled by adding a small tolerance to
98    the target.
99  */
100  CbcFathomDiscipline,
101  /** Just a marker, so that a static sized array can store parameters. */
102  CbcLastIntParam
103};
104
105enum CbcDblParam {
106  /** The maximum amount the value of an integer variable can vary from
107      integer and still be considered feasible. */
108  CbcIntegerTolerance=0,
109  /** The objective is assumed to worsen by this amount for each
110      integer infeasibility. */
111  CbcInfeasibilityWeight,
112  /** The amount by which to tighten the objective function cutoff when
113      a new solution is discovered. */
114  CbcCutoffIncrement,
115  /** Stop when the gap between the objective value of the best known solution
116    and the best bound on the objective of any solution is less than this.
117 
118    This is an absolute value. Conversion from a percentage is left to the
119    client.
120  */
121  CbcAllowableGap,
122  /** Stop when the gap between the objective value of the best known solution
123    and the best bound on the objective of any solution is less than this
124    fraction of of the absolute value of best known solution.
125 
126    Code stops if either this test or CbcAllowableGap test succeeds
127  */
128  CbcAllowableFractionGap,
129  /** \brief The maximum number of seconds before terminating.
130             A double should be adequate! */
131  CbcMaximumSeconds,
132  /** \brief The time at start of model.
133             So that other pieces of code can access */
134  CbcStartSeconds,
135  /** Just a marker, so that a static sized array can store parameters. */
136  CbcLastDblParam
137};
138
139  //---------------------------------------------------------------------------
140
141public:
142  ///@name Solve methods
143  //@{
144    /** \brief Solve the initial LP relaxation
145
146      Invoke the solver's %initialSolve() method.
147    */
148    void initialSolve(); 
149
150    /** \brief Invoke the branch \& cut algorithm
151
152      The method assumes that initialSolve() has been called to solve the
153      LP relaxation. It processes the root node, then proceeds to explore the
154      branch & cut search tree. The search ends when the tree is exhausted or
155      one of several execution limits is reached.
156      If doStatistics is 1 summary statistics are printed
157      if 2 then also the path to best solution (if found by branching)
158      if 3 then also one line per node
159    */
160     void branchAndBound(int doStatistics=0);
161
162    /** \brief create a clean model from partially fixed problem
163
164      The method creates a new model with given bounds and with no tree.
165    */
166     CbcModel *  cleanModel(const double * lower, const double * upper);
167    /** \brief Invoke the branch \& cut algorithm on partially fixed problem
168
169      The method presolves the given model and does branch and cut. The search
170      ends when the tree is exhausted or maximum nodes is reached.
171
172      If better solution found then it is saved.
173
174      Returns 0 if search completed and solution, 1 if not completed and solution,
175      2 if completed and no solution, 3 if not completed and no solution.
176
177      Normally okay to do cleanModel immediately followed by subBranchandBound
178      (== other form of subBranchAndBound)
179      but may need to get at model for advanced features.
180
181      Deletes model2
182    */
183     int subBranchAndBound(CbcModel * model2,
184                           CbcModel * presolvedModel,
185                           int maximumNodes);
186    /** \brief Invoke the branch \& cut algorithm on partially fixed problem
187
188      The method creates a new model with given bounds, presolves it
189      then proceeds to explore the branch & cut search tree. The search
190      ends when the tree is exhausted or maximum nodes is reached.
191
192      If better solution found then it is saved.
193
194      Returns 0 if search completed and solution, 1 if not completed and solution,
195      2 if completed and no solution, 3 if not completed and no solution.
196
197      This is just subModel immediately followed by other version of
198      subBranchandBound.
199
200    */
201     int subBranchAndBound(const double * lower, const double * upper,
202                            int maximumNodes);
203
204    /** \brief Process root node and return a strengthened model
205
206      The method assumes that initialSolve() has been called to solve the
207      LP relaxation. It processes the root node and then returns a pointer
208      to the strengthened model (or NULL if infeasible)
209    */
210     OsiSolverInterface *  strengthenedModel();
211    /** \brief Evaluate a subproblem using cutting planes and heuristics
212
213      The method invokes a main loop which generates cuts, applies heuristics,
214      and reoptimises using the solver's native %resolve() method.
215      It returns true if the subproblem remains feasible at the end of the
216      evaluation.
217    */
218    bool solveWithCuts(OsiCuts & cuts, int numberTries,CbcNode * node,
219                       int & numberOldActiveCuts, int & numberNewCuts,
220                       int & maximumWhich, int * & whichGenerator);
221
222    /** \brief Reoptimise an LP relaxation
223   
224      Invoke the solver's %resolve() method.
225    */
226    bool resolve();
227  /// Make given rows (L or G) into global cuts and remove from lp
228  void makeGlobalCuts(int numberRows,const int * which); 
229  //@}
230
231  /** \name Presolve methods */
232  //@{
233
234  /** Identify cliques and construct corresponding objects.
235
236      Find cliques with size in the range
237      [\p atLeastThisMany, \p lessThanThis] and construct corresponding
238      CbcClique objects.
239      If \p makeEquality is true then a new model may be returned if
240      modifications had to be made, otherwise \c this is returned.
241      If the problem is infeasible #numberObjects_ is set to -1.
242      A client must use deleteObjects() before a second call to findCliques().
243      If priorities exist, clique priority is set to the default.
244  */
245  CbcModel * findCliques(bool makeEquality, int atLeastThisMany,
246                         int lessThanThis, int defaultValue=1000);
247
248  /** Do integer presolve, creating a new (presolved) model.
249
250    Returns the new model, or NULL if feasibility is lost.
251    If weak is true then just does a normal presolve
252 
253    \todo It remains to work out the cleanest way of getting a solution to
254          the original problem at the end. So this is very preliminary.
255   */
256  CbcModel * integerPresolve(bool weak=false);
257
258  /** Do integer presolve, modifying the current model.
259
260      Returns true if the model remains feasible after presolve.
261  */
262  bool integerPresolveThisModel(OsiSolverInterface * originalSolver,bool weak=false);
263
264
265  /// Put back information into the original model after integer presolve.
266  void originalModel(CbcModel * presolvedModel,bool weak);
267
268  /** \brief For variables involved in VUB constraints, see if we can tighten
269             bounds by solving lp's
270
271      Returns false if feasibility is lost.
272      If CglProbing is available, it will be tried as well to see if it can
273      tighten bounds.
274      This routine is just a front end for tightenVubs(int,const int*,double).
275
276      If <tt>type = -1</tt> all variables are processed (could be very slow).
277      If <tt>type = 0</tt> only variables involved in VUBs are processed.
278      If <tt>type = n > 0</tt>, only the n most expensive VUB variables
279      are processed, where it is assumed that x is at its maximum so delta
280      would have to go to 1 (if x not at bound).
281
282      If \p allowMultipleBinary is true, then a VUB constraint is a row with
283      one continuous variable and any number of binary variables.
284
285      If <tt>useCutoff < 1.0e30</tt>, the original objective is installed as a
286      constraint with \p useCutoff as a bound.
287  */
288  bool tightenVubs(int type,bool allowMultipleBinary=false,
289                   double useCutoff=1.0e50);
290 
291  /** \brief For variables involved in VUB constraints, see if we can tighten
292             bounds by solving lp's
293
294    This version is just handed a list of variables to be processed.
295  */
296  bool tightenVubs(int numberVubs, const int * which,
297                   double useCutoff=1.0e50);
298  /**
299    Analyze problem to find a minimum change in the objective function.
300  */
301  void analyzeObjective();
302
303
304  //@}
305
306  /** \name Object manipulation routines
307 
308    See CbcObject for an explanation of `object' in the context of CbcModel.
309  */
310  //@{
311
312  /// Get the number of objects
313  inline int numberObjects() const { return numberObjects_;};
314  /// Set the number of objects
315  inline void setNumberObjects(int number) 
316  {  numberObjects_=number;};
317
318  /// Get the array of objects
319  inline CbcObject ** objects() const { return object_;};
320
321  /// Get the specified object
322  const inline CbcObject * object(int which) const { return object_[which];};
323  /// Get the specified object
324  inline CbcObject * modifiableObject(int which) const { return object_[which];};
325
326  /// Delete all object information
327  void deleteObjects();
328
329  /** Add in object information.
330 
331    Objects are cloned; the owner can delete the originals.
332  */
333  void addObjects(int numberObjects, CbcObject ** objects);
334
335  /// Ensure attached objects point to this model.
336  void synchronizeModel() ;
337
338  /** \brief Identify integer variables and create corresponding objects.
339 
340    Record integer variables and create an CbcSimpleInteger object for each
341    one.
342    If \p startAgain is true, a new scan is forced, overwriting any existing
343    integer variable information.
344  */
345
346  void findIntegers(bool startAgain);
347
348  /** If numberBeforeTrust >0 then we are going to use CbcBranchDynamic.
349      Scan and convert CbcSimpleInteger objects
350  */
351  void convertToDynamic();
352 
353  //@}
354
355  //---------------------------------------------------------------------------
356
357  /**@name Parameter set/get methods
358
359     The set methods return true if the parameter was set to the given value,
360     false if the value of the parameter is out of range.
361
362     The get methods return the value of the parameter.
363
364  */
365  //@{
366  /// Set an integer parameter
367  inline bool setIntParam(CbcIntParam key, int value) {
368    intParam_[key] = value;
369    return true;
370  }
371  /// Set a double parameter
372  inline bool setDblParam(CbcDblParam key, double value) {
373    dblParam_[key] = value;
374    return true;
375  }
376  /// Get an integer parameter
377  inline int getIntParam(CbcIntParam key) const {
378    return intParam_[key];
379  }
380  /// Get a double parameter
381  inline double getDblParam(CbcDblParam key) const {
382    return dblParam_[key];
383  }
384  /*! \brief Set cutoff bound on the objective function.
385
386    When using strict comparison, the bound is adjusted by a tolerance to
387    avoid accidentally cutting off the optimal solution.
388  */
389  void setCutoff(double value) ;
390
391  /// Get the cutoff bound on the objective function - always as minimize
392  inline double getCutoff() const
393  { double value ;
394    solver_->getDblParam(OsiDualObjectiveLimit,value) ;
395    return value * solver_->getObjSense() ; } ;
396
397  /// Set the \link CbcModel::CbcMaxNumNode maximum node limit \endlink
398  inline bool setMaximumNodes( int value)
399  { return setIntParam(CbcMaxNumNode,value); }
400
401  /// Get the \link CbcModel::CbcMaxNumNode maximum node limit \endlink
402  inline int getMaximumNodes() const
403  { return getIntParam(CbcMaxNumNode); }
404
405  /** Set the
406      \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink
407      desired.
408  */
409  inline bool setMaximumSolutions( int value) {
410    return setIntParam(CbcMaxNumSol,value);
411  }
412  /** Get the
413      \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink
414      desired.
415  */
416  inline int getMaximumSolutions() const {
417    return getIntParam(CbcMaxNumSol);
418  }
419
420  /** Set the
421      \link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink
422      desired.
423  */
424  inline bool setMaximumSeconds( double value) {
425    return setDblParam(CbcMaximumSeconds,value);
426  }
427  /** Get the
428      \link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink
429      desired.
430  */
431  inline double getMaximumSeconds() const {
432    return getDblParam(CbcMaximumSeconds);
433  }
434
435  /** Set the
436    \link CbcModel::CbcIntegerTolerance integrality tolerance \endlink
437  */
438  inline bool setIntegerTolerance( double value) {
439    return setDblParam(CbcIntegerTolerance,value);
440  }
441  /** Get the
442    \link CbcModel::CbcIntegerTolerance integrality tolerance \endlink
443  */
444  inline double getIntegerTolerance() const {
445    return getDblParam(CbcIntegerTolerance);
446  }
447
448  /** Set the
449      \link CbcModel::CbcInfeasibilityWeight
450            weight per integer infeasibility \endlink
451  */
452  inline bool setInfeasibilityWeight( double value) {
453    return setDblParam(CbcInfeasibilityWeight,value);
454  }
455  /** Get the
456      \link CbcModel::CbcInfeasibilityWeight
457            weight per integer infeasibility \endlink
458  */
459  inline double getInfeasibilityWeight() const {
460    return getDblParam(CbcInfeasibilityWeight);
461  }
462
463  /** Set the \link CbcModel::CbcAllowableGap allowable gap \endlink
464      between the best known solution and the best possible solution.
465  */
466  inline bool setAllowableGap( double value) {
467    return setDblParam(CbcAllowableGap,value);
468  }
469  /** Get the \link CbcModel::CbcAllowableGap allowable gap \endlink
470      between the best known solution and the best possible solution.
471  */
472  inline double getAllowableGap() const {
473    return getDblParam(CbcAllowableGap);
474  }
475
476  /** Set the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink
477      between the best known solution and the best possible solution.
478  */
479  inline bool setAllowableFractionGap( double value) {
480    return setDblParam(CbcAllowableFractionGap,value);
481  }
482  /** Get the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink
483      between the best known solution and the best possible solution.
484  */
485  inline double getAllowableFractionGap() const {
486    return getDblParam(CbcAllowableFractionGap);
487  }
488  /** Set the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink
489      between the best known solution and the best possible solution.
490  */
491  inline bool setAllowablePercentageGap( double value) {
492    return setDblParam(CbcAllowableFractionGap,value*0.01);
493  }
494  /** Get the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink
495      between the best known solution and the best possible solution.
496  */
497  inline double getAllowablePercentageGap() const {
498    return 100.0*getDblParam(CbcAllowableFractionGap);
499  }
500
501  /// Set the hotstart strategy
502  void setHotstartStrategy(int value) 
503  { hotstartStrategy_=value;};
504  /// Get the hotstart strategy
505  int getHotstartStrategy() const
506  { return hotstartStrategy_;};
507 
508  /// Set the minimum drop to continue cuts
509  inline void setMinimumDrop(double value)
510  {minimumDrop_=value;};
511  /// Get the minimum drop to continue cuts
512  inline double getMinimumDrop() const
513  { return minimumDrop_;};
514
515  /** Set the maximum number of cut passes at root node (default 20)
516      Minimum drop can also be used for fine tuning */
517  inline void setMaximumCutPassesAtRoot(int value)
518  {maximumCutPassesAtRoot_=value;};
519  /** Get the maximum number of cut passes at root node */
520  inline int getMaximumCutPassesAtRoot() const
521  { return maximumCutPassesAtRoot_;};
522
523  /** Set the maximum number of cut passes at other nodes (default 10)
524      Minimum drop can also be used for fine tuning */
525  inline void setMaximumCutPasses(int value)
526  {maximumCutPasses_=value;};
527  /** Get the maximum number of cut passes at other nodes (default 10) */
528  inline int getMaximumCutPasses() const
529  { return maximumCutPasses_;};
530  /** Get current cut pass number in this round of cuts.
531      (1 is first pass) */
532  inline int getCurrentPassNumber() const
533  { return currentPassNumber_;};
534
535  /** Set the maximum number of candidates to be evaluated for strong
536    branching.
537
538    A value of 0 disables strong branching.
539  */
540  void setNumberStrong(int number);
541  /** Get the maximum number of candidates to be evaluated for strong
542    branching.
543  */
544  inline int numberStrong() const
545  { return numberStrong_;};
546
547  /** Set the number of branches before pseudo costs believed
548      in dynamic strong branching.
549
550    A value of 0 disables dynamic strong branching.
551  */
552  void setNumberBeforeTrust(int number);
553  /** get the number of branches before pseudo costs believed
554      in dynamic strong branching. */
555  inline int numberBeforeTrust() const
556  { return numberBeforeTrust_;};
557  /** Set the number of variables for which to compute penalties
558      in dynamic strong branching.
559
560    A value of 0 disables penalties.
561  */
562  void setNumberPenalties(int number);
563  /** get the number of variables for which to compute penalties
564      in dynamic strong branching. */
565  inline int numberPenalties() const
566  { return numberPenalties_;};
567  /** Get scale factor to make penalties match strong.
568      Should/will be computed */
569  inline double penaltyScaleFactor() const
570  { return penaltyScaleFactor_;};
571  /** Set scale factor to make penalties match strong.
572      Should/will be computed */
573  void setPenaltyScaleFactor(double value);
574  /** Problem type as set by user or found by analysis.  This will be extended
575      0 - not known
576      1 - Set partitioning <=
577      2 - Set partitioning ==
578      3 - Set covering
579      4 - all +- 1 or all +1 and odd
580  */
581  void inline setProblemType(int number)
582  { problemType_=number;};
583  inline int problemType() const
584  { return problemType_;};
585
586  /// Set how often to scan global cuts
587  void setHowOftenGlobalScan(int number);
588  /// Get how often to scan global cuts
589  inline int howOftenGlobalScan() const
590  { return howOftenGlobalScan_;};
591  /// Original columns as created by integerPresolve
592  inline int * originalColumns() const
593  { return originalColumns_;};
594
595  /** Set the print frequency.
596 
597    Controls the number of nodes evaluated between status prints.
598    If <tt>number <=0</tt> the print frequency is set to 100 nodes for large
599    problems, 1000 for small problems.
600    Print frequency has very slight overhead if small.
601  */
602  void setPrintFrequency(int number)
603  { printFrequency_=number;};
604  /// Get the print frequency
605  inline int printFrequency() const
606  { return printFrequency_;};
607  //@}
608
609  //---------------------------------------------------------------------------
610  ///@name Methods returning info on how the solution process terminated
611  //@{
612    /// Are there a numerical difficulties?
613    bool isAbandoned() const;
614    /// Is optimality proven?
615    bool isProvenOptimal() const;
616    /// Is  infeasiblity proven (or none better than cutoff)?
617    bool isProvenInfeasible() const;
618    /// Node limit reached?
619    bool isNodeLimitReached() const;
620    /// Time limit reached?
621    bool isSecondsLimitReached() const;
622    /// Solution limit reached?
623    bool isSolutionLimitReached() const;
624    /// Get how many iterations it took to solve the problem.
625    int getIterationCount() const
626    { return numberIterations_;};
627    /// Get how many Nodes it took to solve the problem.
628    int getNodeCount() const
629    { return numberNodes_;};
630    /** Final status of problem
631        Some of these can be found out by is...... functions
632        -1 before branchAndBound
633        0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
634        (or check value of best solution)
635        1 stopped - on maxnodes, maxsols, maxtime
636        2 difficulties so run was abandoned
637        (5 event user programmed event occurred)
638    */
639    inline int status() const
640    { return status_;};
641    /** Secondary status of problem
642        -1 unset (status_ will also be -1)
643        0 search completed with solution
644        1 linear relaxation not feasible (or worse than cutoff)
645        2 stopped on gap
646        3 stopped on nodes
647        4 stopped on time
648        5 stopped on user event
649        6 stopped on solutions
650    */
651    inline int secondaryStatus() const
652    { return secondaryStatus_;};
653    /// Are there numerical difficulties (for initialSolve) ?
654    bool isInitialSolveAbandoned() const ;
655    /// Is optimality proven (for initialSolve) ?
656    bool isInitialSolveProvenOptimal() const ;
657    /// Is primal infeasiblity proven (for initialSolve) ?
658    bool isInitialSolveProvenPrimalInfeasible() const ;
659    /// Is dual infeasiblity proven (for initialSolve) ?
660    bool isInitialSolveProvenDualInfeasible() const ;
661
662  //@}
663
664  //---------------------------------------------------------------------------
665  /**@name Problem information methods
666     
667     These methods call the solver's query routines to return
668     information about the problem referred to by the current object.
669     Querying a problem that has no data associated with it result in
670     zeros for the number of rows and columns, and NULL pointers from
671     the methods that return vectors.
672     
673     Const pointers returned from any data-query method are valid as
674     long as the data is unchanged and the solver is not called.
675  */
676  //@{
677  /// Number of rows in continuous (root) problem.
678  int numberRowsAtContinuous() const
679  { return numberRowsAtContinuous_;};
680
681  /// Get number of columns
682  int getNumCols() const
683  { return solver_->getNumCols();};
684 
685  /// Get number of rows
686  int getNumRows() const
687  { return solver_->getNumRows();};
688 
689  /// Get number of nonzero elements
690  CoinBigIndex getNumElements() const
691  { return solver_->getNumElements();};
692
693  /// Number of integers in problem
694  inline int numberIntegers() const
695  { return numberIntegers_;};
696  // Integer variables
697  inline const int * integerVariable() const 
698  { return integerVariable_;};
699 
700  /// Get pointer to array[getNumCols()] of column lower bounds
701  const double * getColLower() const
702  { return solver_->getColLower();};
703 
704  /// Get pointer to array[getNumCols()] of column upper bounds
705  const double * getColUpper() const
706  { return solver_->getColUpper();};
707 
708  /** Get pointer to array[getNumRows()] of row constraint senses.
709      <ul>
710      <li>'L': <= constraint
711      <li>'E': =  constraint
712      <li>'G': >= constraint
713      <li>'R': ranged constraint
714      <li>'N': free constraint
715      </ul>
716  */
717  const char * getRowSense() const
718  { return solver_->getRowSense();};
719 
720  /** Get pointer to array[getNumRows()] of rows right-hand sides
721      <ul>
722      <li> if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
723      <li> if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
724      <li> if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
725      <li> if rowsense()[i] == 'N' then rhs()[i] == 0.0
726      </ul>
727  */
728  const double * getRightHandSide() const
729  { return solver_->getRightHandSide();};
730 
731  /** Get pointer to array[getNumRows()] of row ranges.
732      <ul>
733      <li> if rowsense()[i] == 'R' then
734      rowrange()[i] == rowupper()[i] - rowlower()[i]
735      <li> if rowsense()[i] != 'R' then
736      rowrange()[i] is 0.0
737      </ul>
738  */
739  const double * getRowRange() const
740  { return solver_->getRowRange();};
741 
742  /// Get pointer to array[getNumRows()] of row lower bounds
743  const double * getRowLower() const
744  { return solver_->getRowLower();};
745 
746  /// Get pointer to array[getNumRows()] of row upper bounds
747  const double * getRowUpper() const
748  { return solver_->getRowUpper();};
749 
750  /// Get pointer to array[getNumCols()] of objective function coefficients
751  const double * getObjCoefficients() const
752  { return solver_->getObjCoefficients();};
753 
754  /// Get objective function sense (1 for min (default), -1 for max)
755  double getObjSense() const
756  { return solver_->getObjSense();};
757 
758  /// Return true if variable is continuous
759  bool isContinuous(int colIndex) const
760  { return solver_->isContinuous(colIndex);};
761 
762  /// Return true if variable is binary
763  bool isBinary(int colIndex) const
764  { return solver_->isBinary(colIndex);};
765 
766  /** Return true if column is integer.
767      Note: This function returns true if the the column
768      is binary or a general integer.
769  */
770  bool isInteger(int colIndex) const
771  { return solver_->isInteger(colIndex);};
772 
773  /// Return true if variable is general integer
774  bool isIntegerNonBinary(int colIndex) const
775  { return solver_->isIntegerNonBinary(colIndex);};
776 
777  /// Return true if variable is binary and not fixed at either bound
778  bool isFreeBinary(int colIndex) const
779  { return solver_->isFreeBinary(colIndex) ;};
780 
781  /// Get pointer to row-wise copy of matrix
782  const CoinPackedMatrix * getMatrixByRow() const
783  { return solver_->getMatrixByRow();};
784 
785  /// Get pointer to column-wise copy of matrix
786  const CoinPackedMatrix * getMatrixByCol() const
787  { return solver_->getMatrixByCol();};
788 
789  /// Get solver's value for infinity
790  double getInfinity() const
791  { return solver_->getInfinity();};
792  //@}
793 
794 
795  /**@name Methods related to querying the solution */
796  //@{
797  /// Holds solution at continuous (after cuts if branchAndBound called)
798  inline double * continuousSolution() const
799  { return continuousSolution_;};
800  /** Array marked whenever a solution is found if non-zero.
801      Code marks if heuristic returns better so heuristic
802      need only mark if it wants to on solutions which
803      are worse than current */
804  inline int * usedInSolution() const
805  { return usedInSolution_;};
806  /// Increases usedInSolution for nonzeros
807  void incrementUsed(const double * solution);
808  /// Record a new incumbent solution and update objectiveValue
809  void setBestSolution(CBC_Message how,
810                       double & objectiveValue, const double *solution,
811                       bool fixVariables=false);
812  /// Just update objectiveValue
813  void setBestObjectiveValue( double objectiveValue);
814
815  /** Call this to really test if a valid solution can be feasible
816      Solution is number columns in size.
817      If fixVariables true then bounds of continuous solver updated.
818      Returns objective value (worse than cutoff if not feasible)
819 */
820  double checkSolution(double cutoff, const double * solution,
821                       bool fixVariables);
822  /** Test the current solution for feasiblility.
823
824    Scan all objects for indications of infeasibility. This is broken down
825    into simple integer infeasibility (\p numberIntegerInfeasibilities)
826    and all other reports of infeasibility (\p numberObjectInfeasibilities).
827  */
828  bool feasibleSolution(int & numberIntegerInfeasibilities,
829                        int & numberObjectInfeasibilities) const;
830
831  /** Solution to the most recent lp relaxation.
832
833    The solver's solution to the most recent lp relaxation.
834  */
835   
836  inline double * currentSolution() const
837  { return currentSolution_;};
838  /** For testing infeasibilities - will point to
839      currentSolution_ or solver-->getColSolution()
840  */
841  inline const double * testSolution() const
842  { return testSolution_;};
843  inline void setTestSolution(const double * solution)
844  { testSolution_ = solution;};
845  /// Make sure region there and optionally copy solution
846  void reserveCurrentSolution(const double * solution=NULL);
847
848  /// Get pointer to array[getNumCols()] of primal solution vector
849  inline const double * getColSolution() const
850  { return solver_->getColSolution();};
851 
852  /// Get pointer to array[getNumRows()] of dual prices
853  inline const double * getRowPrice() const
854  { return solver_->getRowPrice();};
855 
856  /// Get a pointer to array[getNumCols()] of reduced costs
857  inline const double * getReducedCost() const
858  { return solver_->getReducedCost();};
859 
860  /// Get pointer to array[getNumRows()] of row activity levels.
861  inline const double * getRowActivity() const
862  { return solver_->getRowActivity();};
863 
864  /// Get current objective function value
865  inline double getCurrentObjValue() const
866  { return solver_->getObjValue();};
867 
868  /// Get best objective function value as minimization
869  inline double getMinimizationObjValue() const
870  { return bestObjective_;};
871  /// Set best objective function value as minimization
872  inline void setMinimizationObjValue(double value) 
873  { bestObjective_=value;};
874 
875  /// Get best objective function value
876  inline double getObjValue() const
877  { return bestObjective_ * solver_->getObjSense() ; } ;
878  /** Get best possible objective function value.
879      This is better of best possible left on tree
880      and best solution found.
881      If called from within branch and cut may be optimistic.
882  */
883  double getBestPossibleObjValue() const;
884  /// Set best objective function value
885  inline void setObjValue(double value) 
886  { bestObjective_=value * solver_->getObjSense() ;};
887 
888  /** The best solution to the integer programming problem.
889
890    The best solution to the integer programming problem found during
891    the search. If no solution is found, the method returns null.
892  */
893
894  double * bestSolution() const
895  { return bestSolution_;};
896 
897  /// Get number of solutions
898  int getSolutionCount() const
899  { return numberSolutions_;};
900 
901  /// Set number of solutions (so heuristics will be different)
902  void setSolutionCount(int value) 
903  { numberSolutions_=value;};
904  /** Current phase (so heuristics etc etc can find out).
905      0 - initial solve
906      1 - solve with cuts at root
907      2 - solve with cuts
908      3 - other e.g. strong branching
909      4 - trying to validate a solution
910      5 - at end of search
911  */
912  inline int phase() const
913  { return phase_;};
914 
915  /// Get number of heuristic solutions
916  int getNumberHeuristicSolutions() const { return numberHeuristicSolutions_;};
917
918  /// Set objective function sense (1 for min (default), -1 for max,)
919  void setObjSense(double s) { solver_->setObjSense(s);};
920
921  /// Value of objective at continuous
922  inline double getContinuousObjective() const
923  { return originalContinuousObjective_;};
924  inline void setContinuousObjective(double value)
925  { originalContinuousObjective_=value;};
926  /// Number of infeasibilities at continuous
927  inline int getContinuousInfeasibilities() const
928  { return continuousInfeasibilities_;};
929  inline void setContinuousInfeasibilities(int value)
930  { continuousInfeasibilities_=value;};
931  /// Value of objective after root node cuts added
932  inline double rootObjectiveAfterCuts() const
933  { return continuousObjective_;};
934  /** Number of times global cuts violated.  When global cut pool then this
935      should be kept for each cut and type of cut */
936  inline int numberGlobalViolations() const
937  { return numberGlobalViolations_;};
938  inline void clearNumberGlobalViolations()
939  { numberGlobalViolations_=0;};
940  /// Whether to force a resolve after takeOffCuts
941  inline bool resolveAfterTakeOffCuts() const
942  { return resolveAfterTakeOffCuts_;};
943  inline void setResolveAfterTakeOffCuts(bool yesNo)
944  { resolveAfterTakeOffCuts_=yesNo;};
945  //@}
946
947  /** \name Node selection */
948  //@{
949  // Comparison functions (which may be overridden by inheritance)
950  inline CbcCompareBase * nodeComparison() const
951  { return nodeCompare_;};
952  void setNodeComparison(CbcCompareBase * compare);
953  void setNodeComparison(CbcCompareBase & compare);
954  //@}
955
956  /** \name Tree methods and subtree methods */
957  //@{
958  /// Tree method e.g. heap (which may be overridden by inheritance)
959  inline CbcTree * tree() const
960  { return tree_;};
961  /// For modifying tree handling (original is cloned)
962  void passInTreeHandler(CbcTree & tree);
963  /** For passing in an CbcModel to do a sub Tree (with derived tree handlers).
964      Passed in model must exist for duration of branch and bound
965  */
966  void passInSubTreeModel(CbcModel & model);
967  /** For retrieving a copy of subtree model with given OsiSolver.
968      If no subtree model will use self (up to user to reset cutoff etc).
969      If solver NULL uses current
970  */
971  CbcModel * subTreeModel(OsiSolverInterface * solver=NULL) const;
972  /// Returns number of times any subtree stopped on nodes, time etc
973  inline int numberStoppedSubTrees() const
974  { return numberStoppedSubTrees_;}
975  /// Says a sub tree was stopped
976  inline void incrementSubTreeStopped()
977  { numberStoppedSubTrees_++;};
978  /** Whether to automatically do presolve before branch and bound (subTrees).
979      0 - no
980      1 - ordinary presolve
981      2 - integer presolve (dodgy)
982  */
983  inline int typePresolve() const
984  { return presolve_;};
985  inline void setTypePresolve(int value)
986  { presolve_=value;};
987  //@}
988
989  /** \name Branching Decisions
990 
991    See the CbcBranchDecision class for additional information.
992  */
993  //@{
994
995  /// Get the current branching decision method.
996  inline CbcBranchDecision * branchingMethod() const
997  { return branchingMethod_;};
998  /// Set the branching decision method.
999  inline void setBranchingMethod(CbcBranchDecision * method)
1000  { branchingMethod_ = method;};
1001  /** Set the branching method
1002 
1003    \overload
1004  */
1005  inline void setBranchingMethod(CbcBranchDecision & method)
1006  { branchingMethod_ = &method;};
1007  //@}
1008
1009  /** \name Row (constraint) and Column (variable) cut generation */
1010  //@{
1011
1012  /** Perform reduced cost fixing
1013
1014    Fixes integer variables at their current value based on reduced cost
1015    penalties.
1016  */
1017  void reducedCostFix() ;
1018
1019  /** Return an empty basis object of the specified size
1020
1021    A useful utility when constructing a basis for a subproblem from scratch.
1022    The object returned will be of the requested capacity and appropriate for
1023    the solver attached to the model.
1024  */
1025  CoinWarmStartBasis *getEmptyBasis(int ns = 0, int na = 0) const ;
1026
1027  /** Remove inactive cuts from the model
1028
1029    An OsiSolverInterface is expected to maintain a valid basis, but not a
1030    valid solution, when loose cuts are deleted. Restoring a valid solution
1031    requires calling the solver to reoptimise. If it's certain the solution
1032    will not be required, set allowResolve to false to suppress
1033    reoptimisation.
1034  */
1035  void takeOffCuts(OsiCuts &cuts, int *whichGenerator,
1036                     int &numberOldActiveCuts, int &numberNewCuts,
1037                     bool allowResolve) ;
1038
1039  /** Determine and install the active cuts that need to be added for
1040    the current subproblem
1041
1042    The whole truth is a bit more complicated. The first action is a call to
1043    addCuts1(). addCuts() then sorts through the list, installs the tight
1044    cuts in the model, and does bookkeeping (adjusts reference counts).
1045    The basis returned from addCuts1() is adjusted accordingly.
1046   
1047    If it turns out that the node should really be fathomed by bound,
1048    addCuts() simply treats all the cuts as loose as it does the bookkeeping.
1049  */
1050  int addCuts(CbcNode * node, CoinWarmStartBasis *&lastws);
1051
1052  /** Traverse the tree from node to root and prep the model
1053
1054    addCuts1() begins the job of prepping the model to match the current
1055    subproblem. The model is stripped of all cuts, and the search tree is
1056    traversed from node to root to determine the changes required. Appropriate
1057    bounds changes are installed, a list of cuts is collected but not
1058    installed, and an appropriate basis (minus the cuts, but big enough to
1059    accommodate them) is constructed.
1060
1061    \todo addCuts1() is called in contexts where it's known in advance that
1062          all that's desired is to determine a list of cuts and do the
1063          bookkeeping (adjust the reference counts). The work of installing
1064          bounds and building a basis goes to waste.
1065  */
1066  void addCuts1(CbcNode * node, CoinWarmStartBasis *&lastws);
1067
1068  /// Return the list of cuts initially collected for this subproblem
1069  CbcCountRowCut ** addedCuts() const
1070  { return addedCuts_;};
1071  /// Number of entries in the list returned by #addedCuts()
1072  int currentNumberCuts() const
1073  { return currentNumberCuts_;};
1074  /// Global cuts
1075  inline OsiCuts * globalCuts() 
1076  { return &globalCuts_;};
1077  /// Copy and set a pointer to a row cut which will be added instead of normal branching.
1078  void setNextRowCut(const OsiRowCut & cut);
1079  /// Get a pointer to current node (be careful)
1080  inline CbcNode * currentNode() const
1081  { return currentNode_;};
1082  /** State of search
1083      0 - no solution
1084      1 - only heuristic solutions
1085      2 - branched to a solution
1086      3 - no solution but many nodes
1087  */
1088  inline int stateOfSearch() const
1089  { return stateOfSearch_;};
1090
1091  /// Get the number of cut generators
1092  inline int numberCutGenerators() const
1093  { return numberCutGenerators_;};
1094  /// Get the list of cut generators
1095  inline CbcCutGenerator ** cutGenerators() const
1096  { return generator_;};
1097  ///Get the specified cut generator
1098  inline CbcCutGenerator * cutGenerator(int i) const
1099  { return generator_[i];};
1100  ///Get the specified cut generator before any changes
1101  inline CbcCutGenerator * virginCutGenerator(int i) const
1102  { return virginGenerator_[i];};
1103  /** Add one generator - up to user to delete generators.
1104      howoften affects how generator is used. 0 or 1 means always,
1105      >1 means every that number of nodes.  Negative values have same
1106      meaning as positive but they may be switched off (-> -100) by code if
1107      not many cuts generated at continuous.  -99 is just done at root.
1108      Name is just for printout.
1109      If depth >0 overrides how often generator is called (if howOften==-1 or >0).
1110  */
1111  void addCutGenerator(CglCutGenerator * generator,
1112                       int howOften=1, const char * name=NULL,
1113                       bool normal=true, bool atSolution=false, 
1114                       bool infeasible=false,int howOftenInSub=-100,
1115                       int whatDepth=-1, int whatDepthInSub=-1);
1116//@}
1117  /** \name Strategy and sub models
1118 
1119    See the CbcStrategy class for additional information.
1120  */
1121  //@{
1122
1123  /// Get the current strategy
1124  inline CbcStrategy * strategy() const
1125  { return strategy_;};
1126  /// Set the strategy. Clones
1127  void setStrategy(CbcStrategy & strategy);
1128  /// Get the current parent model
1129  inline CbcModel * parentModel() const
1130  { return parentModel_;};
1131  /// Set the parent model
1132  inline void setParentModel(CbcModel & parentModel)
1133  { parentModel_ = &parentModel;};
1134  //@}
1135
1136
1137  /** \name Heuristics and priorities */
1138  //@{
1139  /// Add one heuristic - up to user to delete
1140  void addHeuristic(CbcHeuristic * generator);
1141  ///Get the specified heuristic
1142  inline CbcHeuristic * heuristic(int i) const
1143  { return heuristic_[i];};
1144  /// Get the number of heuristics
1145  inline int numberHeuristics() const
1146  { return numberHeuristics_;};
1147
1148  /** Pass in branching priorities.
1149 
1150      If ifClique then priorities are on cliques otherwise priorities are
1151      on integer variables. 
1152      Other type (if exists set to default)
1153      1 is highest priority. (well actually -INT_MAX is but that's ugly)
1154      If hotstart > 0 then branches are created to force
1155      the variable to the value given by best solution.  This enables a
1156      sort of hot start.  The node choice should be greatest depth
1157      and hotstart should normally be switched off after a solution.
1158
1159      If ifNotSimpleIntegers true then appended to normal integers
1160
1161      This is now deprecated except for simple usage.  If user
1162      creates Cbcobjects then set priority in them
1163
1164      \internal Added for Kurt Spielberg.
1165  */
1166  void passInPriorities(const int * priorities, bool ifNotSimpleIntegers);
1167
1168  /// Returns priority level for an object (or 1000 if no priorities exist)
1169  inline int priority(int sequence) const
1170  { return object_[sequence]->priority();}; 
1171  //@}
1172   
1173  /**@name Setting/Accessing application data */
1174  //@{
1175    /** Set application data.
1176
1177        This is a pointer that the application can store into and
1178        retrieve from the solver interface.
1179        This field is available for the application to optionally
1180        define and use.
1181    */
1182    void setApplicationData (void * appData);
1183
1184    /// Get application data
1185    void * getApplicationData() const;
1186  //@}
1187 
1188  //---------------------------------------------------------------------------
1189
1190  /**@name Message handling */
1191  //@{
1192  /// Pass in Message handler (not deleted at end)
1193  void passInMessageHandler(CoinMessageHandler * handler);
1194  /// Set language
1195  void newLanguage(CoinMessages::Language language);
1196  inline void setLanguage(CoinMessages::Language language)
1197  {newLanguage(language);};
1198  /// Return handler
1199  inline CoinMessageHandler * messageHandler() const
1200  {return handler_;};
1201  /// Return messages
1202  inline CoinMessages messages() 
1203  {return messages_;};
1204  /// Return pointer to messages
1205  inline CoinMessages * messagesPointer() 
1206  {return &messages_;};
1207  /// Set log level
1208  inline void setLogLevel(int value)
1209  { handler_->setLogLevel(value);};
1210  /// Get log level
1211  inline int logLevel() const
1212  { return handler_->logLevel();};
1213  //@}
1214  //---------------------------------------------------------------------------
1215  ///@name Specialized
1216  //@{
1217
1218  /**
1219      Set special options
1220      0 bit (1) - check if cuts valid (if on debugger list)
1221      1 bit (2) - use current basis to check integer solution (rather than all slack)
1222      2 bit (4) - don't check integer solution
1223  */
1224  /// Set special options
1225  inline void setSpecialOptions(int value)
1226  { specialOptions_=value;};
1227  /// Get special options
1228  inline int specialOptions() const
1229  { return specialOptions_;};
1230  //@}
1231  //---------------------------------------------------------------------------
1232
1233  ///@name Constructors and destructors etc
1234  //@{
1235    /// Default Constructor
1236    CbcModel(); 
1237   
1238    /// Constructor from solver
1239    CbcModel(const OsiSolverInterface &);
1240 
1241    /** Assign a solver to the model (model assumes ownership)
1242
1243      On return, \p solver will be NULL.
1244
1245      \note Parameter settings in the outgoing solver are not inherited by
1246            the incoming solver.
1247    */
1248    void assignSolver(OsiSolverInterface *&solver);
1249 
1250    /** Copy constructor .
1251      If noTree is true then tree and cuts are not copied
1252    */ 
1253    CbcModel(const CbcModel & rhs, bool noTree=false);
1254 
1255    /// Assignment operator
1256    CbcModel & operator=(const CbcModel& rhs);
1257 
1258    /// Destructor
1259     ~CbcModel ();
1260
1261    /// Returns solver - has current state
1262    OsiSolverInterface * solver() const
1263    { return solver_;};
1264
1265    /// Returns solver with continuous state
1266    OsiSolverInterface * continuousSolver() const
1267    { return continuousSolver_;};
1268  /// Clears out as much as possible (except solver)
1269  void gutsOfDestructor();
1270  //@}
1271
1272  ///@semi-private i.e. users should not use
1273  //@{
1274    /// Get how many Nodes it took to solve the problem.
1275    int getNodeCount2() const
1276    { return numberNodes2_;};
1277  //@}
1278
1279//---------------------------------------------------------------------------
1280
1281private:
1282  ///@name Private member data
1283  //@{
1284
1285  /// The solver associated with this model.
1286  OsiSolverInterface * solver_;
1287
1288  /** Ownership of the solver object
1289
1290    The convention is that CbcModel owns the null solver. Currently there
1291    is no public method to give CbcModel a solver without giving ownership,
1292    but the hook is here.
1293  */
1294  bool ourSolver_ ;
1295
1296  /// A copy of the solver, taken at the continuous (root) node.
1297  OsiSolverInterface * continuousSolver_;
1298
1299   /// Message handler
1300  CoinMessageHandler * handler_;
1301
1302  /** Flag to say if handler_ is the default handler.
1303 
1304    The default handler is deleted when the model is deleted. Other
1305    handlers (supplied by the client) will not be deleted.
1306  */
1307  bool defaultHandler_;
1308
1309  /// Cbc messages
1310  CoinMessages messages_;
1311
1312  /// Array for integer parameters
1313  int intParam_[CbcLastIntParam];
1314
1315  /// Array for double parameters
1316  double dblParam_[CbcLastDblParam];
1317
1318  /** Pointer to an empty warm start object
1319
1320    It turns out to be useful to have this available as a base from
1321    which to build custom warm start objects. This is typed as CoinWarmStart
1322    rather than CoinWarmStartBasis to allow for the possibility that a
1323    client might want to apply a solver that doesn't use a basis-based warm
1324    start. See getEmptyBasis for an example of how this field can be used.
1325  */
1326  mutable CoinWarmStart *emptyWarmStart_ ;
1327
1328  /** Pointer to a warm start basis.  */
1329  CoinWarmStartBasis *basis_;
1330
1331  /// Best objective
1332  double bestObjective_;
1333  /// Best possible objective
1334  double bestPossibleObjective_;
1335  /// Sum of Changes to objective by first solve
1336  double sumChangeObjective1_;
1337  /// Sum of Changes to objective by subsequent solves
1338  double sumChangeObjective2_;
1339
1340  /// Array holding the incumbent (best) solution.
1341  double * bestSolution_;
1342
1343  /** Array holding the current solution.
1344
1345    This array is used more as a temporary.
1346  */
1347  double * currentSolution_;
1348  /** For testing infeasibilities - will point to
1349      currentSolution_ or solver-->getColSolution()
1350  */
1351  mutable const double * testSolution_;
1352  /// Global cuts
1353  OsiCuts globalCuts_;
1354
1355  /// Minimum degradation in objective value to continue cut generation
1356  double minimumDrop_;
1357  /// Number of solutions
1358  int numberSolutions_;
1359  /** State of search
1360      0 - no solution
1361      1 - only heuristic solutions
1362      2 - branched to a solution
1363      3 - no solution but many nodes
1364  */
1365  int stateOfSearch_;
1366  /// Hotstart strategy 0 =off, 1=branch if incorrect,2=branch even if correct, ....
1367  int hotstartStrategy_;
1368  /// Number of heuristic solutions
1369  int numberHeuristicSolutions_;
1370  /// Cumulative number of nodes
1371  int numberNodes_;
1372  /** Cumulative number of nodes for statistics.
1373      Must fix to match up
1374  */
1375  int numberNodes2_;
1376  /// Cumulative number of iterations
1377  int numberIterations_;
1378  /// Status of problem - 0 finished, 1 stopped, 2 difficulties
1379  int status_;
1380  /** Secondary status of problem
1381      -1 unset (status_ will also be -1)
1382      0 search completed with solution
1383      1 linear relaxation not feasible (or worse than cutoff)
1384      2 stopped on gap
1385      3 stopped on nodes
1386      4 stopped on time
1387      5 stopped on user event
1388      6 stopped on solutions
1389   */
1390  int secondaryStatus_;
1391  /// Number of integers in problem
1392  int numberIntegers_;
1393  /// Number of rows at continuous
1394  int numberRowsAtContinuous_;
1395  /// Maximum number of cuts
1396  int maximumNumberCuts_;
1397  /** Current phase (so heuristics etc etc can find out).
1398      0 - initial solve
1399      1 - solve with cuts at root
1400      2 - solve with cuts
1401      3 - other e.g. strong branching
1402      4 - trying to validate a solution
1403      5 - at end of search
1404  */
1405  int phase_;
1406
1407  /// Number of entries in #addedCuts_
1408  int currentNumberCuts_;
1409
1410  /** Current limit on search tree depth
1411
1412    The allocated size of #walkback_. Increased as needed.
1413  */
1414  int maximumDepth_;
1415  /** Array used to assemble the path between a node and the search tree root
1416
1417    The array is resized when necessary. #maximumDepth_  is the current
1418    allocated size.
1419  */
1420  CbcNodeInfo ** walkback_;
1421
1422  /** The list of cuts initially collected for this subproblem
1423
1424    When the subproblem at this node is rebuilt, a set of cuts is collected
1425    for inclusion in the constraint system. If any of these cuts are
1426    subsequently removed because they have become loose, the corresponding
1427    entry is set to NULL.
1428  */
1429  CbcCountRowCut ** addedCuts_;
1430
1431  /** A pointer to a row cut which will be added instead of normal branching.
1432      After use it should be set to NULL.
1433  */
1434  OsiRowCut * nextRowCut_;
1435
1436  /// Current node so can be used elsewhere
1437  CbcNode * currentNode_;
1438
1439  /// Indices of integer variables
1440  int * integerVariable_;
1441  /// Holds solution at continuous (after cuts)
1442  double * continuousSolution_;
1443  /// Array marked whenever a solution is found if non-zero
1444  int * usedInSolution_;
1445  /**
1446      0 bit (1) - check if cuts valid (if on debugger list)
1447      1 bit (2) - use current basis to check integer solution (rather than all slack)
1448      2 bit (4) - don't check integer solution
1449  */
1450  int specialOptions_;
1451  /// User node comparison function
1452  CbcCompareBase * nodeCompare_;
1453  /// Tree
1454  CbcTree * tree_;
1455  /// A pointer to model to be used for subtrees
1456  CbcModel * subTreeModel_;
1457  /// Number of times any subtree stopped on nodes, time etc
1458  int numberStoppedSubTrees_;
1459  /// Variable selection function
1460  CbcBranchDecision * branchingMethod_;
1461  /// Strategy
1462  CbcStrategy * strategy_;
1463  /// Parent model
1464  CbcModel * parentModel_;
1465  /** Whether to automatically do presolve before branch and bound.
1466      0 - no
1467      1 - ordinary presolve
1468      2 - integer presolve (dodgy)
1469  */
1470  /// Pointer to user-defined data structure
1471  void * appData_;
1472  int presolve_;
1473  /** Maximum number of candidates to consider for strong branching.
1474
1475    To disable strong branching, set this to 0.
1476  */
1477  int numberStrong_;
1478  /** The number of branches before pseudo costs believed
1479      in dynamic strong branching. (0 off) */
1480  int numberBeforeTrust_;
1481  /** The number of variable sfor which to compute penalties
1482      in dynamic strong branching. (0 off) */
1483  int numberPenalties_;
1484  /** Scale factor to make penalties match strong.
1485      Should/will be computed */
1486  double penaltyScaleFactor_;
1487  /// Number of nodes infeasible by normal branching (before cuts)
1488  int numberInfeasibleNodes_;
1489  /** Problem type as set by user or found by analysis.  This will be extended
1490      0 - not known
1491      1 - Set partitioning <=
1492      2 - Set partitioning ==
1493      3 - Set covering
1494  */
1495  int problemType_;
1496  /// Print frequency
1497  int printFrequency_;
1498  /// Number of cut generators
1499  int numberCutGenerators_;
1500  // Cut generators
1501  CbcCutGenerator ** generator_;
1502  // Cut generators before any changes
1503  CbcCutGenerator ** virginGenerator_;
1504  /// Number of heuristics
1505  int numberHeuristics_;
1506  // Heuristic solvers
1507  CbcHeuristic ** heuristic_;
1508
1509  /// Total number of objects
1510  int numberObjects_;
1511
1512  /** \brief Integer and Clique and ... information
1513
1514    \note The code assumes that the first objects on the list will be
1515          SimpleInteger objects for each integer variable, followed by
1516          Clique objects. Portions of the code that understand Clique objects
1517          will fail if they do not immediately follow the SimpleIntegers.
1518          Large chunks of the code will fail if the first objects are not
1519          SimpleInteger. As of 2003.08, SimpleIntegers and Cliques are the only
1520          objects.
1521  */
1522  CbcObject ** object_;
1523
1524 
1525  /// Original columns as created by integerPresolve
1526  int * originalColumns_;
1527  /// How often to scan global cuts
1528  int howOftenGlobalScan_;
1529  /** Number of times global cuts violated.  When global cut pool then this
1530      should be kept for each cut and type of cut */
1531  int numberGlobalViolations_;
1532  /** Value of objective at continuous
1533      (Well actually after initial round of cuts)
1534  */
1535  double continuousObjective_;
1536  /** Value of objective before root node cuts added
1537  */
1538  double originalContinuousObjective_;
1539  /// Number of infeasibilities at continuous
1540  int continuousInfeasibilities_;
1541  /// Maximum number of cut passes at root
1542  int maximumCutPassesAtRoot_;
1543  /// Maximum number of cut passes
1544  int maximumCutPasses_;
1545  /// Current cut pass number
1546  int currentPassNumber_;
1547  /// Whether to force a resolve after takeOffCuts
1548  bool resolveAfterTakeOffCuts_;
1549 //@}
1550};
1551
1552#endif
Note: See TracBrowser for help on using the repository browser.