source: trunk/include/CbcModel.hpp @ 165

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

CbcFeasibility?

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