source: branches/devel/Cbc/src/CbcModel.hpp @ 642

Last change on this file since 642 was 642, checked in by forrest, 12 years ago

update branches/devel for threads

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 71.5 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#include <string>
6#include <vector>
7#include "CoinFinite.hpp"
8#include "CoinMessageHandler.hpp"
9#include "OsiSolverInterface.hpp"
10#include "OsiBranchingObject.hpp"
11#include "OsiCuts.hpp"
12#include "CoinWarmStartBasis.hpp"
13#include "CbcCompareBase.hpp"
14#include "CbcMessage.hpp"
15
16//class OsiSolverInterface;
17
18class CbcCutGenerator;
19class OsiRowCut;
20class OsiBabSolver;
21class OsiRowCutDebugger;
22class CglCutGenerator;
23class CbcCutModifier;
24class CglTreeProbingInfo;
25class CbcHeuristic;
26class OsiObject;
27class CbcTree;
28class CbcStrategy;
29class CbcFeasibilityBase;
30class CbcStatistics;
31class CbcEventHandler ;
32class CglPreProcess;
33
34// #define CBC_CHECK_BASIS 1
35
36//#############################################################################
37
38/** Simple Branch and bound class
39
40  The initialSolve() method solves the initial LP relaxation of the MIP
41  problem. The branchAndBound() method can then be called to finish using
42  a branch and cut algorithm.
43
44  <h3>Search Tree Traversal</h3>
45
46  Subproblems (aka nodes) requiring additional evaluation are stored using
47  the CbcNode and CbcNodeInfo objects. Ancestry linkage is maintained in the
48  CbcNodeInfo object. Evaluation of a subproblem within branchAndBound()
49  proceeds as follows:
50  <ul>
51    <li> The node representing the most promising parent subproblem is popped
52         from the heap which holds the set of subproblems requiring further
53         evaluation.
54    <li> Using branching instructions stored in the node, and information in
55         its ancestors, the model and solver are adjusted to create the
56         active subproblem.
57    <li> If the parent subproblem will require further evaluation
58         (<i>i.e.</i>, there are branches remaining) its node is pushed back
59         on the heap. Otherwise, the node is deleted.  This may trigger
60         recursive deletion of ancestors.
61    <li> The newly created subproblem is evaluated.
62    <li> If the subproblem requires further evaluation, a node is created.
63         All information needed to recreate the subproblem (branching
64         information, row and column cuts) is placed in the node and the node
65         is added to the set of subproblems awaiting further evaluation.
66  </ul>
67  Note that there is never a node representing the active subproblem; the model
68  and solver represent the active subproblem.
69
70  <h3>Row (Constraint) Cut Handling</h3>
71
72  For a typical subproblem, the sequence of events is as follows:
73  <ul>
74    <li> The subproblem is rebuilt for further evaluation: One result of a
75         call to addCuts() is a traversal of ancestors, leaving a list of all
76         cuts used in the ancestors in #addedCuts_. This list is then scanned
77         to construct a basis that includes only tight cuts. Entries for
78         loose cuts are set to NULL.
79    <li> The subproblem is evaluated: One result of a call to solveWithCuts()
80         is the return of a set of newly generated cuts for the subproblem.
81         #addedCuts_ is also kept up-to-date as old cuts become loose.
82    <li> The subproblem is stored for further processing: A call to
83         CbcNodeInfo::addCuts() adds the newly generated cuts to the
84         CbcNodeInfo object associated with this node.
85  </ul>
86  See CbcCountRowCut for details of the bookkeeping associated with cut
87  management.
88*/
89
90class CbcModel  {
91 
92public:
93
94enum CbcIntParam {
95  /** The maximum number of nodes before terminating */
96  CbcMaxNumNode=0,
97  /** The maximum number of solutions before terminating */
98  CbcMaxNumSol,
99  /** Fathoming discipline
100
101    Controls objective function comparisons for purposes of fathoming by bound
102    or determining monotonic variables.
103
104    If 1, action is taken only when the current objective is strictly worse
105    than the target. Implementation is handled by adding a small tolerance to
106    the target.
107  */
108  CbcFathomDiscipline,
109  /** Adjusts printout
110      1 does different node message with number unsatisfied on last branch
111  */
112  CbcPrinting,
113  /** Just a marker, so that a static sized array can store parameters. */
114  CbcLastIntParam
115};
116
117enum CbcDblParam {
118  /** The maximum amount the value of an integer variable can vary from
119      integer and still be considered feasible. */
120  CbcIntegerTolerance=0,
121  /** The objective is assumed to worsen by this amount for each
122      integer infeasibility. */
123  CbcInfeasibilityWeight,
124  /** The amount by which to tighten the objective function cutoff when
125      a new solution is discovered. */
126  CbcCutoffIncrement,
127  /** Stop when the gap between the objective value of the best known solution
128    and the best bound on the objective of any solution is less than this.
129 
130    This is an absolute value. Conversion from a percentage is left to the
131    client.
132  */
133  CbcAllowableGap,
134  /** Stop when the gap between the objective value of the best known solution
135    and the best bound on the objective of any solution is less than this
136    fraction of of the absolute value of best known solution.
137 
138    Code stops if either this test or CbcAllowableGap test succeeds
139  */
140  CbcAllowableFractionGap,
141  /** \brief The maximum number of seconds before terminating.
142             A double should be adequate! */
143  CbcMaximumSeconds,
144  /// Cutoff - stored for speed
145  CbcCurrentCutoff,
146  /// Optimization direction - stored for speed
147  CbcOptimizationDirection,
148  /// Current objective value
149  CbcCurrentObjectiveValue,
150  /// Current minimization objective value
151  CbcCurrentMinimizationObjectiveValue,
152  /** \brief The time at start of model.
153             So that other pieces of code can access */
154  CbcStartSeconds,
155  /** Just a marker, so that a static sized array can store parameters. */
156  CbcLastDblParam
157};
158
159  //---------------------------------------------------------------------------
160
161public:
162  ///@name Solve methods
163  //@{
164    /** \brief Solve the initial LP relaxation
165
166      Invoke the solver's %initialSolve() method.
167    */
168    void initialSolve(); 
169
170    /** \brief Invoke the branch \& cut algorithm
171
172      The method assumes that initialSolve() has been called to solve the
173      LP relaxation. It processes the root node, then proceeds to explore the
174      branch & cut search tree. The search ends when the tree is exhausted or
175      one of several execution limits is reached.
176      If doStatistics is 1 summary statistics are printed
177      if 2 then also the path to best solution (if found by branching)
178      if 3 then also one line per node
179    */
180     void branchAndBound(int doStatistics=0);
181
182    /** \brief create a clean model from partially fixed problem
183
184      The method creates a new model with given bounds and with no tree.
185    */
186     CbcModel *  cleanModel(const double * lower, const double * upper);
187    /** \brief Invoke the branch \& cut algorithm on partially fixed problem
188
189      The method presolves the given model and does branch and cut. 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      Normally okay to do cleanModel immediately followed by subBranchandBound
198      (== other form of subBranchAndBound)
199      but may need to get at model for advanced features.
200
201      Deletes model2
202    */
203     int subBranchAndBound(CbcModel * model2,
204                           CbcModel * presolvedModel,
205                           int maximumNodes);
206    /** \brief Invoke the branch \& cut algorithm on partially fixed problem
207
208      The method creates a new model with given bounds, presolves it
209      then proceeds to explore the branch & cut search tree. The search
210      ends when the tree is exhausted or maximum nodes is reached.
211
212      If better solution found then it is saved.
213
214      Returns 0 if search completed and solution, 1 if not completed and solution,
215      2 if completed and no solution, 3 if not completed and no solution.
216
217      This is just subModel immediately followed by other version of
218      subBranchandBound.
219
220    */
221     int subBranchAndBound(const double * lower, const double * upper,
222                            int maximumNodes);
223
224    /** \brief Process root node and return a strengthened model
225
226      The method assumes that initialSolve() has been called to solve the
227      LP relaxation. It processes the root node and then returns a pointer
228      to the strengthened model (or NULL if infeasible)
229    */
230     OsiSolverInterface *  strengthenedModel();
231  /** preProcess problem - replacing solver
232      If makeEquality true then <= cliques converted to ==.
233      Presolve will be done numberPasses times.
234
235      Returns NULL if infeasible
236
237      If makeEquality is 1 add slacks to get cliques,
238      if 2 add slacks to get sos (but only if looks plausible) and keep sos info
239  */
240  CglPreProcess * preProcess( int makeEquality=0, int numberPasses=5,
241                  int tuning=5);
242  /** Does postprocessing - original solver back.
243      User has to delete process */
244  void postProcess(CglPreProcess * process);
245private:
246    /** \brief Evaluate a subproblem using cutting planes and heuristics
247
248      The method invokes a main loop which generates cuts, applies heuristics,
249      and reoptimises using the solver's native %resolve() method.
250      It returns true if the subproblem remains feasible at the end of the
251      evaluation.
252    */
253  bool solveWithCuts(OsiCuts & cuts, int numberTries,CbcNode * node);
254  /** Input one node output N nodes to put on tree and optional solution update
255      This should be able to operate in parallel so is given a solver and is const(ish)
256      However we will need to keep an array of solver_ and bases and more
257      status is 0 for normal, 1 if solution
258      Calling code should always push nodes back on tree
259  */
260  CbcNode ** solveOneNode(int whichSolver,CbcNode * node, 
261                          int & numberNodesOutput, int & status) ;
262  /// Update size of whichGenerator
263  void resizeWhichGenerator(int numberNow, int numberAfter);
264public:
265  /** Do one node - broken out for clarity?
266      also for parallel (when baseModel!=this)
267      Returns 1 if solution found
268      node NULL on return if no branches left
269      newNode NULL if no new node created
270  */
271  int doOneNode(CbcModel * baseModel, CbcNode * & node, CbcNode * & newNode);
272
273  /// Returns true if locked
274  bool isLocked() const;
275#ifdef CBC_THREAD
276  /**
277     Locks a thread if parallel so that stuff like cut pool
278     can be updated and/or used.
279  */
280  void lockThread();
281  /**
282     Unlocks a thread if parallel to say cut pool stuff not needed
283  */
284  void unlockThread();
285#else
286  inline void lockThread() {};
287  inline void unlockThread() {};
288#endif
289private:
290  /** Move/copy information from one model to another
291      -1 - initialization
292      0 - from base model
293      1 - to base model (and reset)
294      2 - add in final statistics etc (and reset so can do clean destruction)
295  */
296  void moveToModel(CbcModel * baseModel,int mode);
297public:
298    /** \brief Reoptimise an LP relaxation
299   
300      Invoke the solver's %resolve() method.
301      whereFrom -
302      0 - initial continuous
303      1 - resolve on branch (before new cuts)
304      2 - after new cuts
305      3  - obsolete code or something modified problem in unexpected way
306      10 - after strong branching has fixed variables at root
307      11 - after strong branching has fixed variables in tree
308
309      returns 1 feasible, 0 infeasible, -1 feasible but skip cuts
310    */
311    int resolve(CbcNodeInfo * parent, int whereFrom);
312    /// Make given rows (L or G) into global cuts and remove from lp
313    void makeGlobalCuts(int numberRows,const int * which); 
314    /// Make given cut into a global cut
315    void makeGlobalCut(const OsiRowCut * cut); 
316    /// Make given cut into a global cut
317    void makeGlobalCut(const OsiRowCut & cut); 
318  //@}
319
320  /** \name Presolve methods */
321  //@{
322
323  /** Identify cliques and construct corresponding objects.
324
325      Find cliques with size in the range
326      [\p atLeastThisMany, \p lessThanThis] and construct corresponding
327      CbcClique objects.
328      If \p makeEquality is true then a new model may be returned if
329      modifications had to be made, otherwise \c this is returned.
330      If the problem is infeasible #numberObjects_ is set to -1.
331      A client must use deleteObjects() before a second call to findCliques().
332      If priorities exist, clique priority is set to the default.
333  */
334  CbcModel * findCliques(bool makeEquality, int atLeastThisMany,
335                         int lessThanThis, int defaultValue=1000);
336
337  /** Do integer presolve, creating a new (presolved) model.
338
339    Returns the new model, or NULL if feasibility is lost.
340    If weak is true then just does a normal presolve
341 
342    \todo It remains to work out the cleanest way of getting a solution to
343          the original problem at the end. So this is very preliminary.
344   */
345  CbcModel * integerPresolve(bool weak=false);
346
347  /** Do integer presolve, modifying the current model.
348
349      Returns true if the model remains feasible after presolve.
350  */
351  bool integerPresolveThisModel(OsiSolverInterface * originalSolver,bool weak=false);
352
353
354  /// Put back information into the original model after integer presolve.
355  void originalModel(CbcModel * presolvedModel,bool weak);
356
357  /** \brief For variables involved in VUB constraints, see if we can tighten
358             bounds by solving lp's
359
360      Returns false if feasibility is lost.
361      If CglProbing is available, it will be tried as well to see if it can
362      tighten bounds.
363      This routine is just a front end for tightenVubs(int,const int*,double).
364
365      If <tt>type = -1</tt> all variables are processed (could be very slow).
366      If <tt>type = 0</tt> only variables involved in VUBs are processed.
367      If <tt>type = n > 0</tt>, only the n most expensive VUB variables
368      are processed, where it is assumed that x is at its maximum so delta
369      would have to go to 1 (if x not at bound).
370
371      If \p allowMultipleBinary is true, then a VUB constraint is a row with
372      one continuous variable and any number of binary variables.
373
374      If <tt>useCutoff < 1.0e30</tt>, the original objective is installed as a
375      constraint with \p useCutoff as a bound.
376  */
377  bool tightenVubs(int type,bool allowMultipleBinary=false,
378                   double useCutoff=1.0e50);
379 
380  /** \brief For variables involved in VUB constraints, see if we can tighten
381             bounds by solving lp's
382
383    This version is just handed a list of variables to be processed.
384  */
385  bool tightenVubs(int numberVubs, const int * which,
386                   double useCutoff=1.0e50);
387  /**
388    Analyze problem to find a minimum change in the objective function.
389  */
390  void analyzeObjective();
391
392
393  //@}
394
395  /** \name Object manipulation routines
396 
397    See OsiObject for an explanation of `object' in the context of CbcModel.
398  */
399  //@{
400
401  /// Get the number of objects
402  inline int numberObjects() const { return numberObjects_;};
403  /// Set the number of objects
404  inline void setNumberObjects(int number) 
405  {  numberObjects_=number;};
406
407  /// Get the array of objects
408  inline OsiObject ** objects() const { return object_;};
409
410  /// Get the specified object
411  const inline OsiObject * object(int which) const { return object_[which];};
412  /// Get the specified object
413  inline OsiObject * modifiableObject(int which) const { return object_[which];};
414
415  /// Delete all object information (and just back to integers if true)
416  void deleteObjects(bool findIntegers=true);
417
418  /** Add in object information.
419 
420    Objects are cloned; the owner can delete the originals.
421  */
422  void addObjects(int numberObjects, OsiObject ** objects);
423
424  /** Add in object information.
425 
426    Objects are cloned; the owner can delete the originals.
427  */
428  void addObjects(int numberObjects, CbcObject ** objects);
429
430  /// Ensure attached objects point to this model.
431  void synchronizeModel() ;
432
433  /** \brief Identify integer variables and create corresponding objects.
434 
435    Record integer variables and create an CbcSimpleInteger object for each
436    one.
437    If \p startAgain is true, a new scan is forced, overwriting any existing
438    integer variable information.
439    If type > 0 then 1==PseudoCost
440  */
441
442  void findIntegers(bool startAgain,int type=0);
443
444  //@}
445
446  //---------------------------------------------------------------------------
447
448  /**@name Parameter set/get methods
449
450     The set methods return true if the parameter was set to the given value,
451     false if the value of the parameter is out of range.
452
453     The get methods return the value of the parameter.
454
455  */
456  //@{
457  /// Set an integer parameter
458  inline bool setIntParam(CbcIntParam key, int value) {
459    intParam_[key] = value;
460    return true;
461  }
462  /// Set a double parameter
463  inline bool setDblParam(CbcDblParam key, double value) {
464    dblParam_[key] = value;
465    return true;
466  }
467  /// Get an integer parameter
468  inline int getIntParam(CbcIntParam key) const {
469    return intParam_[key];
470  }
471  /// Get a double parameter
472  inline double getDblParam(CbcDblParam key) const {
473    return dblParam_[key];
474  }
475  /*! \brief Set cutoff bound on the objective function.
476
477    When using strict comparison, the bound is adjusted by a tolerance to
478    avoid accidentally cutting off the optimal solution.
479  */
480  void setCutoff(double value) ;
481
482  /// Get the cutoff bound on the objective function - always as minimize
483  inline double getCutoff() const
484  { //double value ;
485    //solver_->getDblParam(OsiDualObjectiveLimit,value) ;
486    //assert( dblParam_[CbcCurrentCutoff]== value * solver_->getObjSense());
487    return dblParam_[CbcCurrentCutoff];
488  }
489
490  /// Set the \link CbcModel::CbcMaxNumNode maximum node limit \endlink
491  inline bool setMaximumNodes( int value)
492  { return setIntParam(CbcMaxNumNode,value); }
493
494  /// Get the \link CbcModel::CbcMaxNumNode maximum node limit \endlink
495  inline int getMaximumNodes() const
496  { return getIntParam(CbcMaxNumNode); }
497
498  /** Set the
499      \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink
500      desired.
501  */
502  inline bool setMaximumSolutions( int value) {
503    return setIntParam(CbcMaxNumSol,value);
504  }
505  /** Get the
506      \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink
507      desired.
508  */
509  inline int getMaximumSolutions() const {
510    return getIntParam(CbcMaxNumSol);
511  }
512  /// Set the printing mode
513  inline bool setPrintingMode( int value)
514  { return setIntParam(CbcPrinting,value); }
515
516  /// Get the printing mode
517  inline int getPrintingMode() const
518  { return getIntParam(CbcPrinting); }
519
520  /** Set the
521      \link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink
522      desired.
523  */
524  inline bool setMaximumSeconds( double value) {
525    return setDblParam(CbcMaximumSeconds,value);
526  }
527  /** Get the
528      \link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink
529      desired.
530  */
531  inline double getMaximumSeconds() const {
532    return getDblParam(CbcMaximumSeconds);
533  }
534  /// Current time since start of branchAndbound
535  double getCurrentSeconds() const ;
536
537  /** Set the
538    \link CbcModel::CbcIntegerTolerance integrality tolerance \endlink
539  */
540  inline bool setIntegerTolerance( double value) {
541    return setDblParam(CbcIntegerTolerance,value);
542  }
543  /** Get the
544    \link CbcModel::CbcIntegerTolerance integrality tolerance \endlink
545  */
546  inline double getIntegerTolerance() const {
547    return getDblParam(CbcIntegerTolerance);
548  }
549
550  /** Set the
551      \link CbcModel::CbcInfeasibilityWeight
552            weight per integer infeasibility \endlink
553  */
554  inline bool setInfeasibilityWeight( double value) {
555    return setDblParam(CbcInfeasibilityWeight,value);
556  }
557  /** Get the
558      \link CbcModel::CbcInfeasibilityWeight
559            weight per integer infeasibility \endlink
560  */
561  inline double getInfeasibilityWeight() const {
562    return getDblParam(CbcInfeasibilityWeight);
563  }
564
565  /** Set the \link CbcModel::CbcAllowableGap allowable gap \endlink
566      between the best known solution and the best possible solution.
567  */
568  inline bool setAllowableGap( double value) {
569    return setDblParam(CbcAllowableGap,value);
570  }
571  /** Get the \link CbcModel::CbcAllowableGap allowable gap \endlink
572      between the best known solution and the best possible solution.
573  */
574  inline double getAllowableGap() const {
575    return getDblParam(CbcAllowableGap);
576  }
577
578  /** Set the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink
579      between the best known solution and the best possible solution.
580  */
581  inline bool setAllowableFractionGap( double value) {
582    return setDblParam(CbcAllowableFractionGap,value);
583  }
584  /** Get the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink
585      between the best known solution and the best possible solution.
586  */
587  inline double getAllowableFractionGap() const {
588    return getDblParam(CbcAllowableFractionGap);
589  }
590  /** Set the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink
591      between the best known solution and the best possible solution.
592  */
593  inline bool setAllowablePercentageGap( double value) {
594    return setDblParam(CbcAllowableFractionGap,value*0.01);
595  }
596  /** Get the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink
597      between the best known solution and the best possible solution.
598  */
599  inline double getAllowablePercentageGap() const {
600    return 100.0*getDblParam(CbcAllowableFractionGap);
601  }
602  /** Set the
603      \link CbcModel::CbcCutoffIncrement  \endlink
604      desired.
605  */
606  inline bool setCutoffIncrement( double value) {
607    return setDblParam(CbcCutoffIncrement,value);
608  }
609  /** Get the
610      \link CbcModel::CbcCutoffIncrement  \endlink
611      desired.
612  */
613  inline double getCutoffIncrement() const {
614    return getDblParam(CbcCutoffIncrement);
615  }
616
617  /** Pass in target solution and optional priorities.
618      If priorities then >0 means only branch if incorrect
619      while <0 means branch even if correct. +1 or -1 are
620      highest priority */
621  void setHotstartSolution(const double * solution, const int * priorities=NULL) ;
622 
623  /// Set the minimum drop to continue cuts
624  inline void setMinimumDrop(double value)
625  {minimumDrop_=value;};
626  /// Get the minimum drop to continue cuts
627  inline double getMinimumDrop() const
628  { return minimumDrop_;};
629
630  /** Set the maximum number of cut passes at root node (default 20)
631      Minimum drop can also be used for fine tuning */
632  inline void setMaximumCutPassesAtRoot(int value)
633  {maximumCutPassesAtRoot_=value;};
634  /** Get the maximum number of cut passes at root node */
635  inline int getMaximumCutPassesAtRoot() const
636  { return maximumCutPassesAtRoot_;};
637
638  /** Set the maximum number of cut passes at other nodes (default 10)
639      Minimum drop can also be used for fine tuning */
640  inline void setMaximumCutPasses(int value)
641  {maximumCutPasses_=value;};
642  /** Get the maximum number of cut passes at other nodes (default 10) */
643  inline int getMaximumCutPasses() const
644  { return maximumCutPasses_;};
645  /** Get current cut pass number in this round of cuts.
646      (1 is first pass) */
647  inline int getCurrentPassNumber() const
648  { return currentPassNumber_;};
649
650  /** Set the maximum number of candidates to be evaluated for strong
651    branching.
652
653    A value of 0 disables strong branching.
654  */
655  void setNumberStrong(int number);
656  /** Get the maximum number of candidates to be evaluated for strong
657    branching.
658  */
659  inline int numberStrong() const
660  { return numberStrong_;};
661  /** Set global preferred way to branch
662      -1 down, +1 up, 0 no preference */
663  inline void setPreferredWay(int value)
664  {preferredWay_=value;};
665  /** Get the preferred way to branch (default 0) */
666  inline int getPreferredWay() const
667  { return preferredWay_;};
668  /** Set size of mini - tree.  If > 1 then does total enumeration of
669      tree given by this best variables to branch on
670  */
671  inline void setSizeMiniTree(int value)
672  { sizeMiniTree_=value;};
673  inline int sizeMiniTree() const
674  { return sizeMiniTree_;};
675
676  /** Set the number of branches before pseudo costs believed
677      in dynamic strong branching.
678
679    A value of 0 disables dynamic strong branching.
680  */
681  void setNumberBeforeTrust(int number);
682  /** get the number of branches before pseudo costs believed
683      in dynamic strong branching. */
684  inline int numberBeforeTrust() const
685  { return numberBeforeTrust_;};
686  /** Set the number of variables for which to compute penalties
687      in dynamic strong branching.
688
689    A value of 0 disables penalties.
690  */
691  void setNumberPenalties(int number);
692  /** get the number of variables for which to compute penalties
693      in dynamic strong branching. */
694  inline int numberPenalties() const
695  { return numberPenalties_;};
696  /// Number of analyze iterations to do
697  inline void setNumberAnalyzeIterations(int number)
698  { numberAnalyzeIterations_=number;};
699  inline int numberAnalyzeIterations() const
700  { return numberAnalyzeIterations_;};
701  /** Get scale factor to make penalties match strong.
702      Should/will be computed */
703  inline double penaltyScaleFactor() const
704  { return penaltyScaleFactor_;};
705  /** Set scale factor to make penalties match strong.
706      Should/will be computed */
707  void setPenaltyScaleFactor(double value);
708  /** Problem type as set by user or found by analysis.  This will be extended
709      0 - not known
710      1 - Set partitioning <=
711      2 - Set partitioning ==
712      3 - Set covering
713      4 - all +- 1 or all +1 and odd
714  */
715  void inline setProblemType(int number)
716  { problemType_=number;};
717  inline int problemType() const
718  { return problemType_;};
719
720  /// Set how often to scan global cuts
721  void setHowOftenGlobalScan(int number);
722  /// Get how often to scan global cuts
723  inline int howOftenGlobalScan() const
724  { return howOftenGlobalScan_;};
725  /// Original columns as created by integerPresolve
726  inline int * originalColumns() const
727  { return originalColumns_;};
728
729  /** Set the print frequency.
730 
731    Controls the number of nodes evaluated between status prints.
732    If <tt>number <=0</tt> the print frequency is set to 100 nodes for large
733    problems, 1000 for small problems.
734    Print frequency has very slight overhead if small.
735  */
736  inline void setPrintFrequency(int number)
737  { printFrequency_=number;};
738  /// Get the print frequency
739  inline int printFrequency() const
740  { return printFrequency_;};
741  //@}
742
743  //---------------------------------------------------------------------------
744  ///@name Methods returning info on how the solution process terminated
745  //@{
746    /// Are there a numerical difficulties?
747    bool isAbandoned() const;
748    /// Is optimality proven?
749    bool isProvenOptimal() const;
750    /// Is  infeasiblity proven (or none better than cutoff)?
751    bool isProvenInfeasible() const;
752    /// Was continuous solution unbounded
753    bool isContinuousUnbounded() const;
754    /// Was continuous solution unbounded
755    bool isProvenDualInfeasible() const;
756    /// Node limit reached?
757    bool isNodeLimitReached() const;
758    /// Time limit reached?
759    bool isSecondsLimitReached() const;
760    /// Solution limit reached?
761    bool isSolutionLimitReached() const;
762    /// Get how many iterations it took to solve the problem.
763    inline int getIterationCount() const
764    { return numberIterations_;};
765    /// Get how many Nodes it took to solve the problem.
766    inline int getNodeCount() const
767    { return numberNodes_;};
768    /** Final status of problem
769        Some of these can be found out by is...... functions
770        -1 before branchAndBound
771        0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
772        (or check value of best solution)
773        1 stopped - on maxnodes, maxsols, maxtime
774        2 difficulties so run was abandoned
775        (5 event user programmed event occurred)
776    */
777    inline int status() const
778    { return status_;};
779    inline void setProblemStatus(int value)
780    { status_=value;};
781    /** Secondary status of problem
782        -1 unset (status_ will also be -1)
783        0 search completed with solution
784        1 linear relaxation not feasible (or worse than cutoff)
785        2 stopped on gap
786        3 stopped on nodes
787        4 stopped on time
788        5 stopped on user event
789        6 stopped on solutions
790        7 linear relaxation unbounded
791    */
792    inline int secondaryStatus() const
793    { return secondaryStatus_;};
794    inline void setSecondaryStatus(int value)
795    { secondaryStatus_=value;};
796    /// Are there numerical difficulties (for initialSolve) ?
797    bool isInitialSolveAbandoned() const ;
798    /// Is optimality proven (for initialSolve) ?
799    bool isInitialSolveProvenOptimal() const ;
800    /// Is primal infeasiblity proven (for initialSolve) ?
801    bool isInitialSolveProvenPrimalInfeasible() const ;
802    /// Is dual infeasiblity proven (for initialSolve) ?
803    bool isInitialSolveProvenDualInfeasible() const ;
804
805  //@}
806
807  //---------------------------------------------------------------------------
808  /**@name Problem information methods
809     
810     These methods call the solver's query routines to return
811     information about the problem referred to by the current object.
812     Querying a problem that has no data associated with it result in
813     zeros for the number of rows and columns, and NULL pointers from
814     the methods that return vectors.
815     
816     Const pointers returned from any data-query method are valid as
817     long as the data is unchanged and the solver is not called.
818  */
819  //@{
820  /// Number of rows in continuous (root) problem.
821  inline int numberRowsAtContinuous() const
822  { return numberRowsAtContinuous_;};
823
824  /// Get number of columns
825  inline int getNumCols() const
826  { return solver_->getNumCols();};
827 
828  /// Get number of rows
829  inline int getNumRows() const
830  { return solver_->getNumRows();};
831 
832  /// Get number of nonzero elements
833  inline CoinBigIndex getNumElements() const
834  { return solver_->getNumElements();};
835
836  /// Number of integers in problem
837  inline int numberIntegers() const
838  { return numberIntegers_;};
839  // Integer variables
840  inline const int * integerVariable() const 
841  { return integerVariable_;};
842  /// Whether or not integer
843  inline const char integerType(int i) const
844  { return integerInfo_[i];};
845  /// Whether or not integer
846  inline const char * integerType() const
847  { return integerInfo_;};
848
849  /// Get pointer to array[getNumCols()] of column lower bounds
850  inline const double * getColLower() const
851  { return solver_->getColLower();};
852 
853  /// Get pointer to array[getNumCols()] of column upper bounds
854  inline const double * getColUpper() const
855  { return solver_->getColUpper();};
856 
857  /** Get pointer to array[getNumRows()] of row constraint senses.
858      <ul>
859      <li>'L': <= constraint
860      <li>'E': =  constraint
861      <li>'G': >= constraint
862      <li>'R': ranged constraint
863      <li>'N': free constraint
864      </ul>
865  */
866  inline const char * getRowSense() const
867  { return solver_->getRowSense();};
868 
869  /** Get pointer to array[getNumRows()] of rows right-hand sides
870      <ul>
871      <li> if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
872      <li> if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
873      <li> if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
874      <li> if rowsense()[i] == 'N' then rhs()[i] == 0.0
875      </ul>
876  */
877  inline const double * getRightHandSide() const
878  { return solver_->getRightHandSide();};
879 
880  /** Get pointer to array[getNumRows()] of row ranges.
881      <ul>
882      <li> if rowsense()[i] == 'R' then
883      rowrange()[i] == rowupper()[i] - rowlower()[i]
884      <li> if rowsense()[i] != 'R' then
885      rowrange()[i] is 0.0
886      </ul>
887  */
888  inline const double * getRowRange() const
889  { return solver_->getRowRange();};
890 
891  /// Get pointer to array[getNumRows()] of row lower bounds
892  inline const double * getRowLower() const
893  { return solver_->getRowLower();};
894 
895  /// Get pointer to array[getNumRows()] of row upper bounds
896  inline const double * getRowUpper() const
897  { return solver_->getRowUpper();};
898 
899  /// Get pointer to array[getNumCols()] of objective function coefficients
900  inline const double * getObjCoefficients() const
901  { return solver_->getObjCoefficients();};
902 
903  /// Get objective function sense (1 for min (default), -1 for max)
904  inline double getObjSense() const
905  {
906    //assert (dblParam_[CbcOptimizationDirection]== solver_->getObjSense());
907    return dblParam_[CbcOptimizationDirection];};
908 
909  /// Return true if variable is continuous
910  inline bool isContinuous(int colIndex) const
911  { return solver_->isContinuous(colIndex);};
912 
913  /// Return true if variable is binary
914  inline bool isBinary(int colIndex) const
915  { return solver_->isBinary(colIndex);};
916 
917  /** Return true if column is integer.
918      Note: This function returns true if the the column
919      is binary or a general integer.
920  */
921  inline bool isInteger(int colIndex) const
922  { return solver_->isInteger(colIndex);};
923 
924  /// Return true if variable is general integer
925  inline bool isIntegerNonBinary(int colIndex) const
926  { return solver_->isIntegerNonBinary(colIndex);};
927 
928  /// Return true if variable is binary and not fixed at either bound
929  inline bool isFreeBinary(int colIndex) const
930  { return solver_->isFreeBinary(colIndex) ;};
931 
932  /// Get pointer to row-wise copy of matrix
933  inline const CoinPackedMatrix * getMatrixByRow() const
934  { return solver_->getMatrixByRow();};
935 
936  /// Get pointer to column-wise copy of matrix
937  inline const CoinPackedMatrix * getMatrixByCol() const
938  { return solver_->getMatrixByCol();};
939 
940  /// Get solver's value for infinity
941  inline double getInfinity() const
942  { return solver_->getInfinity();};
943  /// Get pointer to array[getNumCols()] (for speed) of column lower bounds
944  inline const double * getCbcColLower() const
945  { return cbcColLower_;};
946  /// Get pointer to array[getNumCols()] (for speed) of column upper bounds
947  inline const double * getCbcColUpper() const
948  { return cbcColUpper_;};
949  /// Get pointer to array[getNumRows()] (for speed) of row lower bounds
950  inline const double * getCbcRowLower() const
951  { return cbcRowLower_;};
952  /// Get pointer to array[getNumRows()] (for speed) of row upper bounds
953  inline const double * getCbcRowUpper() const
954  { return cbcRowUpper_;};
955  /// Get pointer to array[getNumCols()] (for speed) of primal solution vector
956  inline const double * getCbcColSolution() const
957  { return cbcColSolution_;};
958  /// Get pointer to array[getNumRows()] (for speed) of dual prices
959  inline const double * getCbcRowPrice() const
960  { return cbcRowPrice_;};
961  /// Get a pointer to array[getNumCols()] (for speed) of reduced costs
962  inline const double * getCbcReducedCost() const
963  { return cbcReducedCost_;};
964  /// Get pointer to array[getNumRows()] (for speed) of row activity levels.
965  inline const double * getCbcRowActivity() const
966  { return cbcRowActivity_;};
967  //@}
968 
969 
970  /**@name Methods related to querying the solution */
971  //@{
972  /// Holds solution at continuous (after cuts if branchAndBound called)
973  inline double * continuousSolution() const
974  { return continuousSolution_;};
975  /** Array marked whenever a solution is found if non-zero.
976      Code marks if heuristic returns better so heuristic
977      need only mark if it wants to on solutions which
978      are worse than current */
979  inline int * usedInSolution() const
980  { return usedInSolution_;};
981  /// Increases usedInSolution for nonzeros
982  void incrementUsed(const double * solution);
983  /// Record a new incumbent solution and update objectiveValue
984  void setBestSolution(CBC_Message how,
985                       double & objectiveValue, const double *solution,
986                       bool fixVariables=false);
987  /// Just update objectiveValue
988  void setBestObjectiveValue( double objectiveValue);
989
990  /** Call this to really test if a valid solution can be feasible
991      Solution is number columns in size.
992      If fixVariables true then bounds of continuous solver updated.
993      Returns objective value (worse than cutoff if not feasible)
994      Previously computed objective value is now passed in (in case user does not do solve)
995 */
996  double checkSolution(double cutoff, const double * solution,
997                       bool fixVariables, double originalObjValue);
998  /** Test the current solution for feasiblility.
999
1000    Scan all objects for indications of infeasibility. This is broken down
1001    into simple integer infeasibility (\p numberIntegerInfeasibilities)
1002    and all other reports of infeasibility (\p numberObjectInfeasibilities).
1003  */
1004  bool feasibleSolution(int & numberIntegerInfeasibilities,
1005                        int & numberObjectInfeasibilities) const;
1006
1007  /** Solution to the most recent lp relaxation.
1008
1009    The solver's solution to the most recent lp relaxation.
1010  */
1011   
1012  inline double * currentSolution() const
1013  { return currentSolution_;};
1014  /** For testing infeasibilities - will point to
1015      currentSolution_ or solver-->getColSolution()
1016  */
1017  inline const double * testSolution() const
1018  { return testSolution_;};
1019  inline void setTestSolution(const double * solution)
1020  { testSolution_ = solution;};
1021  /// Make sure region there and optionally copy solution
1022  void reserveCurrentSolution(const double * solution=NULL);
1023
1024  /// Get pointer to array[getNumCols()] of primal solution vector
1025  inline const double * getColSolution() const
1026  { return solver_->getColSolution();};
1027 
1028  /// Get pointer to array[getNumRows()] of dual prices
1029  inline const double * getRowPrice() const
1030  { return solver_->getRowPrice();};
1031 
1032  /// Get a pointer to array[getNumCols()] of reduced costs
1033  inline const double * getReducedCost() const
1034  { return solver_->getReducedCost();};
1035 
1036  /// Get pointer to array[getNumRows()] of row activity levels.
1037  inline const double * getRowActivity() const
1038  { return solver_->getRowActivity();};
1039 
1040  /// Get current objective function value
1041  inline double getCurrentObjValue() const
1042  { return dblParam_[CbcCurrentObjectiveValue]; }
1043  /// Get current minimization objective function value
1044  inline double getCurrentMinimizationObjValue() const
1045  { return dblParam_[CbcCurrentMinimizationObjectiveValue];}
1046 
1047  /// Get best objective function value as minimization
1048  inline double getMinimizationObjValue() const
1049  { return bestObjective_;};
1050  /// Set best objective function value as minimization
1051  inline void setMinimizationObjValue(double value) 
1052  { bestObjective_=value;};
1053 
1054  /// Get best objective function value
1055  inline double getObjValue() const
1056  { return bestObjective_ * solver_->getObjSense() ; } ;
1057  /** Get best possible objective function value.
1058      This is better of best possible left on tree
1059      and best solution found.
1060      If called from within branch and cut may be optimistic.
1061  */
1062  double getBestPossibleObjValue() const;
1063  /// Set best objective function value
1064  inline void setObjValue(double value) 
1065  { bestObjective_=value * solver_->getObjSense() ;};
1066 
1067  /** The best solution to the integer programming problem.
1068
1069    The best solution to the integer programming problem found during
1070    the search. If no solution is found, the method returns null.
1071  */
1072
1073  inline double * bestSolution() const
1074  { return bestSolution_;};
1075  void setBestSolution(const double * solution,int numberColumns,double objectiveValue);
1076 
1077  /// Get number of solutions
1078  inline int getSolutionCount() const
1079  { return numberSolutions_;};
1080 
1081  /// Set number of solutions (so heuristics will be different)
1082  inline void setSolutionCount(int value) 
1083  { numberSolutions_=value;};
1084  /** Current phase (so heuristics etc etc can find out).
1085      0 - initial solve
1086      1 - solve with cuts at root
1087      2 - solve with cuts
1088      3 - other e.g. strong branching
1089      4 - trying to validate a solution
1090      5 - at end of search
1091  */
1092  inline int phase() const
1093  { return phase_;};
1094 
1095  /// Get number of heuristic solutions
1096  inline int getNumberHeuristicSolutions() const { return numberHeuristicSolutions_;};
1097
1098  /// Set objective function sense (1 for min (default), -1 for max,)
1099  inline void setObjSense(double s) { dblParam_[CbcOptimizationDirection]=s;
1100  solver_->setObjSense(s);};
1101
1102  /// Value of objective at continuous
1103  inline double getContinuousObjective() const
1104  { return originalContinuousObjective_;};
1105  inline void setContinuousObjective(double value)
1106  { originalContinuousObjective_=value;};
1107  /// Number of infeasibilities at continuous
1108  inline int getContinuousInfeasibilities() const
1109  { return continuousInfeasibilities_;};
1110  inline void setContinuousInfeasibilities(int value)
1111  { continuousInfeasibilities_=value;};
1112  /// Value of objective after root node cuts added
1113  inline double rootObjectiveAfterCuts() const
1114  { return continuousObjective_;};
1115  /// Sum of Changes to objective by first solve
1116  inline double sumChangeObjective() const
1117  { return sumChangeObjective1_;};
1118  /** Number of times global cuts violated.  When global cut pool then this
1119      should be kept for each cut and type of cut */
1120  inline int numberGlobalViolations() const
1121  { return numberGlobalViolations_;};
1122  inline void clearNumberGlobalViolations()
1123  { numberGlobalViolations_=0;};
1124  /// Whether to force a resolve after takeOffCuts
1125  inline bool resolveAfterTakeOffCuts() const
1126  { return resolveAfterTakeOffCuts_;};
1127  inline void setResolveAfterTakeOffCuts(bool yesNo)
1128  { resolveAfterTakeOffCuts_=yesNo;};
1129  /// Get number of threads
1130  inline int getNumberThreads() const
1131  { return numberThreads_;};
1132  /// Set number of threads
1133  inline void setNumberThreads(int value) 
1134  { numberThreads_=value;};
1135  /// Get thread mode
1136  inline int getThreadMode() const
1137  { return threadMode_;};
1138  /** Set thread mode
1139      always use numberThreads for branching
1140      1 set then use numberThreads in root mini branch and bound
1141      2 set then use numberThreads for root cuts
1142      default is 0
1143  */
1144  inline void setThreadMode(int value) 
1145  { threadMode_=value;};
1146  //@}
1147
1148  /** \name Node selection */
1149  //@{
1150  // Comparison functions (which may be overridden by inheritance)
1151  inline CbcCompareBase * nodeComparison() const
1152  { return nodeCompare_;};
1153  void setNodeComparison(CbcCompareBase * compare);
1154  void setNodeComparison(CbcCompareBase & compare);
1155  //@}
1156
1157  /** \name Problem feasibility checking */
1158  //@{
1159  // Feasibility functions (which may be overridden by inheritance)
1160  inline CbcFeasibilityBase * problemFeasibility() const
1161  { return problemFeasibility_;};
1162  void setProblemFeasibility(CbcFeasibilityBase * feasibility);
1163  void setProblemFeasibility(CbcFeasibilityBase & feasibility);
1164  //@}
1165
1166  /** \name Tree methods and subtree methods */
1167  //@{
1168  /// Tree method e.g. heap (which may be overridden by inheritance)
1169  inline CbcTree * tree() const
1170  { return tree_;};
1171  /// For modifying tree handling (original is cloned)
1172  void passInTreeHandler(CbcTree & tree);
1173  /** For passing in an CbcModel to do a sub Tree (with derived tree handlers).
1174      Passed in model must exist for duration of branch and bound
1175  */
1176  void passInSubTreeModel(CbcModel & model);
1177  /** For retrieving a copy of subtree model with given OsiSolver.
1178      If no subtree model will use self (up to user to reset cutoff etc).
1179      If solver NULL uses current
1180  */
1181  CbcModel * subTreeModel(OsiSolverInterface * solver=NULL) const;
1182  /// Returns number of times any subtree stopped on nodes, time etc
1183  inline int numberStoppedSubTrees() const
1184  { return numberStoppedSubTrees_;}
1185  /// Says a sub tree was stopped
1186  inline void incrementSubTreeStopped()
1187  { numberStoppedSubTrees_++;};
1188  /** Whether to automatically do presolve before branch and bound (subTrees).
1189      0 - no
1190      1 - ordinary presolve
1191      2 - integer presolve (dodgy)
1192  */
1193  inline int typePresolve() const
1194  { return presolve_;};
1195  inline void setTypePresolve(int value)
1196  { presolve_=value;};
1197 
1198  //@}
1199
1200  /** \name Branching Decisions
1201 
1202    See the CbcBranchDecision class for additional information.
1203  */
1204  //@{
1205
1206  /// Get the current branching decision method.
1207  inline CbcBranchDecision * branchingMethod() const
1208  { return branchingMethod_;};
1209  /// Set the branching decision method.
1210  inline void setBranchingMethod(CbcBranchDecision * method)
1211  { delete branchingMethod_; branchingMethod_ = method->clone();};
1212  /** Set the branching method
1213 
1214    \overload
1215  */
1216  inline void setBranchingMethod(CbcBranchDecision & method)
1217  { delete branchingMethod_; branchingMethod_ = method.clone();};
1218  /// Get the current cut modifier method
1219  inline CbcCutModifier * cutModifier() const
1220  { return cutModifier_;};
1221  /// Set the cut modifier method
1222  void setCutModifier(CbcCutModifier * modifier);
1223  /** Set the cut modifier method
1224 
1225    \overload
1226  */
1227  void setCutModifier(CbcCutModifier & modifier);
1228  //@}
1229
1230  /** \name Row (constraint) and Column (variable) cut generation */
1231  //@{
1232
1233  /** State of search
1234      0 - no solution
1235      1 - only heuristic solutions
1236      2 - branched to a solution
1237      3 - no solution but many nodes
1238  */
1239  inline int stateOfSearch() const
1240  { return stateOfSearch_;};
1241  inline void setStateOfSearch(int state)
1242  { stateOfSearch_=state;};
1243  /// Strategy worked out - mainly at root node for use by CbcNode
1244  inline int searchStrategy() const
1245  { return searchStrategy_;};
1246  /// Set strategy worked out - mainly at root node for use by CbcNode
1247  inline void setSearchStrategy(int value)
1248  { searchStrategy_ = value; };
1249
1250  /// Get the number of cut generators
1251  inline int numberCutGenerators() const
1252  { return numberCutGenerators_;};
1253  /// Get the list of cut generators
1254  inline CbcCutGenerator ** cutGenerators() const
1255  { return generator_;};
1256  ///Get the specified cut generator
1257  inline CbcCutGenerator * cutGenerator(int i) const
1258  { return generator_[i];};
1259  ///Get the specified cut generator before any changes
1260  inline CbcCutGenerator * virginCutGenerator(int i) const
1261  { return virginGenerator_[i];};
1262  /** Add one generator - up to user to delete generators.
1263      howoften affects how generator is used. 0 or 1 means always,
1264      >1 means every that number of nodes.  Negative values have same
1265      meaning as positive but they may be switched off (-> -100) by code if
1266      not many cuts generated at continuous.  -99 is just done at root.
1267      Name is just for printout.
1268      If depth >0 overrides how often generator is called (if howOften==-1 or >0).
1269  */
1270  void addCutGenerator(CglCutGenerator * generator,
1271                       int howOften=1, const char * name=NULL,
1272                       bool normal=true, bool atSolution=false, 
1273                       bool infeasible=false,int howOftenInSub=-100,
1274                       int whatDepth=-1, int whatDepthInSub=-1);
1275//@}
1276  /** \name Strategy and sub models
1277 
1278    See the CbcStrategy class for additional information.
1279  */
1280  //@{
1281
1282  /// Get the current strategy
1283  inline CbcStrategy * strategy() const
1284  { return strategy_;};
1285  /// Set the strategy. Clones
1286  void setStrategy(CbcStrategy & strategy);
1287  /// Get the current parent model
1288  inline CbcModel * parentModel() const
1289  { return parentModel_;};
1290  /// Set the parent model
1291  inline void setParentModel(CbcModel & parentModel)
1292  { parentModel_ = &parentModel;};
1293  //@}
1294
1295
1296  /** \name Heuristics and priorities */
1297  //@{
1298  /*! \brief Add one heuristic - up to user to delete
1299
1300    The name is just used for print messages.
1301  */
1302  void addHeuristic(CbcHeuristic * generator, const char *name = NULL);
1303  ///Get the specified heuristic
1304  inline CbcHeuristic * heuristic(int i) const
1305  { return heuristic_[i];};
1306  /// Get the number of heuristics
1307  inline int numberHeuristics() const
1308  { return numberHeuristics_;};
1309  /// Pointer to heuristic solver which found last solution (or NULL)
1310  inline CbcHeuristic * lastHeuristic() const
1311  { return lastHeuristic_;};
1312  /// set last heuristic which found a solution
1313  inline void setLastHeuristic(CbcHeuristic * last)
1314  { lastHeuristic_=last;};
1315
1316  /** Pass in branching priorities.
1317 
1318      If ifClique then priorities are on cliques otherwise priorities are
1319      on integer variables. 
1320      Other type (if exists set to default)
1321      1 is highest priority. (well actually -INT_MAX is but that's ugly)
1322      If hotstart > 0 then branches are created to force
1323      the variable to the value given by best solution.  This enables a
1324      sort of hot start.  The node choice should be greatest depth
1325      and hotstart should normally be switched off after a solution.
1326
1327      If ifNotSimpleIntegers true then appended to normal integers
1328
1329      This is now deprecated except for simple usage.  If user
1330      creates Cbcobjects then set priority in them
1331
1332      \internal Added for Kurt Spielberg.
1333  */
1334  void passInPriorities(const int * priorities, bool ifNotSimpleIntegers);
1335
1336  /// Returns priority level for an object (or 1000 if no priorities exist)
1337  inline int priority(int sequence) const
1338  { return object_[sequence]->priority();}; 
1339
1340  /*! \brief Set an event handler
1341 
1342    A clone of the handler passed as a parameter is stored in CbcModel.
1343  */
1344  void passInEventHandler(const CbcEventHandler *eventHandler) ;
1345
1346  /*! \brief Retrieve a pointer to the event handler */
1347  inline CbcEventHandler* getEventHandler() const
1348  { return (eventHandler_) ; } ;
1349
1350  //@}
1351   
1352  /**@name Setting/Accessing application data */
1353  //@{
1354    /** Set application data.
1355
1356        This is a pointer that the application can store into and
1357        retrieve from the solver interface.
1358        This field is available for the application to optionally
1359        define and use.
1360    */
1361    void setApplicationData (void * appData);
1362
1363    /// Get application data
1364    void * getApplicationData() const;
1365  /**
1366      For advanced applications you may wish to modify the behavior of Cbc
1367      e.g. if the solver is a NLP solver then you may not have an exact
1368      optimum solution at each step.  Information could be built into
1369      OsiSolverInterface but this is an alternative so that that interface
1370      does not have to be changed.  If something similar is useful to
1371      enough solvers then it could be migrated
1372      You can also pass in by using solver->setAuxiliaryInfo.
1373      You should do that if solver is odd - if solver is normal simplex
1374      then use this.
1375      NOTE - characteristics are not cloned
1376  */
1377  void passInSolverCharacteristics(OsiBabSolver * solverCharacteristics);
1378  /// Get solver characteristics
1379  inline const OsiBabSolver * solverCharacteristics() const
1380  { return solverCharacteristics_;};
1381  //@}
1382 
1383  //---------------------------------------------------------------------------
1384
1385  /**@name Message handling */
1386  //@{
1387  /// Pass in Message handler (not deleted at end)
1388  void passInMessageHandler(CoinMessageHandler * handler);
1389  /// Set language
1390  void newLanguage(CoinMessages::Language language);
1391  inline void setLanguage(CoinMessages::Language language)
1392  {newLanguage(language);};
1393  /// Return handler
1394  inline CoinMessageHandler * messageHandler() const
1395  {return handler_;};
1396  /// Return messages
1397  inline CoinMessages & messages() 
1398  {return messages_;};
1399  /// Return pointer to messages
1400  inline CoinMessages * messagesPointer() 
1401  {return &messages_;};
1402  /// Set log level
1403  void setLogLevel(int value);
1404  /// Get log level
1405  inline int logLevel() const
1406  { return handler_->logLevel();};
1407  //@}
1408  //---------------------------------------------------------------------------
1409  ///@name Specialized
1410  //@{
1411
1412  /**
1413      Set special options
1414      0 bit (1) - check if cuts valid (if on debugger list)
1415      1 bit (2) - use current basis to check integer solution (rather than all slack)
1416      2 bit (4) - don't check integer solution (by solving LP)
1417      3 bit (8) - fast analyze
1418      4 bit (16) - non-linear model - so no well defined CoinPackedMatrix
1419      5 bit (32) - keep names
1420      6 bit (64) - try for dominated columns
1421  */
1422  /// Set special options
1423  inline void setSpecialOptions(int value)
1424  { specialOptions_=value;};
1425  /// Get special options
1426  inline int specialOptions() const
1427  { return specialOptions_;};
1428  /// Says if normal solver i.e. has well defined CoinPackedMatrix
1429  inline bool normalSolver() const
1430  { return (specialOptions_&16)==0;};
1431  /// Now we may not own objects - just point to solver's objects
1432  inline bool ownObjects() const
1433  { return ownObjects_;};
1434  /// Pointer to a mutex
1435  inline void * mutex()
1436  { return mutex_;};
1437  //@}
1438  //---------------------------------------------------------------------------
1439
1440  ///@name Constructors and destructors etc
1441  //@{
1442    /// Default Constructor
1443    CbcModel(); 
1444   
1445    /// Constructor from solver
1446    CbcModel(const OsiSolverInterface &);
1447 
1448    /** Assign a solver to the model (model assumes ownership)
1449
1450      On return, \p solver will be NULL.
1451      If deleteSolver then current solver deleted (if model owned)
1452
1453      \note Parameter settings in the outgoing solver are not inherited by
1454            the incoming solver.
1455    */
1456    void assignSolver(OsiSolverInterface *&solver,bool deleteSolver=true);
1457
1458    /** \brief Set ownership of solver
1459
1460      A parameter of false tells CbcModel it does not own the solver and
1461      should not delete it. Once you claim ownership of the solver, you're
1462      responsible for eventually deleting it. Note that CbcModel clones
1463      solvers with abandon.  Unless you have a deep understanding of the
1464      workings of CbcModel, the only time you want to claim ownership is when
1465      you're about to delete the CbcModel object but want the solver to
1466      continue to exist (as, for example, when branchAndBound has finished
1467      and you want to hang on to the answer).
1468    */
1469    inline void setModelOwnsSolver (bool ourSolver)
1470    { ourSolver_ = ourSolver ; } ;
1471
1472    /*! \brief Get ownership of solver
1473   
1474      A return value of true means that CbcModel owns the solver and will
1475      take responsibility for deleting it when that becomes necessary.
1476    */
1477    inline bool modelOwnsSolver () { return (ourSolver_) ; } ;
1478 
1479    /** Copy constructor .
1480      If noTree is true then tree and cuts are not copied
1481    */ 
1482    CbcModel(const CbcModel & rhs, bool noTree=false);
1483 
1484    /// Assignment operator
1485    CbcModel & operator=(const CbcModel& rhs);
1486 
1487    /// Destructor
1488     ~CbcModel ();
1489
1490    /// Returns solver - has current state
1491    inline OsiSolverInterface * solver() const
1492    { return solver_;};
1493
1494    /// Returns solver with continuous state
1495    inline OsiSolverInterface * continuousSolver() const
1496    { return continuousSolver_;};
1497
1498  /// A copy of the solver, taken at constructor or by saveReferenceSolver
1499  inline OsiSolverInterface * referenceSolver() const
1500  { return referenceSolver_;};
1501
1502  /// Save a copy of the current solver so can be reset to
1503  void saveReferenceSolver();
1504
1505  /** Uses a copy of reference solver to be current solver.
1506      Because of possible mismatches all exotic integer information is loat
1507      (apart from normal information in OsiSolverInterface)
1508      so SOS etc and priorities will have to be redone
1509  */
1510  void resetToReferenceSolver();
1511
1512  /// Clears out as much as possible (except solver)
1513  void gutsOfDestructor();
1514  /** Clears out enough to reset CbcModel as if no branch and bound done
1515   */
1516  void gutsOfDestructor2();
1517  //@}
1518
1519  ///@semi-private i.e. users should not use
1520  //@{
1521    /// Get how many Nodes it took to solve the problem.
1522    int getNodeCount2() const
1523    { return numberNodes2_;};
1524  /// Set pointers for speed
1525  void setPointers(const OsiSolverInterface * solver);
1526  /** Perform reduced cost fixing
1527
1528    Fixes integer variables at their current value based on reduced cost
1529    penalties.  Returns number fixed
1530  */
1531  int reducedCostFix() ;
1532  /// Encapsulates solver resolve
1533  int resolve(OsiSolverInterface * solver);
1534
1535  /** Encapsulates choosing a variable -
1536      anyAction -2, infeasible (-1 round again), 0 done
1537  */
1538  int chooseBranch(CbcNode * newNode, int numberPassesLeft,
1539                   CbcNode * oldNode, OsiCuts & cuts,
1540                   bool & resolved, CoinWarmStartBasis *lastws,
1541                   const double * lowerBefore,const double * upperBefore,
1542                   OsiSolverBranch * & branches);
1543  int chooseBranch(CbcNode * newNode, int numberPassesLeft, bool & resolved);
1544
1545  /** Return an empty basis object of the specified size
1546
1547    A useful utility when constructing a basis for a subproblem from scratch.
1548    The object returned will be of the requested capacity and appropriate for
1549    the solver attached to the model.
1550  */
1551  CoinWarmStartBasis *getEmptyBasis(int ns = 0, int na = 0) const ;
1552
1553  /** Remove inactive cuts from the model
1554
1555    An OsiSolverInterface is expected to maintain a valid basis, but not a
1556    valid solution, when loose cuts are deleted. Restoring a valid solution
1557    requires calling the solver to reoptimise. If it's certain the solution
1558    will not be required, set allowResolve to false to suppress
1559    reoptimisation.
1560    If saveCuts then slack cuts will be saved
1561  */
1562  void takeOffCuts(OsiCuts &cuts, 
1563                     bool allowResolve,OsiCuts * saveCuts) ;
1564
1565  /** Determine and install the active cuts that need to be added for
1566    the current subproblem
1567
1568    The whole truth is a bit more complicated. The first action is a call to
1569    addCuts1(). addCuts() then sorts through the list, installs the tight
1570    cuts in the model, and does bookkeeping (adjusts reference counts).
1571    The basis returned from addCuts1() is adjusted accordingly.
1572   
1573    If it turns out that the node should really be fathomed by bound,
1574    addCuts() simply treats all the cuts as loose as it does the bookkeeping.
1575
1576    canFix true if extra information being passed
1577  */
1578  int addCuts(CbcNode * node, CoinWarmStartBasis *&lastws,bool canFix);
1579
1580  /** Traverse the tree from node to root and prep the model
1581
1582    addCuts1() begins the job of prepping the model to match the current
1583    subproblem. The model is stripped of all cuts, and the search tree is
1584    traversed from node to root to determine the changes required. Appropriate
1585    bounds changes are installed, a list of cuts is collected but not
1586    installed, and an appropriate basis (minus the cuts, but big enough to
1587    accommodate them) is constructed.
1588
1589    \todo addCuts1() is called in contexts where it's known in advance that
1590          all that's desired is to determine a list of cuts and do the
1591          bookkeeping (adjust the reference counts). The work of installing
1592          bounds and building a basis goes to waste.
1593  */
1594  void addCuts1(CbcNode * node, CoinWarmStartBasis *&lastws);
1595  /** Set objective value in a node.  This is separated out so that
1596     odd solvers can use.  It may look at extra information in
1597     solverCharacteriscs_ and will also use bound from parent node
1598  */
1599  void setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode) const;
1600
1601  /** If numberBeforeTrust >0 then we are going to use CbcBranchDynamic.
1602      Scan and convert CbcSimpleInteger objects
1603  */
1604  void convertToDynamic();
1605  /// Use cliques for pseudocost information - return nonzero if infeasible
1606  int cliquePseudoCosts(int doStatistics);
1607  /// Fill in useful estimates
1608  void pseudoShadow(double * down, double * up);
1609
1610  /// Get the hotstart solution
1611  inline const double * hotstartSolution() const
1612  { return hotstartSolution_;};
1613  /// Get the hotstart priorities
1614  inline const int * hotstartPriorities() const
1615  { return hotstartPriorities_;};
1616
1617  /// Return the list of cuts initially collected for this subproblem
1618  inline CbcCountRowCut ** addedCuts() const
1619  { return addedCuts_;};
1620  /// Number of entries in the list returned by #addedCuts()
1621  inline int currentNumberCuts() const
1622  { return currentNumberCuts_;};
1623  /// Global cuts
1624  inline OsiCuts * globalCuts() 
1625  { return &globalCuts_;};
1626  /// Copy and set a pointer to a row cut which will be added instead of normal branching.
1627  void setNextRowCut(const OsiRowCut & cut);
1628  /// Get a pointer to current node (be careful)
1629  inline CbcNode * currentNode() const
1630  { return currentNode_;};
1631  /// Get a pointer to probing info
1632  inline CglTreeProbingInfo * probingInfo() const
1633  { return probingInfo_;};
1634  /// Set the number of iterations done in strong branching.
1635  inline void setNumberStrongIterations(int number)
1636  { numberStrongIterations_ = number;};
1637  /// Get the number of iterations done in strong branching.
1638  inline int numberStrongIterations() const
1639  { return numberStrongIterations_;};
1640  /// Increment strong info
1641  void incrementStrongInfo(int numberTimes, int numberIterations,
1642                           int numberFixed, bool ifInfeasible);
1643  /// Create C++ lines to get to current state
1644  void generateCpp( FILE * fp,int options);
1645  /// Generate an OsiBranchingInformation object
1646  OsiBranchingInformation usefulInformation() const;
1647  //@}
1648
1649//---------------------------------------------------------------------------
1650
1651private:
1652  ///@name Private member data
1653  //@{
1654
1655  /// The solver associated with this model.
1656  OsiSolverInterface * solver_;
1657
1658  /** Ownership of the solver object
1659
1660    The convention is that CbcModel owns the null solver. Currently there
1661    is no public method to give CbcModel a solver without giving ownership,
1662    but the hook is here.
1663  */
1664  bool ourSolver_ ;
1665
1666  /// A copy of the solver, taken at the continuous (root) node.
1667  OsiSolverInterface * continuousSolver_;
1668
1669  /// A copy of the solver, taken at constructor or by saveReferenceSolver
1670  OsiSolverInterface * referenceSolver_;
1671
1672   /// Message handler
1673  CoinMessageHandler * handler_;
1674
1675  /** Flag to say if handler_ is the default handler.
1676 
1677    The default handler is deleted when the model is deleted. Other
1678    handlers (supplied by the client) will not be deleted.
1679  */
1680  bool defaultHandler_;
1681
1682  /// Cbc messages
1683  CoinMessages messages_;
1684
1685  /// Array for integer parameters
1686  int intParam_[CbcLastIntParam];
1687
1688  /// Array for double parameters
1689  double dblParam_[CbcLastDblParam];
1690
1691  /** Pointer to an empty warm start object
1692
1693    It turns out to be useful to have this available as a base from
1694    which to build custom warm start objects. This is typed as CoinWarmStart
1695    rather than CoinWarmStartBasis to allow for the possibility that a
1696    client might want to apply a solver that doesn't use a basis-based warm
1697    start. See getEmptyBasis for an example of how this field can be used.
1698  */
1699  mutable CoinWarmStart *emptyWarmStart_ ;
1700
1701  /// Best objective
1702  double bestObjective_;
1703  /// Best possible objective
1704  double bestPossibleObjective_;
1705  /// Sum of Changes to objective by first solve
1706  double sumChangeObjective1_;
1707  /// Sum of Changes to objective by subsequent solves
1708  double sumChangeObjective2_;
1709
1710  /// Array holding the incumbent (best) solution.
1711  double * bestSolution_;
1712
1713  /** Array holding the current solution.
1714
1715    This array is used more as a temporary.
1716  */
1717  double * currentSolution_;
1718  /** For testing infeasibilities - will point to
1719      currentSolution_ or solver-->getColSolution()
1720  */
1721  mutable const double * testSolution_;
1722  /// Global cuts
1723  OsiCuts globalCuts_;
1724
1725  /// Minimum degradation in objective value to continue cut generation
1726  double minimumDrop_;
1727  /// Number of solutions
1728  int numberSolutions_;
1729  /** State of search
1730      0 - no solution
1731      1 - only heuristic solutions
1732      2 - branched to a solution
1733      3 - no solution but many nodes
1734  */
1735  int stateOfSearch_;
1736  /// Hotstart solution
1737  double * hotstartSolution_;
1738  /// Hotstart priorities
1739  int * hotstartPriorities_;
1740  /// Number of heuristic solutions
1741  int numberHeuristicSolutions_;
1742  /// Cumulative number of nodes
1743  int numberNodes_;
1744  /** Cumulative number of nodes for statistics.
1745      Must fix to match up
1746  */
1747  int numberNodes2_;
1748  /// Cumulative number of iterations
1749  int numberIterations_;
1750  /// Status of problem - 0 finished, 1 stopped, 2 difficulties
1751  int status_;
1752  /** Secondary status of problem
1753      -1 unset (status_ will also be -1)
1754      0 search completed with solution
1755      1 linear relaxation not feasible (or worse than cutoff)
1756      2 stopped on gap
1757      3 stopped on nodes
1758      4 stopped on time
1759      5 stopped on user event
1760      6 stopped on solutions
1761   */
1762  int secondaryStatus_;
1763  /// Number of integers in problem
1764  int numberIntegers_;
1765  /// Number of rows at continuous
1766  int numberRowsAtContinuous_;
1767  /// Maximum number of cuts
1768  int maximumNumberCuts_;
1769  /** Current phase (so heuristics etc etc can find out).
1770      0 - initial solve
1771      1 - solve with cuts at root
1772      2 - solve with cuts
1773      3 - other e.g. strong branching
1774      4 - trying to validate a solution
1775      5 - at end of search
1776  */
1777  int phase_;
1778
1779  /// Number of entries in #addedCuts_
1780  int currentNumberCuts_;
1781
1782  /** Current limit on search tree depth
1783
1784    The allocated size of #walkback_. Increased as needed.
1785  */
1786  int maximumDepth_;
1787  /** Array used to assemble the path between a node and the search tree root
1788
1789    The array is resized when necessary. #maximumDepth_  is the current
1790    allocated size.
1791  */
1792  CbcNodeInfo ** walkback_;
1793
1794  /** The list of cuts initially collected for this subproblem
1795
1796    When the subproblem at this node is rebuilt, a set of cuts is collected
1797    for inclusion in the constraint system. If any of these cuts are
1798    subsequently removed because they have become loose, the corresponding
1799    entry is set to NULL.
1800  */
1801  CbcCountRowCut ** addedCuts_;
1802
1803  /** A pointer to a row cut which will be added instead of normal branching.
1804      After use it should be set to NULL.
1805  */
1806  OsiRowCut * nextRowCut_;
1807
1808  /// Current node so can be used elsewhere
1809  CbcNode * currentNode_;
1810
1811  /// Indices of integer variables
1812  int * integerVariable_;
1813  /// Whether of not integer
1814  char * integerInfo_;
1815  /// Holds solution at continuous (after cuts)
1816  double * continuousSolution_;
1817  /// Array marked whenever a solution is found if non-zero
1818  int * usedInSolution_;
1819  /**
1820      0 bit (1) - check if cuts valid (if on debugger list)
1821      1 bit (2) - use current basis to check integer solution (rather than all slack)
1822      2 bit (4) - don't check integer solution
1823      3 bit (8) - Strong is doing well - keep on
1824  */
1825  int specialOptions_;
1826  /// User node comparison function
1827  CbcCompareBase * nodeCompare_;
1828  /// User feasibility function (see CbcFeasibleBase.hpp)
1829  CbcFeasibilityBase * problemFeasibility_;
1830  /// Tree
1831  CbcTree * tree_;
1832  /// A pointer to model to be used for subtrees
1833  CbcModel * subTreeModel_;
1834  /// Number of times any subtree stopped on nodes, time etc
1835  int numberStoppedSubTrees_;
1836  /// Variable selection function
1837  CbcBranchDecision * branchingMethod_;
1838  /// Cut modifier function
1839  CbcCutModifier * cutModifier_;
1840  /// Strategy
1841  CbcStrategy * strategy_;
1842  /// Parent model
1843  CbcModel * parentModel_;
1844  /** Whether to automatically do presolve before branch and bound.
1845      0 - no
1846      1 - ordinary presolve
1847      2 - integer presolve (dodgy)
1848  */
1849  /// Pointer to array[getNumCols()] (for speed) of column lower bounds
1850  const double * cbcColLower_;
1851  /// Pointer to array[getNumCols()] (for speed) of column upper bounds
1852  const double * cbcColUpper_;
1853  /// Pointer to array[getNumRows()] (for speed) of row lower bounds
1854  const double * cbcRowLower_;
1855  /// Pointer to array[getNumRows()] (for speed) of row upper bounds
1856  const double * cbcRowUpper_;
1857  /// Pointer to array[getNumCols()] (for speed) of primal solution vector
1858  const double * cbcColSolution_;
1859  /// Pointer to array[getNumRows()] (for speed) of dual prices
1860  const double * cbcRowPrice_;
1861  /// Get a pointer to array[getNumCols()] (for speed) of reduced costs
1862  const double * cbcReducedCost_;
1863  /// Pointer to array[getNumRows()] (for speed) of row activity levels.
1864  const double * cbcRowActivity_;
1865  /// Pointer to user-defined data structure
1866  void * appData_;
1867  /// Pointer to a mutex
1868  void * mutex_;
1869  /// Presolve for CbcTreeLocal
1870  int presolve_;
1871  /** Maximum number of candidates to consider for strong branching.
1872    To disable strong branching, set this to 0.
1873  */
1874  int numberStrong_;
1875  /** \brief The number of branches before pseudo costs believed
1876             in dynamic strong branching.
1877     
1878    A value of 0 is  off.
1879  */
1880  int numberBeforeTrust_;
1881  /** \brief The number of variables for which to compute penalties
1882             in dynamic strong branching.
1883  */
1884  int numberPenalties_;
1885  /** Scale factor to make penalties match strong.
1886      Should/will be computed */
1887  double penaltyScaleFactor_;
1888  /// Number of analyze iterations to do
1889  int numberAnalyzeIterations_;
1890  /// Arrays with analysis results
1891  double * analyzeResults_;
1892  /// Number of nodes infeasible by normal branching (before cuts)
1893  int numberInfeasibleNodes_;
1894  /** Problem type as set by user or found by analysis.  This will be extended
1895      0 - not known
1896      1 - Set partitioning <=
1897      2 - Set partitioning ==
1898      3 - Set covering
1899  */
1900  int problemType_;
1901  /// Print frequency
1902  int printFrequency_;
1903  /// Number of cut generators
1904  int numberCutGenerators_;
1905  // Cut generators
1906  CbcCutGenerator ** generator_;
1907  // Cut generators before any changes
1908  CbcCutGenerator ** virginGenerator_;
1909  /// Number of heuristics
1910  int numberHeuristics_;
1911  /// Heuristic solvers
1912  CbcHeuristic ** heuristic_;
1913  /// Pointer to heuristic solver which found last solution (or NULL)
1914  CbcHeuristic * lastHeuristic_;
1915  /*! Pointer to the event handler */
1916# ifdef CBC_ONLY_CLP
1917  ClpEventHandler *eventHandler_ ;
1918# else
1919  CbcEventHandler *eventHandler_ ;
1920# endif
1921
1922  /// Total number of objects
1923  int numberObjects_;
1924
1925  /** \brief Integer and Clique and ... information
1926
1927    \note The code assumes that the first objects on the list will be
1928          SimpleInteger objects for each integer variable, followed by
1929          Clique objects. Portions of the code that understand Clique objects
1930          will fail if they do not immediately follow the SimpleIntegers.
1931          Large chunks of the code will fail if the first objects are not
1932          SimpleInteger. As of 2003.08, SimpleIntegers and Cliques are the only
1933          objects.
1934  */
1935  OsiObject ** object_;
1936  /// Now we may not own objects - just point to solver's objects
1937  bool ownObjects_;
1938 
1939  /// Original columns as created by integerPresolve
1940  int * originalColumns_;
1941  /// How often to scan global cuts
1942  int howOftenGlobalScan_;
1943  /** Number of times global cuts violated.  When global cut pool then this
1944      should be kept for each cut and type of cut */
1945  int numberGlobalViolations_;
1946  /** Value of objective at continuous
1947      (Well actually after initial round of cuts)
1948  */
1949  double continuousObjective_;
1950  /** Value of objective before root node cuts added
1951  */
1952  double originalContinuousObjective_;
1953  /// Number of infeasibilities at continuous
1954  int continuousInfeasibilities_;
1955  /// Maximum number of cut passes at root
1956  int maximumCutPassesAtRoot_;
1957  /// Maximum number of cut passes
1958  int maximumCutPasses_;
1959  /// Preferred way of branching
1960  int preferredWay_;
1961  /// Current cut pass number
1962  int currentPassNumber_;
1963  /// Maximum number of cuts (for whichGenerator_)
1964  int maximumWhich_;
1965  /// Which cut generator generated this cut
1966  int * whichGenerator_;
1967  /// Maximum number of statistics
1968  int maximumStatistics_;
1969  /// statistics
1970  CbcStatistics ** statistics_;
1971  /// Maximum depth reached
1972  int maximumDepthActual_;
1973  /// Number of reduced cost fixings
1974  double numberDJFixed_;
1975  /// Probing info
1976  CglTreeProbingInfo * probingInfo_;
1977  /// Number of fixed by analyze at root
1978  int numberFixedAtRoot_;
1979  /// Number fixed by analyze so far
1980  int numberFixedNow_;
1981  /// Whether stopping on gap
1982  bool stoppedOnGap_;
1983  /// Whether event happened
1984  bool eventHappened_;
1985  /// Number of long strong goes
1986  int numberLongStrong_;
1987  /// Number of old active cuts
1988  int numberOldActiveCuts_;
1989  /// Number of new cuts
1990  int numberNewCuts_;
1991  /// Size of mini - tree
1992  int sizeMiniTree_;
1993  /// Strategy worked out - mainly at root node
1994  int searchStrategy_;
1995  /// Number of iterations in strong branching
1996  int numberStrongIterations_;
1997  /** 0 - number times strong branching done, 1 - number fixed, 2 - number infeasible */
1998  int strongInfo_[3];
1999  /**
2000      For advanced applications you may wish to modify the behavior of Cbc
2001      e.g. if the solver is a NLP solver then you may not have an exact
2002      optimum solution at each step.  This gives characteristics - just for one BAB.
2003      For actually saving/restoring a solution you need the actual solver one.
2004  */
2005  OsiBabSolver * solverCharacteristics_;
2006  /// Whether to force a resolve after takeOffCuts
2007  bool resolveAfterTakeOffCuts_;
2008  /**
2009     Parallel
2010     0 - off
2011     1 - testing
2012     2-99 threads
2013     other special meanings
2014  */
2015  int numberThreads_;
2016  /** thread mode
2017      always use numberThreads for branching
2018      1 set then use numberThreads in root mini branch and bound
2019      2 set then use numberThreads for root cuts
2020      default is 0
2021  */
2022  int threadMode_;
2023 //@}
2024};
2025/// So we can use osiObject or CbcObject during transition
2026void getIntegerInformation(const OsiObject * object, double & originalLower,
2027                           double & originalUpper) ;
2028// So we can call from other programs
2029// Real main program
2030class OsiClpSolverInterface;
2031int CbcMain (int argc, const char *argv[],OsiClpSolverInterface & solver,CbcModel ** babSolver);
2032// four ways of calling
2033int callCbc(const char * input2, OsiClpSolverInterface& solver1); 
2034int callCbc(const char * input2);
2035int callCbc(const std::string input2, OsiClpSolverInterface& solver1); 
2036int callCbc(const std::string input2) ;
2037#endif
Note: See TracBrowser for help on using the repository browser.