source: trunk/Cbc/src/CbcModel.hpp @ 779

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

on way to CbcSolver? class

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