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

Last change on this file since 1852 was 1839, checked in by forrest, 7 years ago

multiple root solvers, stronger strong branching and cutoff as constraint

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 100.1 KB
Line 
1/* $Id: CbcModel.hpp 1839 2013-01-16 18:41:25Z forrest $ */
2// Copyright (C) 2002, International Business Machines
3// Corporation and others.  All Rights Reserved.
4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
6#ifndef CbcModel_H
7#define CbcModel_H
8#include <string>
9#include <vector>
10#include "CoinMessageHandler.hpp"
11#include "OsiSolverInterface.hpp"
12#include "OsiBranchingObject.hpp"
13#include "OsiCuts.hpp"
14#include "CoinWarmStartBasis.hpp"
15#include "CbcCompareBase.hpp"
16#include "CbcCountRowCut.hpp"
17#include "CbcMessage.hpp"
18#include "CbcEventHandler.hpp"
19#include "ClpDualRowPivot.hpp"
20
21
22class CbcCutGenerator;
23class CbcBaseModel;
24class OsiRowCut;
25class OsiBabSolver;
26class OsiRowCutDebugger;
27class CglCutGenerator;
28class CglStored;
29class CbcCutModifier;
30class CglTreeProbingInfo;
31class CbcHeuristic;
32class OsiObject;
33class CbcThread;
34class CbcTree;
35class CbcStrategy;
36class CbcFeasibilityBase;
37class CbcStatistics;
38class CbcFullNodeInfo;
39class CbcEventHandler ;
40class CglPreProcess;
41# ifdef COIN_HAS_CLP
42class OsiClpSolverInterface;
43class ClpNodeStuff;
44#endif
45// #define CBC_CHECK_BASIS 1
46
47//#############################################################################
48
49/** Simple Branch and bound class
50
51  The initialSolve() method solves the initial LP relaxation of the MIP
52  problem. The branchAndBound() method can then be called to finish using
53  a branch and cut algorithm.
54
55  <h3>Search Tree Traversal</h3>
56
57  Subproblems (aka nodes) requiring additional evaluation are stored using
58  the CbcNode and CbcNodeInfo objects. Ancestry linkage is maintained in the
59  CbcNodeInfo object. Evaluation of a subproblem within branchAndBound()
60  proceeds as follows:
61  <ul>
62    <li> The node representing the most promising parent subproblem is popped
63         from the heap which holds the set of subproblems requiring further
64         evaluation.
65    <li> Using branching instructions stored in the node, and information in
66         its ancestors, the model and solver are adjusted to create the
67         active subproblem.
68    <li> If the parent subproblem will require further evaluation
69         (<i>i.e.</i>, there are branches remaining) its node is pushed back
70         on the heap. Otherwise, the node is deleted.  This may trigger
71         recursive deletion of ancestors.
72    <li> The newly created subproblem is evaluated.
73    <li> If the subproblem requires further evaluation, a node is created.
74         All information needed to recreate the subproblem (branching
75         information, row and column cuts) is placed in the node and the node
76         is added to the set of subproblems awaiting further evaluation.
77  </ul>
78  Note that there is never a node representing the active subproblem; the model
79  and solver represent the active subproblem.
80
81  <h3>Row (Constraint) Cut Handling</h3>
82
83  For a typical subproblem, the sequence of events is as follows:
84  <ul>
85    <li> The subproblem is rebuilt for further evaluation: One result of a
86         call to addCuts() is a traversal of ancestors, leaving a list of all
87         cuts used in the ancestors in #addedCuts_. This list is then scanned
88         to construct a basis that includes only tight cuts. Entries for
89         loose cuts are set to NULL.
90    <li> The subproblem is evaluated: One result of a call to solveWithCuts()
91         is the return of a set of newly generated cuts for the subproblem.
92         #addedCuts_ is also kept up-to-date as old cuts become loose.
93    <li> The subproblem is stored for further processing: A call to
94         CbcNodeInfo::addCuts() adds the newly generated cuts to the
95         CbcNodeInfo object associated with this node.
96  </ul>
97  See CbcCountRowCut for details of the bookkeeping associated with cut
98  management.
99*/
100
101class CbcModel  {
102
103public:
104
105    enum CbcIntParam {
106        /** The maximum number of nodes before terminating */
107        CbcMaxNumNode = 0,
108        /** The maximum number of solutions before terminating */
109        CbcMaxNumSol,
110        /** Fathoming discipline
111
112          Controls objective function comparisons for purposes of fathoming by bound
113          or determining monotonic variables.
114
115          If 1, action is taken only when the current objective is strictly worse
116          than the target. Implementation is handled by adding a small tolerance to
117          the target.
118        */
119        CbcFathomDiscipline,
120        /** Adjusts printout
121            1 does different node message with number unsatisfied on last branch
122        */
123        CbcPrinting,
124        /** Number of branches (may be more than number of nodes as may
125            include strong branching) */
126        CbcNumberBranches,
127        /** Just a marker, so that a static sized array can store parameters. */
128        CbcLastIntParam
129    };
130
131    enum CbcDblParam {
132        /** The maximum amount the value of an integer variable can vary from
133            integer and still be considered feasible. */
134        CbcIntegerTolerance = 0,
135        /** The objective is assumed to worsen by this amount for each
136            integer infeasibility. */
137        CbcInfeasibilityWeight,
138        /** The amount by which to tighten the objective function cutoff when
139            a new solution is discovered. */
140        CbcCutoffIncrement,
141        /** Stop when the gap between the objective value of the best known solution
142          and the best bound on the objective of any solution is less than this.
143
144          This is an absolute value. Conversion from a percentage is left to the
145          client.
146        */
147        CbcAllowableGap,
148        /** Stop when the gap between the objective value of the best known solution
149          and the best bound on the objective of any solution is less than this
150          fraction of of the absolute value of best known solution.
151
152          Code stops if either this test or CbcAllowableGap test succeeds
153        */
154        CbcAllowableFractionGap,
155        /** \brief The maximum number of seconds before terminating.
156               A double should be adequate! */
157        CbcMaximumSeconds,
158        /// Cutoff - stored for speed
159        CbcCurrentCutoff,
160        /// Optimization direction - stored for speed
161        CbcOptimizationDirection,
162        /// Current objective value
163        CbcCurrentObjectiveValue,
164        /// Current minimization objective value
165        CbcCurrentMinimizationObjectiveValue,
166        /** \brief The time at start of model.
167               So that other pieces of code can access */
168        CbcStartSeconds,
169        /** Stop doing heuristics when the gap between the objective value of the
170            best known solution and the best bound on the objective of any solution
171            is less than this.
172
173          This is an absolute value. Conversion from a percentage is left to the
174          client.
175        */
176        CbcHeuristicGap,
177        /** Stop doing heuristics when the gap between the objective value of the
178            best known solution and the best bound on the objective of any solution
179            is less than this fraction of of the absolute value of best known
180            solution.
181
182          Code stops if either this test or CbcAllowableGap test succeeds
183        */
184        CbcHeuristicFractionGap,
185        /// Smallest non-zero change on a branch
186        CbcSmallestChange,
187        /// Sum of non-zero changes on a branch
188        CbcSumChange,
189        /// Largest non-zero change on a branch
190        CbcLargestChange,
191        /// Small non-zero change on a branch to be used as guess
192        CbcSmallChange,
193        /** Just a marker, so that a static sized array can store parameters. */
194        CbcLastDblParam
195    };
196
197    //---------------------------------------------------------------------------
198
199public:
200    ///@name Solve methods
201    //@{
202    /** \brief Solve the initial LP relaxation
203
204      Invoke the solver's %initialSolve() method.
205    */
206    void initialSolve();
207
208    /** \brief Invoke the branch \& cut algorithm
209
210      The method assumes that initialSolve() has been called to solve the
211      LP relaxation. It processes the root node, then proceeds to explore the
212      branch & cut search tree. The search ends when the tree is exhausted or
213      one of several execution limits is reached.
214      If doStatistics is 1 summary statistics are printed
215      if 2 then also the path to best solution (if found by branching)
216      if 3 then also one line per node
217    */
218    void branchAndBound(int doStatistics = 0);
219private:
220
221    /** \brief Evaluate a subproblem using cutting planes and heuristics
222
223      The method invokes a main loop which generates cuts, applies heuristics,
224      and reoptimises using the solver's native %resolve() method.
225      It returns true if the subproblem remains feasible at the end of the
226      evaluation.
227    */
228    bool solveWithCuts(OsiCuts & cuts, int numberTries, CbcNode * node);
229    /** Generate one round of cuts - serial mode
230      returns -
231      0 - normal
232      1 - must keep going
233      2 - set numberTries to zero
234      -1 - infeasible
235    */
236    int serialCuts(OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts);
237    /** Generate one round of cuts - parallel mode
238        returns -
239        0 - normal
240        1 - must keep going
241        2 - set numberTries to zero
242        -1 - infeasible
243    */
244    int parallelCuts(CbcBaseModel * master, OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts);
245    /** Input one node output N nodes to put on tree and optional solution update
246        This should be able to operate in parallel so is given a solver and is const(ish)
247        However we will need to keep an array of solver_ and bases and more
248        status is 0 for normal, 1 if solution
249        Calling code should always push nodes back on tree
250    */
251    CbcNode ** solveOneNode(int whichSolver, CbcNode * node,
252                            int & numberNodesOutput, int & status) ;
253    /// Update size of whichGenerator
254    void resizeWhichGenerator(int numberNow, int numberAfter);
255public:
256#ifdef CBC_KEEP_DEPRECATED
257    // See if anyone is using these any more!!
258    /** \brief create a clean model from partially fixed problem
259
260      The method creates a new model with given bounds and with no tree.
261    */
262    CbcModel *  cleanModel(const double * lower, const double * upper);
263    /** \brief Invoke the branch \& cut algorithm on partially fixed problem
264
265      The method presolves the given model and does branch and cut. The search
266      ends when the tree is exhausted or maximum nodes is reached.
267
268      If better solution found then it is saved.
269
270      Returns 0 if search completed and solution, 1 if not completed and solution,
271      2 if completed and no solution, 3 if not completed and no solution.
272
273      Normally okay to do cleanModel immediately followed by subBranchandBound
274      (== other form of subBranchAndBound)
275      but may need to get at model for advanced features.
276
277      Deletes model2
278    */
279    int subBranchAndBound(CbcModel * model2,
280                          CbcModel * presolvedModel,
281                          int maximumNodes);
282    /** \brief Invoke the branch \& cut algorithm on partially fixed problem
283
284      The method creates a new model with given bounds, presolves it
285      then proceeds to explore the branch & cut search tree. The search
286      ends when the tree is exhausted or maximum nodes is reached.
287
288      If better solution found then it is saved.
289
290      Returns 0 if search completed and solution, 1 if not completed and solution,
291      2 if completed and no solution, 3 if not completed and no solution.
292
293      This is just subModel immediately followed by other version of
294      subBranchandBound.
295
296    */
297    int subBranchAndBound(const double * lower, const double * upper,
298                          int maximumNodes);
299
300    /** \brief Process root node and return a strengthened model
301
302      The method assumes that initialSolve() has been called to solve the
303      LP relaxation. It processes the root node and then returns a pointer
304      to the strengthened model (or NULL if infeasible)
305    */
306    OsiSolverInterface *  strengthenedModel();
307    /** preProcess problem - replacing solver
308        If makeEquality true then <= cliques converted to ==.
309        Presolve will be done numberPasses times.
310
311        Returns NULL if infeasible
312
313        If makeEquality is 1 add slacks to get cliques,
314        if 2 add slacks to get sos (but only if looks plausible) and keep sos info
315    */
316    CglPreProcess * preProcess( int makeEquality = 0, int numberPasses = 5,
317                                int tuning = 5);
318    /** Does postprocessing - original solver back.
319        User has to delete process */
320    void postProcess(CglPreProcess * process);
321#endif
322    /// Adds an update information object
323    void addUpdateInformation(const CbcObjectUpdateData & data);
324    /** Do one node - broken out for clarity?
325        also for parallel (when baseModel!=this)
326        Returns 1 if solution found
327        node NULL on return if no branches left
328        newNode NULL if no new node created
329    */
330    int doOneNode(CbcModel * baseModel, CbcNode * & node, CbcNode * & newNode);
331
332public:
333    /** \brief Reoptimise an LP relaxation
334
335      Invoke the solver's %resolve() method.
336      whereFrom -
337      0 - initial continuous
338      1 - resolve on branch (before new cuts)
339      2 - after new cuts
340      3  - obsolete code or something modified problem in unexpected way
341      10 - after strong branching has fixed variables at root
342      11 - after strong branching has fixed variables in tree
343
344      returns 1 feasible, 0 infeasible, -1 feasible but skip cuts
345    */
346    int resolve(CbcNodeInfo * parent, int whereFrom,
347                double * saveSolution = NULL,
348                double * saveLower = NULL,
349                double * saveUpper = NULL);
350    /// Make given rows (L or G) into global cuts and remove from lp
351    void makeGlobalCuts(int numberRows, const int * which);
352    /// Make given cut into a global cut
353    void makeGlobalCut(const OsiRowCut * cut);
354    /// Make given cut into a global cut
355    void makeGlobalCut(const OsiRowCut & cut);
356    /// Make given column cut into a global cut
357    void makeGlobalCut(const OsiColCut * cut);
358    /// Make given column cut into a global cut
359    void makeGlobalCut(const OsiColCut & cut);
360    /// Make partial cut into a global cut and save
361    void makePartialCut(const OsiRowCut * cut);
362    /// Make partial cuts into global cuts
363    void makeGlobalCuts();
364    /// Which cut generator generated this cut
365    inline const int * whichGenerator() const
366    { return whichGenerator_;}
367    //@}
368
369    /** \name Presolve methods */
370    //@{
371
372    /** Identify cliques and construct corresponding objects.
373
374        Find cliques with size in the range
375        [\p atLeastThisMany, \p lessThanThis] and construct corresponding
376        CbcClique objects.
377        If \p makeEquality is true then a new model may be returned if
378        modifications had to be made, otherwise \c this is returned.
379        If the problem is infeasible #numberObjects_ is set to -1.
380        A client must use deleteObjects() before a second call to findCliques().
381        If priorities exist, clique priority is set to the default.
382    */
383    CbcModel * findCliques(bool makeEquality, int atLeastThisMany,
384                           int lessThanThis, int defaultValue = 1000);
385
386    /** Do integer presolve, creating a new (presolved) model.
387
388      Returns the new model, or NULL if feasibility is lost.
389      If weak is true then just does a normal presolve
390
391      \todo It remains to work out the cleanest way of getting a solution to
392            the original problem at the end. So this is very preliminary.
393     */
394    CbcModel * integerPresolve(bool weak = false);
395
396    /** Do integer presolve, modifying the current model.
397
398        Returns true if the model remains feasible after presolve.
399    */
400    bool integerPresolveThisModel(OsiSolverInterface * originalSolver, bool weak = false);
401
402
403    /// Put back information into the original model after integer presolve.
404    void originalModel(CbcModel * presolvedModel, bool weak);
405
406    /** \brief For variables involved in VUB constraints, see if we can tighten
407           bounds by solving lp's
408
409        Returns false if feasibility is lost.
410        If CglProbing is available, it will be tried as well to see if it can
411        tighten bounds.
412        This routine is just a front end for tightenVubs(int,const int*,double).
413
414        If <tt>type = -1</tt> all variables are processed (could be very slow).
415        If <tt>type = 0</tt> only variables involved in VUBs are processed.
416        If <tt>type = n > 0</tt>, only the n most expensive VUB variables
417        are processed, where it is assumed that x is at its maximum so delta
418        would have to go to 1 (if x not at bound).
419
420        If \p allowMultipleBinary is true, then a VUB constraint is a row with
421        one continuous variable and any number of binary variables.
422
423        If <tt>useCutoff < 1.0e30</tt>, the original objective is installed as a
424        constraint with \p useCutoff as a bound.
425    */
426    bool tightenVubs(int type, bool allowMultipleBinary = false,
427                     double useCutoff = 1.0e50);
428
429    /** \brief For variables involved in VUB constraints, see if we can tighten
430           bounds by solving lp's
431
432      This version is just handed a list of variables to be processed.
433    */
434    bool tightenVubs(int numberVubs, const int * which,
435                     double useCutoff = 1.0e50);
436    /**
437      Analyze problem to find a minimum change in the objective function.
438    */
439    void analyzeObjective();
440
441    /**
442      Add additional integers.
443    */
444    void AddIntegers();
445
446    /**
447      Save copy of the model.
448    */
449    void saveModel(OsiSolverInterface * saveSolver, double * checkCutoffForRestart, bool * feasible);
450    /**
451      Flip direction of optimization on all models
452    */
453    void flipModel();
454
455    //@}
456
457    /** \name Object manipulation routines
458
459      See OsiObject for an explanation of `object' in the context of CbcModel.
460    */
461    //@{
462
463    /// Get the number of objects
464    inline int numberObjects() const {
465        return numberObjects_;
466    }
467    /// Set the number of objects
468    inline void setNumberObjects(int number) {
469        numberObjects_ = number;
470    }
471
472    /// Get the array of objects
473    inline OsiObject ** objects() const {
474        return object_;
475    }
476
477    /// Get the specified object
478    const inline OsiObject * object(int which) const {
479        return object_[which];
480    }
481    /// Get the specified object
482    inline OsiObject * modifiableObject(int which) const {
483        return object_[which];
484    }
485
486    void setOptionalInteger(int index);
487
488    /// Delete all object information (and just back to integers if true)
489    void deleteObjects(bool findIntegers = true);
490
491    /** Add in object information.
492
493      Objects are cloned; the owner can delete the originals.
494    */
495    void addObjects(int numberObjects, OsiObject ** objects);
496
497    /** Add in object information.
498
499      Objects are cloned; the owner can delete the originals.
500    */
501    void addObjects(int numberObjects, CbcObject ** objects);
502
503    /// Ensure attached objects point to this model.
504    void synchronizeModel() ;
505
506    /** \brief Identify integer variables and create corresponding objects.
507
508      Record integer variables and create an CbcSimpleInteger object for each
509      one.
510      If \p startAgain is true, a new scan is forced, overwriting any existing
511      integer variable information.
512      If type > 0 then 1==PseudoCost, 2 new ones low priority
513    */
514
515    void findIntegers(bool startAgain, int type = 0);
516
517    //@}
518
519    //---------------------------------------------------------------------------
520
521    /**@name Parameter set/get methods
522
523       The set methods return true if the parameter was set to the given value,
524       false if the value of the parameter is out of range.
525
526       The get methods return the value of the parameter.
527
528    */
529    //@{
530    /// Set an integer parameter
531    inline bool setIntParam(CbcIntParam key, int value) {
532        intParam_[key] = value;
533        return true;
534    }
535    /// Set a double parameter
536    inline bool setDblParam(CbcDblParam key, double value) {
537        dblParam_[key] = value;
538        return true;
539    }
540    /// Get an integer parameter
541    inline int getIntParam(CbcIntParam key) const {
542        return intParam_[key];
543    }
544    /// Get a double parameter
545    inline double getDblParam(CbcDblParam key) const {
546        return dblParam_[key];
547    }
548    /*! \brief Set cutoff bound on the objective function.
549
550      When using strict comparison, the bound is adjusted by a tolerance to
551      avoid accidentally cutting off the optimal solution.
552    */
553    void setCutoff(double value) ;
554
555    /// Get the cutoff bound on the objective function - always as minimize
556    inline double getCutoff() const { //double value ;
557        //solver_->getDblParam(OsiDualObjectiveLimit,value) ;
558        //assert( dblParam_[CbcCurrentCutoff]== value * solver_->getObjSense());
559        return dblParam_[CbcCurrentCutoff];
560    }
561
562    /// Set the \link CbcModel::CbcMaxNumNode maximum node limit \endlink
563    inline bool setMaximumNodes( int value) {
564        return setIntParam(CbcMaxNumNode, value);
565    }
566
567    /// Get the \link CbcModel::CbcMaxNumNode maximum node limit \endlink
568    inline int getMaximumNodes() const {
569        return getIntParam(CbcMaxNumNode);
570    }
571
572    /** Set the
573        \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink
574        desired.
575    */
576    inline bool setMaximumSolutions( int value) {
577        return setIntParam(CbcMaxNumSol, value);
578    }
579    /** Get the
580        \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink
581        desired.
582    */
583    inline int getMaximumSolutions() const {
584        return getIntParam(CbcMaxNumSol);
585    }
586    /// Set the printing mode
587    inline bool setPrintingMode( int value) {
588        return setIntParam(CbcPrinting, value);
589    }
590
591    /// Get the printing mode
592    inline int getPrintingMode() const {
593        return getIntParam(CbcPrinting);
594    }
595
596    /** Set the
597        \link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink
598        desired.
599    */
600    inline bool setMaximumSeconds( double value) {
601        return setDblParam(CbcMaximumSeconds, value);
602    }
603    /** Get the
604        \link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink
605        desired.
606    */
607    inline double getMaximumSeconds() const {
608        return getDblParam(CbcMaximumSeconds);
609    }
610    /// Current time since start of branchAndbound
611    double getCurrentSeconds() const ;
612
613    /// Return true if maximum time reached
614    bool maximumSecondsReached() const ;
615
616    /** Set the
617      \link CbcModel::CbcIntegerTolerance integrality tolerance \endlink
618    */
619    inline bool setIntegerTolerance( double value) {
620        return setDblParam(CbcIntegerTolerance, value);
621    }
622    /** Get the
623      \link CbcModel::CbcIntegerTolerance integrality tolerance \endlink
624    */
625    inline double getIntegerTolerance() const {
626        return getDblParam(CbcIntegerTolerance);
627    }
628
629    /** Set the
630        \link CbcModel::CbcInfeasibilityWeight
631          weight per integer infeasibility \endlink
632    */
633    inline bool setInfeasibilityWeight( double value) {
634        return setDblParam(CbcInfeasibilityWeight, value);
635    }
636    /** Get the
637        \link CbcModel::CbcInfeasibilityWeight
638          weight per integer infeasibility \endlink
639    */
640    inline double getInfeasibilityWeight() const {
641        return getDblParam(CbcInfeasibilityWeight);
642    }
643
644    /** Set the \link CbcModel::CbcAllowableGap allowable gap \endlink
645        between the best known solution and the best possible solution.
646    */
647    inline bool setAllowableGap( double value) {
648        return setDblParam(CbcAllowableGap, value);
649    }
650    /** Get the \link CbcModel::CbcAllowableGap allowable gap \endlink
651        between the best known solution and the best possible solution.
652    */
653    inline double getAllowableGap() const {
654        return getDblParam(CbcAllowableGap);
655    }
656
657    /** Set the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink
658        between the best known solution and the best possible solution.
659    */
660    inline bool setAllowableFractionGap( double value) {
661        return setDblParam(CbcAllowableFractionGap, value);
662    }
663    /** Get the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink
664        between the best known solution and the best possible solution.
665    */
666    inline double getAllowableFractionGap() const {
667        return getDblParam(CbcAllowableFractionGap);
668    }
669    /** Set the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink
670        between the best known solution and the best possible solution.
671    */
672    inline bool setAllowablePercentageGap( double value) {
673        return setDblParam(CbcAllowableFractionGap, value*0.01);
674    }
675    /** Get the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink
676        between the best known solution and the best possible solution.
677    */
678    inline double getAllowablePercentageGap() const {
679        return 100.0*getDblParam(CbcAllowableFractionGap);
680    }
681    /** Set the \link CbcModel::CbcHeuristicGap heuristic gap \endlink
682        between the best known solution and the best possible solution.
683    */
684    inline bool setHeuristicGap( double value) {
685        return setDblParam(CbcHeuristicGap, value);
686    }
687    /** Get the \link CbcModel::CbcHeuristicGap heuristic gap \endlink
688        between the best known solution and the best possible solution.
689    */
690    inline double getHeuristicGap() const {
691        return getDblParam(CbcHeuristicGap);
692    }
693
694    /** Set the \link CbcModel::CbcHeuristicFractionGap fraction heuristic gap \endlink
695        between the best known solution and the best possible solution.
696    */
697    inline bool setHeuristicFractionGap( double value) {
698        return setDblParam(CbcHeuristicFractionGap, value);
699    }
700    /** Get the \link CbcModel::CbcHeuristicFractionGap fraction heuristic gap \endlink
701        between the best known solution and the best possible solution.
702    */
703    inline double getHeuristicFractionGap() const {
704        return getDblParam(CbcHeuristicFractionGap);
705    }
706    /** Set the
707        \link CbcModel::CbcCutoffIncrement  \endlink
708        desired.
709    */
710    inline bool setCutoffIncrement( double value) {
711        return setDblParam(CbcCutoffIncrement, value);
712    }
713    /** Get the
714        \link CbcModel::CbcCutoffIncrement  \endlink
715        desired.
716    */
717    inline double getCutoffIncrement() const {
718        return getDblParam(CbcCutoffIncrement);
719    }
720    /// See if can stop on gap
721    bool canStopOnGap() const;
722
723    /** Pass in target solution and optional priorities.
724        If priorities then >0 means only branch if incorrect
725        while <0 means branch even if correct. +1 or -1 are
726        highest priority */
727    void setHotstartSolution(const double * solution, const int * priorities = NULL) ;
728
729    /// Set the minimum drop to continue cuts
730    inline void setMinimumDrop(double value) {
731        minimumDrop_ = value;
732    }
733    /// Get the minimum drop to continue cuts
734    inline double getMinimumDrop() const {
735        return minimumDrop_;
736    }
737
738    /** Set the maximum number of cut passes at root node (default 20)
739        Minimum drop can also be used for fine tuning */
740    inline void setMaximumCutPassesAtRoot(int value) {
741        maximumCutPassesAtRoot_ = value;
742    }
743    /** Get the maximum number of cut passes at root node */
744    inline int getMaximumCutPassesAtRoot() const {
745        return maximumCutPassesAtRoot_;
746    }
747
748    /** Set the maximum number of cut passes at other nodes (default 10)
749        Minimum drop can also be used for fine tuning */
750    inline void setMaximumCutPasses(int value) {
751        maximumCutPasses_ = value;
752    }
753    /** Get the maximum number of cut passes at other nodes (default 10) */
754    inline int getMaximumCutPasses() const {
755        return maximumCutPasses_;
756    }
757    /** Get current cut pass number in this round of cuts.
758        (1 is first pass) */
759    inline int getCurrentPassNumber() const {
760        return currentPassNumber_;
761    }
762
763    /** Set the maximum number of candidates to be evaluated for strong
764      branching.
765
766      A value of 0 disables strong branching.
767    */
768    void setNumberStrong(int number);
769    /** Get the maximum number of candidates to be evaluated for strong
770      branching.
771    */
772    inline int numberStrong() const {
773        return numberStrong_;
774    }
775    /** Set global preferred way to branch
776        -1 down, +1 up, 0 no preference */
777    inline void setPreferredWay(int value) {
778        preferredWay_ = value;
779    }
780    /** Get the preferred way to branch (default 0) */
781    inline int getPreferredWay() const {
782        return preferredWay_;
783    }
784    /// Get at which depths to do cuts
785    inline int whenCuts() const {
786        return whenCuts_;
787    }
788    /// Set at which depths to do cuts
789    inline void setWhenCuts(int value) {
790        whenCuts_ = value;
791    }
792    /** Return true if we want to do cuts
793        If allowForTopOfTree zero then just does on multiples of depth
794        if 1 then allows for doing at top of tree
795        if 2 then says if cuts allowed anywhere apart from root
796    */
797    bool doCutsNow(int allowForTopOfTree) const;
798
799    /** Set the number of branches before pseudo costs believed
800        in dynamic strong branching.
801
802      A value of 0 disables dynamic strong branching.
803    */
804    void setNumberBeforeTrust(int number);
805    /** get the number of branches before pseudo costs believed
806        in dynamic strong branching. */
807    inline int numberBeforeTrust() const {
808        return numberBeforeTrust_;
809    }
810    /** Set the number of variables for which to compute penalties
811        in dynamic strong branching.
812
813      A value of 0 disables penalties.
814    */
815    void setNumberPenalties(int number);
816    /** get the number of variables for which to compute penalties
817        in dynamic strong branching. */
818    inline int numberPenalties() const {
819        return numberPenalties_;
820    }
821    /// Pointer to top of tree
822    inline const CbcFullNodeInfo * topOfTree() const
823    { return topOfTree_;}
824    /// Number of analyze iterations to do
825    inline void setNumberAnalyzeIterations(int number) {
826        numberAnalyzeIterations_ = number;
827    }
828    inline int numberAnalyzeIterations() const {
829        return numberAnalyzeIterations_;
830    }
831    /** Get scale factor to make penalties match strong.
832        Should/will be computed */
833    inline double penaltyScaleFactor() const {
834        return penaltyScaleFactor_;
835    }
836    /** Set scale factor to make penalties match strong.
837        Should/will be computed */
838    void setPenaltyScaleFactor(double value);
839    /** Problem type as set by user or found by analysis.  This will be extended
840        0 - not known
841        1 - Set partitioning <=
842        2 - Set partitioning ==
843        3 - Set covering
844        4 - all +- 1 or all +1 and odd
845    */
846    void inline setProblemType(int number) {
847        problemType_ = number;
848    }
849    inline int problemType() const {
850        return problemType_;
851    }
852    /// Current depth
853    inline int currentDepth() const {
854        return currentDepth_;
855    }
856
857    /// Set how often to scan global cuts
858    void setHowOftenGlobalScan(int number);
859    /// Get how often to scan global cuts
860    inline int howOftenGlobalScan() const {
861        return howOftenGlobalScan_;
862    }
863    /// Original columns as created by integerPresolve or preprocessing
864    inline int * originalColumns() const {
865        return originalColumns_;
866    }
867    /// Set original columns as created by preprocessing
868    void setOriginalColumns(const int * originalColumns) ;
869
870    /** Set the print frequency.
871
872      Controls the number of nodes evaluated between status prints.
873      If <tt>number <=0</tt> the print frequency is set to 100 nodes for large
874      problems, 1000 for small problems.
875      Print frequency has very slight overhead if small.
876    */
877    inline void setPrintFrequency(int number) {
878        printFrequency_ = number;
879    }
880    /// Get the print frequency
881    inline int printFrequency() const {
882        return printFrequency_;
883    }
884    //@}
885
886    //---------------------------------------------------------------------------
887    ///@name Methods returning info on how the solution process terminated
888    //@{
889    /// Are there a numerical difficulties?
890    bool isAbandoned() const;
891    /// Is optimality proven?
892    bool isProvenOptimal() const;
893    /// Is  infeasiblity proven (or none better than cutoff)?
894    bool isProvenInfeasible() const;
895    /// Was continuous solution unbounded
896    bool isContinuousUnbounded() const;
897    /// Was continuous solution unbounded
898    bool isProvenDualInfeasible() const;
899    /// Node limit reached?
900    bool isNodeLimitReached() const;
901    /// Time limit reached?
902    bool isSecondsLimitReached() const;
903    /// Solution limit reached?
904    bool isSolutionLimitReached() const;
905    /// Get how many iterations it took to solve the problem.
906    inline int getIterationCount() const {
907        return numberIterations_;
908    }
909    /// Increment how many iterations it took to solve the problem.
910    inline void incrementIterationCount(int value) {
911        numberIterations_ += value;
912    }
913    /// Get how many Nodes it took to solve the problem (including those in complete fathoming B&B inside CLP).
914    inline int getNodeCount() const {
915        return numberNodes_;
916    }
917    /// Increment how many nodes it took to solve the problem.
918    inline void incrementNodeCount(int value) {
919        numberNodes_ += value;
920    }
921    /// Get how many Nodes were enumerated in complete fathoming B&B inside CLP
922    inline int getExtraNodeCount() const {
923       return numberExtraNodes_;
924    }
925    /** Final status of problem
926        Some of these can be found out by is...... functions
927        -1 before branchAndBound
928        0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
929        (or check value of best solution)
930        1 stopped - on maxnodes, maxsols, maxtime
931        2 difficulties so run was abandoned
932        (5 event user programmed event occurred)
933    */
934    inline int status() const {
935        return status_;
936    }
937    inline void setProblemStatus(int value) {
938        status_ = value;
939    }
940    /** Secondary status of problem
941        -1 unset (status_ will also be -1)
942        0 search completed with solution
943        1 linear relaxation not feasible (or worse than cutoff)
944        2 stopped on gap
945        3 stopped on nodes
946        4 stopped on time
947        5 stopped on user event
948        6 stopped on solutions
949        7 linear relaxation unbounded
950        8 stopped on iteration limit
951    */
952    inline int secondaryStatus() const {
953        return secondaryStatus_;
954    }
955    inline void setSecondaryStatus(int value) {
956        secondaryStatus_ = value;
957    }
958    /// Are there numerical difficulties (for initialSolve) ?
959    bool isInitialSolveAbandoned() const ;
960    /// Is optimality proven (for initialSolve) ?
961    bool isInitialSolveProvenOptimal() const ;
962    /// Is primal infeasiblity proven (for initialSolve) ?
963    bool isInitialSolveProvenPrimalInfeasible() const ;
964    /// Is dual infeasiblity proven (for initialSolve) ?
965    bool isInitialSolveProvenDualInfeasible() const ;
966
967    //@}
968
969    //---------------------------------------------------------------------------
970    /**@name Problem information methods
971
972       These methods call the solver's query routines to return
973       information about the problem referred to by the current object.
974       Querying a problem that has no data associated with it result in
975       zeros for the number of rows and columns, and NULL pointers from
976       the methods that return vectors.
977
978       Const pointers returned from any data-query method are valid as
979       long as the data is unchanged and the solver is not called.
980    */
981    //@{
982    /// Number of rows in continuous (root) problem.
983    inline int numberRowsAtContinuous() const {
984        return numberRowsAtContinuous_;
985    }
986
987    /// Get number of columns
988    inline int getNumCols() const {
989        return solver_->getNumCols();
990    }
991
992    /// Get number of rows
993    inline int getNumRows() const {
994        return solver_->getNumRows();
995    }
996
997    /// Get number of nonzero elements
998    inline CoinBigIndex getNumElements() const {
999        return solver_->getNumElements();
1000    }
1001
1002    /// Number of integers in problem
1003    inline int numberIntegers() const {
1004        return numberIntegers_;
1005    }
1006    // Integer variables
1007    inline const int * integerVariable() const {
1008        return integerVariable_;
1009    }
1010    /// Whether or not integer
1011    inline char integerType(int i) const {
1012        assert (integerInfo_);
1013        assert (integerInfo_[i] == 0 || integerInfo_[i] == 1);
1014        return integerInfo_[i];
1015    }
1016    /// Whether or not integer
1017    inline const char * integerType() const {
1018        return integerInfo_;
1019    }
1020
1021    /// Get pointer to array[getNumCols()] of column lower bounds
1022    inline const double * getColLower() const {
1023        return solver_->getColLower();
1024    }
1025
1026    /// Get pointer to array[getNumCols()] of column upper bounds
1027    inline const double * getColUpper() const {
1028        return solver_->getColUpper();
1029    }
1030
1031    /** Get pointer to array[getNumRows()] of row constraint senses.
1032        <ul>
1033        <li>'L': <= constraint
1034        <li>'E': =  constraint
1035        <li>'G': >= constraint
1036        <li>'R': ranged constraint
1037        <li>'N': free constraint
1038        </ul>
1039    */
1040    inline const char * getRowSense() const {
1041        return solver_->getRowSense();
1042    }
1043
1044    /** Get pointer to array[getNumRows()] of rows right-hand sides
1045        <ul>
1046        <li> if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
1047        <li> if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
1048        <li> if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
1049        <li> if rowsense()[i] == 'N' then rhs()[i] == 0.0
1050        </ul>
1051    */
1052    inline const double * getRightHandSide() const {
1053        return solver_->getRightHandSide();
1054    }
1055
1056    /** Get pointer to array[getNumRows()] of row ranges.
1057        <ul>
1058        <li> if rowsense()[i] == 'R' then
1059        rowrange()[i] == rowupper()[i] - rowlower()[i]
1060        <li> if rowsense()[i] != 'R' then
1061        rowrange()[i] is 0.0
1062        </ul>
1063    */
1064    inline const double * getRowRange() const {
1065        return solver_->getRowRange();
1066    }
1067
1068    /// Get pointer to array[getNumRows()] of row lower bounds
1069    inline const double * getRowLower() const {
1070        return solver_->getRowLower();
1071    }
1072
1073    /// Get pointer to array[getNumRows()] of row upper bounds
1074    inline const double * getRowUpper() const {
1075        return solver_->getRowUpper();
1076    }
1077
1078    /// Get pointer to array[getNumCols()] of objective function coefficients
1079    inline const double * getObjCoefficients() const {
1080        return solver_->getObjCoefficients();
1081    }
1082
1083    /// Get objective function sense (1 for min (default), -1 for max)
1084    inline double getObjSense() const {
1085        //assert (dblParam_[CbcOptimizationDirection]== solver_->getObjSense());
1086        return dblParam_[CbcOptimizationDirection];
1087    }
1088
1089    /// Return true if variable is continuous
1090    inline bool isContinuous(int colIndex) const {
1091        return solver_->isContinuous(colIndex);
1092    }
1093
1094    /// Return true if variable is binary
1095    inline bool isBinary(int colIndex) const {
1096        return solver_->isBinary(colIndex);
1097    }
1098
1099    /** Return true if column is integer.
1100        Note: This function returns true if the the column
1101        is binary or a general integer.
1102    */
1103    inline bool isInteger(int colIndex) const {
1104        return solver_->isInteger(colIndex);
1105    }
1106
1107    /// Return true if variable is general integer
1108    inline bool isIntegerNonBinary(int colIndex) const {
1109        return solver_->isIntegerNonBinary(colIndex);
1110    }
1111
1112    /// Return true if variable is binary and not fixed at either bound
1113    inline bool isFreeBinary(int colIndex) const {
1114        return solver_->isFreeBinary(colIndex) ;
1115    }
1116
1117    /// Get pointer to row-wise copy of matrix
1118    inline const CoinPackedMatrix * getMatrixByRow() const {
1119        return solver_->getMatrixByRow();
1120    }
1121
1122    /// Get pointer to column-wise copy of matrix
1123    inline const CoinPackedMatrix * getMatrixByCol() const {
1124        return solver_->getMatrixByCol();
1125    }
1126
1127    /// Get solver's value for infinity
1128    inline double getInfinity() const {
1129        return solver_->getInfinity();
1130    }
1131    /// Get pointer to array[getNumCols()] (for speed) of column lower bounds
1132    inline const double * getCbcColLower() const {
1133        return cbcColLower_;
1134    }
1135    /// Get pointer to array[getNumCols()] (for speed) of column upper bounds
1136    inline const double * getCbcColUpper() const {
1137        return cbcColUpper_;
1138    }
1139    /// Get pointer to array[getNumRows()] (for speed) of row lower bounds
1140    inline const double * getCbcRowLower() const {
1141        return cbcRowLower_;
1142    }
1143    /// Get pointer to array[getNumRows()] (for speed) of row upper bounds
1144    inline const double * getCbcRowUpper() const {
1145        return cbcRowUpper_;
1146    }
1147    /// Get pointer to array[getNumCols()] (for speed) of primal solution vector
1148    inline const double * getCbcColSolution() const {
1149        return cbcColSolution_;
1150    }
1151    /// Get pointer to array[getNumRows()] (for speed) of dual prices
1152    inline const double * getCbcRowPrice() const {
1153        return cbcRowPrice_;
1154    }
1155    /// Get a pointer to array[getNumCols()] (for speed) of reduced costs
1156    inline const double * getCbcReducedCost() const {
1157        return cbcReducedCost_;
1158    }
1159    /// Get pointer to array[getNumRows()] (for speed) of row activity levels.
1160    inline const double * getCbcRowActivity() const {
1161        return cbcRowActivity_;
1162    }
1163    //@}
1164
1165
1166    /**@name Methods related to querying the solution */
1167    //@{
1168    /// Holds solution at continuous (after cuts if branchAndBound called)
1169    inline double * continuousSolution() const {
1170        return continuousSolution_;
1171    }
1172    /** Array marked whenever a solution is found if non-zero.
1173        Code marks if heuristic returns better so heuristic
1174        need only mark if it wants to on solutions which
1175        are worse than current */
1176    inline int * usedInSolution() const {
1177        return usedInSolution_;
1178    }
1179    /// Increases usedInSolution for nonzeros
1180    void incrementUsed(const double * solution);
1181    /// Record a new incumbent solution and update objectiveValue
1182    void setBestSolution(CBC_Message how,
1183                         double & objectiveValue, const double *solution,
1184                         int fixVariables = 0);
1185    /// Just update objectiveValue
1186    void setBestObjectiveValue( double objectiveValue);
1187    /// Deals with event handler and solution
1188    CbcEventHandler::CbcAction dealWithEventHandler(CbcEventHandler::CbcEvent event,
1189            double objValue,
1190            const double * solution);
1191
1192    /** Call this to really test if a valid solution can be feasible
1193        Solution is number columns in size.
1194        If fixVariables true then bounds of continuous solver updated.
1195        Returns objective value (worse than cutoff if not feasible)
1196        Previously computed objective value is now passed in (in case user does not do solve)
1197        virtual so user can override
1198    */
1199    virtual double checkSolution(double cutoff, double * solution,
1200                         int fixVariables, double originalObjValue);
1201    /** Test the current solution for feasiblility.
1202
1203      Scan all objects for indications of infeasibility. This is broken down
1204      into simple integer infeasibility (\p numberIntegerInfeasibilities)
1205      and all other reports of infeasibility (\p numberObjectInfeasibilities).
1206    */
1207    bool feasibleSolution(int & numberIntegerInfeasibilities,
1208                          int & numberObjectInfeasibilities) const;
1209
1210    /** Solution to the most recent lp relaxation.
1211
1212      The solver's solution to the most recent lp relaxation.
1213    */
1214
1215    inline double * currentSolution() const {
1216        return currentSolution_;
1217    }
1218    /** For testing infeasibilities - will point to
1219        currentSolution_ or solver-->getColSolution()
1220    */
1221    inline const double * testSolution() const {
1222        return testSolution_;
1223    }
1224    inline void setTestSolution(const double * solution) {
1225        testSolution_ = solution;
1226    }
1227    /// Make sure region there and optionally copy solution
1228    void reserveCurrentSolution(const double * solution = NULL);
1229
1230    /// Get pointer to array[getNumCols()] of primal solution vector
1231    inline const double * getColSolution() const {
1232        return solver_->getColSolution();
1233    }
1234
1235    /// Get pointer to array[getNumRows()] of dual prices
1236    inline const double * getRowPrice() const {
1237        return solver_->getRowPrice();
1238    }
1239
1240    /// Get a pointer to array[getNumCols()] of reduced costs
1241    inline const double * getReducedCost() const {
1242        return solver_->getReducedCost();
1243    }
1244
1245    /// Get pointer to array[getNumRows()] of row activity levels.
1246    inline const double * getRowActivity() const {
1247        return solver_->getRowActivity();
1248    }
1249
1250    /// Get current objective function value
1251    inline double getCurrentObjValue() const {
1252        return dblParam_[CbcCurrentObjectiveValue];
1253    }
1254    /// Get current minimization objective function value
1255    inline double getCurrentMinimizationObjValue() const {
1256        return dblParam_[CbcCurrentMinimizationObjectiveValue];
1257    }
1258
1259    /// Get best objective function value as minimization
1260    inline double getMinimizationObjValue() const {
1261        return bestObjective_;
1262    }
1263    /// Set best objective function value as minimization
1264    inline void setMinimizationObjValue(double value) {
1265        bestObjective_ = value;
1266    }
1267
1268    /// Get best objective function value
1269    inline double getObjValue() const {
1270        return bestObjective_ * solver_->getObjSense() ;
1271    }
1272    /** Get best possible objective function value.
1273        This is better of best possible left on tree
1274        and best solution found.
1275        If called from within branch and cut may be optimistic.
1276    */
1277    double getBestPossibleObjValue() const;
1278    /// Set best objective function value
1279    inline void setObjValue(double value) {
1280        bestObjective_ = value * solver_->getObjSense() ;
1281    }
1282    /// Get solver objective function value (as minimization)
1283    inline double getSolverObjValue() const {
1284        return solver_->getObjValue() * solver_->getObjSense() ;
1285    }
1286
1287    /** The best solution to the integer programming problem.
1288
1289      The best solution to the integer programming problem found during
1290      the search. If no solution is found, the method returns null.
1291    */
1292
1293    inline double * bestSolution() const {
1294        return bestSolution_;
1295    }
1296    /** User callable setBestSolution.
1297        If check false does not check valid
1298        If true then sees if feasible and warns if objective value
1299        worse than given (so just set to COIN_DBL_MAX if you don't care).
1300        If check true then does not save solution if not feasible
1301    */
1302    void setBestSolution(const double * solution, int numberColumns,
1303                         double objectiveValue, bool check = false);
1304
1305    /// Get number of solutions
1306    inline int getSolutionCount() const {
1307        return numberSolutions_;
1308    }
1309
1310    /// Set number of solutions (so heuristics will be different)
1311    inline void setSolutionCount(int value) {
1312        numberSolutions_ = value;
1313    }
1314    /// Number of saved solutions (including best)
1315    int numberSavedSolutions() const;
1316    /// Maximum number of extra saved solutions
1317    inline int maximumSavedSolutions() const {
1318        return maximumSavedSolutions_;
1319    }
1320    /// Set maximum number of extra saved solutions
1321    void setMaximumSavedSolutions(int value);
1322    /// Return a saved solution (0==best) - NULL if off end
1323    const double * savedSolution(int which) const;
1324    /// Return a saved solution objective (0==best) - COIN_DBL_MAX if off end
1325    double savedSolutionObjective(int which) const;
1326    /// Delete a saved solution and move others up
1327    void deleteSavedSolution(int which);
1328
1329    /** Current phase (so heuristics etc etc can find out).
1330        0 - initial solve
1331        1 - solve with cuts at root
1332        2 - solve with cuts
1333        3 - other e.g. strong branching
1334        4 - trying to validate a solution
1335        5 - at end of search
1336    */
1337    inline int phase() const {
1338        return phase_;
1339    }
1340
1341    /// Get number of heuristic solutions
1342    inline int getNumberHeuristicSolutions() const {
1343        return numberHeuristicSolutions_;
1344    }
1345    /// Set number of heuristic solutions
1346    inline void setNumberHeuristicSolutions(int value) {
1347        numberHeuristicSolutions_ = value;
1348    }
1349
1350    /// Set objective function sense (1 for min (default), -1 for max,)
1351    inline void setObjSense(double s) {
1352        dblParam_[CbcOptimizationDirection] = s;
1353        solver_->setObjSense(s);
1354    }
1355
1356    /// Value of objective at continuous
1357    inline double getContinuousObjective() const {
1358        return originalContinuousObjective_;
1359    }
1360    inline void setContinuousObjective(double value) {
1361        originalContinuousObjective_ = value;
1362    }
1363    /// Number of infeasibilities at continuous
1364    inline int getContinuousInfeasibilities() const {
1365        return continuousInfeasibilities_;
1366    }
1367    inline void setContinuousInfeasibilities(int value) {
1368        continuousInfeasibilities_ = value;
1369    }
1370    /// Value of objective after root node cuts added
1371    inline double rootObjectiveAfterCuts() const {
1372        return continuousObjective_;
1373    }
1374    /// Sum of Changes to objective by first solve
1375    inline double sumChangeObjective() const {
1376        return sumChangeObjective1_;
1377    }
1378    /** Number of times global cuts violated.  When global cut pool then this
1379        should be kept for each cut and type of cut */
1380    inline int numberGlobalViolations() const {
1381        return numberGlobalViolations_;
1382    }
1383    inline void clearNumberGlobalViolations() {
1384        numberGlobalViolations_ = 0;
1385    }
1386    /// Whether to force a resolve after takeOffCuts
1387    inline bool resolveAfterTakeOffCuts() const {
1388        return resolveAfterTakeOffCuts_;
1389    }
1390    inline void setResolveAfterTakeOffCuts(bool yesNo) {
1391        resolveAfterTakeOffCuts_ = yesNo;
1392    }
1393    /// Maximum number of rows
1394    inline int maximumRows() const {
1395        return maximumRows_;
1396    }
1397    /// Work basis for temporary use
1398    inline CoinWarmStartBasis & workingBasis() {
1399        return workingBasis_;
1400    }
1401    /// Get number of "iterations" to stop after
1402    inline int getStopNumberIterations() const {
1403        return stopNumberIterations_;
1404    }
1405    /// Set number of "iterations" to stop after
1406    inline void setStopNumberIterations(int value) {
1407        stopNumberIterations_ = value;
1408    }
1409    /// A pointer to model from CbcHeuristic
1410    inline CbcModel * heuristicModel() const
1411    { return heuristicModel_;}
1412    /// Set a pointer to model from CbcHeuristic
1413    inline void setHeuristicModel(CbcModel * model)
1414    { heuristicModel_ = model;}
1415    //@}
1416
1417    /** \name Node selection */
1418    //@{
1419    // Comparison functions (which may be overridden by inheritance)
1420    inline CbcCompareBase * nodeComparison() const {
1421        return nodeCompare_;
1422    }
1423    void setNodeComparison(CbcCompareBase * compare);
1424    void setNodeComparison(CbcCompareBase & compare);
1425    //@}
1426
1427    /** \name Problem feasibility checking */
1428    //@{
1429    // Feasibility functions (which may be overridden by inheritance)
1430    inline CbcFeasibilityBase * problemFeasibility() const {
1431        return problemFeasibility_;
1432    }
1433    void setProblemFeasibility(CbcFeasibilityBase * feasibility);
1434    void setProblemFeasibility(CbcFeasibilityBase & feasibility);
1435    //@}
1436
1437    /** \name Tree methods and subtree methods */
1438    //@{
1439    /// Tree method e.g. heap (which may be overridden by inheritance)
1440    inline CbcTree * tree() const {
1441        return tree_;
1442    }
1443    /// For modifying tree handling (original is cloned)
1444    void passInTreeHandler(CbcTree & tree);
1445    /** For passing in an CbcModel to do a sub Tree (with derived tree handlers).
1446        Passed in model must exist for duration of branch and bound
1447    */
1448    void passInSubTreeModel(CbcModel & model);
1449    /** For retrieving a copy of subtree model with given OsiSolver.
1450        If no subtree model will use self (up to user to reset cutoff etc).
1451        If solver NULL uses current
1452    */
1453    CbcModel * subTreeModel(OsiSolverInterface * solver = NULL) const;
1454    /// Returns number of times any subtree stopped on nodes, time etc
1455    inline int numberStoppedSubTrees() const {
1456        return numberStoppedSubTrees_;
1457    }
1458    /// Says a sub tree was stopped
1459    inline void incrementSubTreeStopped() {
1460        numberStoppedSubTrees_++;
1461    }
1462    /** Whether to automatically do presolve before branch and bound (subTrees).
1463        0 - no
1464        1 - ordinary presolve
1465        2 - integer presolve (dodgy)
1466    */
1467    inline int typePresolve() const {
1468        return presolve_;
1469    }
1470    inline void setTypePresolve(int value) {
1471        presolve_ = value;
1472    }
1473
1474    //@}
1475
1476    /** \name Branching Decisions
1477
1478      See the CbcBranchDecision class for additional information.
1479    */
1480    //@{
1481
1482    /// Get the current branching decision method.
1483    inline CbcBranchDecision * branchingMethod() const {
1484        return branchingMethod_;
1485    }
1486    /// Set the branching decision method.
1487    inline void setBranchingMethod(CbcBranchDecision * method) {
1488        delete branchingMethod_;
1489        branchingMethod_ = method->clone();
1490    }
1491    /** Set the branching method
1492
1493      \overload
1494    */
1495    inline void setBranchingMethod(CbcBranchDecision & method) {
1496        delete branchingMethod_;
1497        branchingMethod_ = method.clone();
1498    }
1499    /// Get the current cut modifier method
1500    inline CbcCutModifier * cutModifier() const {
1501        return cutModifier_;
1502    }
1503    /// Set the cut modifier method
1504    void setCutModifier(CbcCutModifier * modifier);
1505    /** Set the cut modifier method
1506
1507      \overload
1508    */
1509    void setCutModifier(CbcCutModifier & modifier);
1510    //@}
1511
1512    /** \name Row (constraint) and Column (variable) cut generation */
1513    //@{
1514
1515    /** State of search
1516        0 - no solution
1517        1 - only heuristic solutions
1518        2 - branched to a solution
1519        3 - no solution but many nodes
1520    */
1521    inline int stateOfSearch() const {
1522        return stateOfSearch_;
1523    }
1524    inline void setStateOfSearch(int state) {
1525        stateOfSearch_ = state;
1526    }
1527    /// Strategy worked out - mainly at root node for use by CbcNode
1528    inline int searchStrategy() const {
1529        return searchStrategy_;
1530    }
1531    /// Set strategy worked out - mainly at root node for use by CbcNode
1532    inline void setSearchStrategy(int value) {
1533        searchStrategy_ = value;
1534    }
1535    /// Stong branching strategy
1536    inline int strongStrategy() const {
1537        return strongStrategy_;
1538    }
1539    /// Set strong branching strategy
1540    inline void setStrongStrategy(int value) {
1541        strongStrategy_ = value;
1542    }
1543
1544    /// Get the number of cut generators
1545    inline int numberCutGenerators() const {
1546        return numberCutGenerators_;
1547    }
1548    /// Get the list of cut generators
1549    inline CbcCutGenerator ** cutGenerators() const {
1550        return generator_;
1551    }
1552    ///Get the specified cut generator
1553    inline CbcCutGenerator * cutGenerator(int i) const {
1554        return generator_[i];
1555    }
1556    ///Get the specified cut generator before any changes
1557    inline CbcCutGenerator * virginCutGenerator(int i) const {
1558        return virginGenerator_[i];
1559    }
1560    /** Add one generator - up to user to delete generators.
1561        howoften affects how generator is used. 0 or 1 means always,
1562        >1 means every that number of nodes.  Negative values have same
1563        meaning as positive but they may be switched off (-> -100) by code if
1564        not many cuts generated at continuous.  -99 is just done at root.
1565        Name is just for printout.
1566        If depth >0 overrides how often generator is called (if howOften==-1 or >0).
1567    */
1568    void addCutGenerator(CglCutGenerator * generator,
1569                         int howOften = 1, const char * name = NULL,
1570                         bool normal = true, bool atSolution = false,
1571                         bool infeasible = false, int howOftenInSub = -100,
1572                         int whatDepth = -1, int whatDepthInSub = -1);
1573//@}
1574    /** \name Strategy and sub models
1575
1576      See the CbcStrategy class for additional information.
1577    */
1578    //@{
1579
1580    /// Get the current strategy
1581    inline CbcStrategy * strategy() const {
1582        return strategy_;
1583    }
1584    /// Set the strategy. Clones
1585    void setStrategy(CbcStrategy & strategy);
1586    /// Set the strategy. assigns
1587    inline void setStrategy(CbcStrategy * strategy) {
1588        strategy_ = strategy;
1589    }
1590    /// Get the current parent model
1591    inline CbcModel * parentModel() const {
1592        return parentModel_;
1593    }
1594    /// Set the parent model
1595    inline void setParentModel(CbcModel & parentModel) {
1596        parentModel_ = &parentModel;
1597    }
1598    //@}
1599
1600
1601    /** \name Heuristics and priorities */
1602    //@{
1603    /*! \brief Add one heuristic - up to user to delete
1604
1605      The name is just used for print messages.
1606    */
1607    void addHeuristic(CbcHeuristic * generator, const char *name = NULL,
1608                      int before = -1);
1609    ///Get the specified heuristic
1610    inline CbcHeuristic * heuristic(int i) const {
1611        return heuristic_[i];
1612    }
1613    /// Get the number of heuristics
1614    inline int numberHeuristics() const {
1615        return numberHeuristics_;
1616    }
1617    /// Set the number of heuristics
1618    inline void setNumberHeuristics(int value) {
1619        numberHeuristics_ = value;
1620    }
1621    /// Pointer to heuristic solver which found last solution (or NULL)
1622    inline CbcHeuristic * lastHeuristic() const {
1623        return lastHeuristic_;
1624    }
1625    /// set last heuristic which found a solution
1626    inline void setLastHeuristic(CbcHeuristic * last) {
1627        lastHeuristic_ = last;
1628    }
1629
1630    /** Pass in branching priorities.
1631
1632        If ifClique then priorities are on cliques otherwise priorities are
1633        on integer variables.
1634        Other type (if exists set to default)
1635        1 is highest priority. (well actually -INT_MAX is but that's ugly)
1636        If hotstart > 0 then branches are created to force
1637        the variable to the value given by best solution.  This enables a
1638        sort of hot start.  The node choice should be greatest depth
1639        and hotstart should normally be switched off after a solution.
1640
1641        If ifNotSimpleIntegers true then appended to normal integers
1642
1643        This is now deprecated except for simple usage.  If user
1644        creates Cbcobjects then set priority in them
1645
1646        \internal Added for Kurt Spielberg.
1647    */
1648    void passInPriorities(const int * priorities, bool ifNotSimpleIntegers);
1649
1650    /// Returns priority level for an object (or 1000 if no priorities exist)
1651    inline int priority(int sequence) const {
1652        return object_[sequence]->priority();
1653    }
1654
1655    /*! \brief Set an event handler
1656
1657      A clone of the handler passed as a parameter is stored in CbcModel.
1658    */
1659    void passInEventHandler(const CbcEventHandler *eventHandler) ;
1660
1661    /*! \brief Retrieve a pointer to the event handler */
1662    inline CbcEventHandler* getEventHandler() const {
1663        return (eventHandler_) ;
1664    }
1665
1666    //@}
1667
1668    /**@name Setting/Accessing application data */
1669    //@{
1670    /** Set application data.
1671
1672    This is a pointer that the application can store into and
1673    retrieve from the solver interface.
1674    This field is available for the application to optionally
1675    define and use.
1676    */
1677    void setApplicationData (void * appData);
1678
1679    /// Get application data
1680    void * getApplicationData() const;
1681    /**
1682        For advanced applications you may wish to modify the behavior of Cbc
1683        e.g. if the solver is a NLP solver then you may not have an exact
1684        optimum solution at each step.  Information could be built into
1685        OsiSolverInterface but this is an alternative so that that interface
1686        does not have to be changed.  If something similar is useful to
1687        enough solvers then it could be migrated
1688        You can also pass in by using solver->setAuxiliaryInfo.
1689        You should do that if solver is odd - if solver is normal simplex
1690        then use this.
1691        NOTE - characteristics are not cloned
1692    */
1693    void passInSolverCharacteristics(OsiBabSolver * solverCharacteristics);
1694    /// Get solver characteristics
1695    inline const OsiBabSolver * solverCharacteristics() const {
1696        return solverCharacteristics_;
1697    }
1698    //@}
1699
1700    //---------------------------------------------------------------------------
1701
1702    /**@name Message handling etc */
1703    //@{
1704    /// Pass in Message handler (not deleted at end)
1705    void passInMessageHandler(CoinMessageHandler * handler);
1706    /// Set language
1707    void newLanguage(CoinMessages::Language language);
1708    inline void setLanguage(CoinMessages::Language language) {
1709        newLanguage(language);
1710    }
1711    /// Return handler
1712    inline CoinMessageHandler * messageHandler() const {
1713        return handler_;
1714    }
1715    /// Return messages
1716    inline CoinMessages & messages() {
1717        return messages_;
1718    }
1719    /// Return pointer to messages
1720    inline CoinMessages * messagesPointer() {
1721        return &messages_;
1722    }
1723    /// Set log level
1724    void setLogLevel(int value);
1725    /// Get log level
1726    inline int logLevel() const {
1727        return handler_->logLevel();
1728    }
1729    /** Set flag to say if handler_ is the default handler.
1730
1731      The default handler is deleted when the model is deleted. Other
1732      handlers (supplied by the client) will not be deleted.
1733    */
1734    inline void setDefaultHandler(bool yesNo) {
1735        defaultHandler_ = yesNo;
1736    }
1737    //@}
1738    //---------------------------------------------------------------------------
1739    ///@name Specialized
1740    //@{
1741
1742    /**
1743        Set special options
1744        0 bit (1) - check if cuts valid (if on debugger list)
1745        1 bit (2) - use current basis to check integer solution (rather than all slack)
1746        2 bit (4) - don't check integer solution (by solving LP)
1747        3 bit (8) - fast analyze
1748        4 bit (16) - non-linear model - so no well defined CoinPackedMatrix
1749        5 bit (32) - keep names
1750        6 bit (64) - try for dominated columns
1751        7 bit (128) - SOS type 1 but all declared integer
1752        8 bit (256) - Set to say solution just found, unset by doing cuts
1753        9 bit (512) - Try reduced model after 100 nodes
1754        10 bit (1024) - Switch on some heuristics even if seems unlikely
1755        11 bit (2048) - Mark as in small branch and bound
1756        12 bit (4096) - Funny cuts so do slow way (in some places)
1757        13 bit (8192) - Funny cuts so do slow way (in other places)
1758        14 bit (16384) - Use Cplex! for fathoming
1759        15 bit (32768) - Try reduced model after 0 nodes
1760        16 bit (65536) - Original model had integer bounds
1761        17 bit (131072) - Perturbation switched off
1762        18 bit (262144) - donor CbcModel
1763        19 bit (524288) - recipient CbcModel
1764        20 bit (1048576) - waiting for sub model to return
1765        22 bit (4194304) - do not initialize random seed in solver (user has)
1766        23 bit (8388608) - leave solver_ with cuts
1767    */
1768    inline void setSpecialOptions(int value) {
1769        specialOptions_ = value;
1770    }
1771    /// Get special options
1772    inline int specialOptions() const {
1773        return specialOptions_;
1774    }
1775    /// Set random seed
1776    inline void setRandomSeed(int value) {
1777        randomSeed_ = value;
1778    }
1779    /// Get random seed
1780    inline int getRandomSeed() const {
1781        return randomSeed_;
1782    }
1783    /// Set multiple root tries
1784    inline void setMultipleRootTries(int value) {
1785        multipleRootTries_ = value;
1786    }
1787    /// Get multiple root tries
1788    inline int getMultipleRootTries() const {
1789        return multipleRootTries_;
1790    }
1791    /// Tell model to stop on event
1792    inline void sayEventHappened()
1793    { eventHappened_=true;}
1794    /// Says if normal solver i.e. has well defined CoinPackedMatrix
1795    inline bool normalSolver() const {
1796        return (specialOptions_&16) == 0;
1797    }
1798    /** Says if model is sitting there waiting for mini branch and bound to finish
1799        This is because an event handler may only have access to parent model in
1800        mini branch and bound
1801    */
1802    inline bool waitingForMiniBranchAndBound() const {
1803        return (specialOptions_&1048576) != 0;
1804    }
1805    /** Set more special options
1806        at present bottom 6 bits used for shadow price mode
1807        1024 for experimental hotstart
1808        2048,4096 breaking out of cuts
1809        8192 slowly increase minimum drop
1810        16384 gomory
1811        32768 more heuristics in sub trees
1812        65536 no cuts in preprocessing
1813        131072 Time limits elapsed
1814        18 bit (262144) - Perturb fathom nodes
1815        19 bit (524288) - No limit on fathom nodes
1816        20 bit (1048576) - Reduce sum of infeasibilities before cuts
1817        21 bit (2097152) - Reduce sum of infeasibilities after cuts
1818        22 bit (4194304) - Conflict analysis
1819        23 bit (8388608) - Conflict analysis - temporary bit
1820        24 bit (16777216) - Add cutoff as LP constraint
1821    */
1822    inline void setMoreSpecialOptions(int value) {
1823        moreSpecialOptions_ = value;
1824    }
1825    /// Get more special options
1826    inline int moreSpecialOptions() const {
1827        return moreSpecialOptions_;
1828    }
1829  /// Set time method
1830    inline void setUseElapsedTime(bool yesNo) {
1831        if (yesNo)
1832          moreSpecialOptions_ |= 131072;
1833        else
1834          moreSpecialOptions_ &= ~131072;
1835    }
1836    /// Get time method
1837    inline bool useElapsedTime() const {
1838        return (moreSpecialOptions_&131072)!=0;
1839    }
1840    /// Go to dantzig pivot selection if easy problem (clp only)
1841#ifdef COIN_HAS_CLP
1842    void goToDantzig(int numberNodes, ClpDualRowPivot *& savePivotMethod);
1843#endif
1844    /// Now we may not own objects - just point to solver's objects
1845    inline bool ownObjects() const {
1846        return ownObjects_;
1847    }
1848    /// Check original model before it gets messed up
1849    void checkModel();
1850    //@}
1851    //---------------------------------------------------------------------------
1852
1853    ///@name Constructors and destructors etc
1854    //@{
1855    /// Default Constructor
1856    CbcModel();
1857
1858    /// Constructor from solver
1859    CbcModel(const OsiSolverInterface &);
1860
1861    /** Assign a solver to the model (model assumes ownership)
1862
1863      On return, \p solver will be NULL.
1864      If deleteSolver then current solver deleted (if model owned)
1865
1866      \note Parameter settings in the outgoing solver are not inherited by
1867        the incoming solver.
1868    */
1869    void assignSolver(OsiSolverInterface *&solver, bool deleteSolver = true);
1870
1871    /** \brief Set ownership of solver
1872
1873      A parameter of false tells CbcModel it does not own the solver and
1874      should not delete it. Once you claim ownership of the solver, you're
1875      responsible for eventually deleting it. Note that CbcModel clones
1876      solvers with abandon.  Unless you have a deep understanding of the
1877      workings of CbcModel, the only time you want to claim ownership is when
1878      you're about to delete the CbcModel object but want the solver to
1879      continue to exist (as, for example, when branchAndBound has finished
1880      and you want to hang on to the answer).
1881    */
1882    inline void setModelOwnsSolver (bool ourSolver) {
1883        ownership_ = ourSolver ? (ownership_ | 0x80000000) : (ownership_ & (~0x80000000)) ;
1884    }
1885
1886    /*! \brief Get ownership of solver
1887
1888      A return value of true means that CbcModel owns the solver and will
1889      take responsibility for deleting it when that becomes necessary.
1890    */
1891    inline bool modelOwnsSolver () {
1892        return ((ownership_&0x80000000) != 0) ;
1893    }
1894
1895    /** Copy constructor .
1896      If cloneHandler is true then message handler is cloned
1897    */
1898    CbcModel(const CbcModel & rhs, bool cloneHandler = false);
1899
1900    /// Assignment operator
1901    CbcModel & operator=(const CbcModel& rhs);
1902
1903    /// Destructor
1904    virtual ~CbcModel ();
1905
1906    /// Returns solver - has current state
1907    inline OsiSolverInterface * solver() const {
1908        return solver_;
1909    }
1910
1911    /// Returns current solver - sets new one
1912    inline OsiSolverInterface * swapSolver(OsiSolverInterface * solver) {
1913        OsiSolverInterface * returnSolver = solver_;
1914        solver_ = solver;
1915        return returnSolver;
1916    }
1917
1918    /// Returns solver with continuous state
1919    inline OsiSolverInterface * continuousSolver() const {
1920        return continuousSolver_;
1921    }
1922
1923    /// Create solver with continuous state
1924    inline void createContinuousSolver() {
1925        continuousSolver_ = solver_->clone();
1926    }
1927    /// Clear solver with continuous state
1928    inline void clearContinuousSolver() {
1929        delete continuousSolver_;
1930        continuousSolver_ = NULL;
1931    }
1932
1933    /// A copy of the solver, taken at constructor or by saveReferenceSolver
1934    inline OsiSolverInterface * referenceSolver() const {
1935        return referenceSolver_;
1936    }
1937
1938    /// Save a copy of the current solver so can be reset to
1939    void saveReferenceSolver();
1940
1941    /** Uses a copy of reference solver to be current solver.
1942        Because of possible mismatches all exotic integer information is loat
1943        (apart from normal information in OsiSolverInterface)
1944        so SOS etc and priorities will have to be redone
1945    */
1946    void resetToReferenceSolver();
1947
1948    /// Clears out as much as possible (except solver)
1949    void gutsOfDestructor();
1950    /** Clears out enough to reset CbcModel as if no branch and bound done
1951     */
1952    void gutsOfDestructor2();
1953    /** Clears out enough to reset CbcModel cutoff etc
1954     */
1955    void resetModel();
1956    /** Most of copy constructor
1957        mode - 0 copy but don't delete before
1958               1 copy and delete before
1959           2 copy and delete before (but use virgin generators)
1960    */
1961    void gutsOfCopy(const CbcModel & rhs, int mode = 0);
1962    /// Move status, nodes etc etc across
1963    void moveInfo(const CbcModel & rhs);
1964    //@}
1965
1966    ///@name Multithreading
1967    //@{
1968    /// Indicates whether Cbc library has been compiled with multithreading support
1969    static bool haveMultiThreadSupport();
1970    /// Get pointer to masterthread
1971    CbcThread * masterThread() const {
1972        return masterThread_;
1973    }
1974    /// Get pointer to walkback
1975    CbcNodeInfo ** walkback() const {
1976        return walkback_;
1977    }
1978    /// Get number of threads
1979    inline int getNumberThreads() const {
1980        return numberThreads_;
1981    }
1982    /// Set number of threads
1983    inline void setNumberThreads(int value) {
1984        numberThreads_ = value;
1985    }
1986    /// Get thread mode
1987    inline int getThreadMode() const {
1988        return threadMode_;
1989    }
1990    /** Set thread mode
1991        always use numberThreads for branching
1992        1 set then deterministic
1993        2 set then use numberThreads for root cuts
1994        4 set then use numberThreads in root mini branch and bound
1995        8 set and numberThreads - do heuristics numberThreads at a time
1996        8 set and numberThreads==0 do all heuristics at once
1997        default is 0
1998    */
1999    inline void setThreadMode(int value) {
2000        threadMode_ = value;
2001    }
2002    /** Return
2003        -2 if deterministic threaded and main thread
2004        -1 if deterministic threaded and serial thread
2005        0 if serial
2006        1 if opportunistic threaded
2007    */
2008    inline int parallelMode() const {
2009        if (!numberThreads_) {
2010            if ((threadMode_&1) == 0)
2011                return 0;
2012            else
2013                return -1;
2014            return 0;
2015        } else {
2016            if ((threadMode_&1) == 0)
2017                return 1;
2018            else
2019                return -2;
2020        }
2021    }
2022    /// From here to end of section - code in CbcThread.cpp until class changed
2023    /// Returns true if locked
2024    bool isLocked() const;
2025#ifdef CBC_THREAD
2026    /**
2027       Locks a thread if parallel so that stuff like cut pool
2028       can be updated and/or used.
2029    */
2030    void lockThread();
2031    /**
2032       Unlocks a thread if parallel to say cut pool stuff not needed
2033    */
2034    void unlockThread();
2035#else
2036    inline void lockThread() {}
2037    inline void unlockThread() {}
2038#endif
2039    /** Set information in a child
2040        -3 pass pointer to child thread info
2041        -2 just stop
2042        -1 delete simple child stuff
2043        0 delete opportunistic child stuff
2044        1 delete deterministic child stuff
2045    */
2046    void setInfoInChild(int type, CbcThread * info);
2047    /** Move/copy information from one model to another
2048        -1 - initialization
2049        0 - from base model
2050        1 - to base model (and reset)
2051        2 - add in final statistics etc (and reset so can do clean destruction)
2052    */
2053    void moveToModel(CbcModel * baseModel, int mode);
2054    /// Split up nodes
2055    int splitModel(int numberModels, CbcModel ** model,
2056                   int numberNodes);
2057    /// Start threads
2058    void startSplitModel(int numberIterations);
2059    /// Merge models
2060    void mergeModels(int numberModel, CbcModel ** model,
2061                     int numberNodes);
2062    //@}
2063
2064    ///@name semi-private i.e. users should not use
2065    //@{
2066    /// Get how many Nodes it took to solve the problem.
2067    int getNodeCount2() const {
2068        return numberNodes2_;
2069    }
2070    /// Set pointers for speed
2071    void setPointers(const OsiSolverInterface * solver);
2072    /** Perform reduced cost fixing
2073
2074      Fixes integer variables at their current value based on reduced cost
2075      penalties.  Returns number fixed
2076    */
2077    int reducedCostFix() ;
2078    /** Makes all handlers same.  If makeDefault 1 then makes top level
2079        default and rest point to that.  If 2 then each is copy
2080    */
2081    void synchronizeHandlers(int makeDefault);
2082    /// Save a solution to saved list
2083    void saveExtraSolution(const double * solution, double objectiveValue);
2084    /// Save a solution to best and move current to saved
2085    void saveBestSolution(const double * solution, double objectiveValue);
2086    /// Delete best and saved solutions
2087    void deleteSolutions();
2088    /// Encapsulates solver resolve
2089    int resolve(OsiSolverInterface * solver);
2090#ifdef CLP_RESOLVE
2091    /// Special purpose resolve
2092    int resolveClp(OsiClpSolverInterface * solver, int type);
2093#endif
2094
2095    /** Encapsulates choosing a variable -
2096        anyAction -2, infeasible (-1 round again), 0 done
2097    */
2098    int chooseBranch(CbcNode * & newNode, int numberPassesLeft,
2099                     CbcNode * oldNode, OsiCuts & cuts,
2100                     bool & resolved, CoinWarmStartBasis *lastws,
2101                     const double * lowerBefore, const double * upperBefore,
2102                     OsiSolverBranch * & branches);
2103    int chooseBranch(CbcNode * newNode, int numberPassesLeft, bool & resolved);
2104
2105    /** Return an empty basis object of the specified size
2106
2107      A useful utility when constructing a basis for a subproblem from scratch.
2108      The object returned will be of the requested capacity and appropriate for
2109      the solver attached to the model.
2110    */
2111    CoinWarmStartBasis *getEmptyBasis(int ns = 0, int na = 0) const ;
2112
2113    /** Remove inactive cuts from the model
2114
2115      An OsiSolverInterface is expected to maintain a valid basis, but not a
2116      valid solution, when loose cuts are deleted. Restoring a valid solution
2117      requires calling the solver to reoptimise. If it's certain the solution
2118      will not be required, set allowResolve to false to suppress
2119      reoptimisation.
2120      If saveCuts then slack cuts will be saved
2121      On input current cuts are cuts and newCuts
2122      on exit current cuts will be correct.  Returns number dropped
2123    */
2124    int takeOffCuts(OsiCuts &cuts,
2125                    bool allowResolve, OsiCuts * saveCuts,
2126                    int numberNewCuts = 0, const OsiRowCut ** newCuts = NULL) ;
2127
2128    /** Determine and install the active cuts that need to be added for
2129      the current subproblem
2130
2131      The whole truth is a bit more complicated. The first action is a call to
2132      addCuts1(). addCuts() then sorts through the list, installs the tight
2133      cuts in the model, and does bookkeeping (adjusts reference counts).
2134      The basis returned from addCuts1() is adjusted accordingly.
2135
2136      If it turns out that the node should really be fathomed by bound,
2137      addCuts() simply treats all the cuts as loose as it does the bookkeeping.
2138
2139      canFix true if extra information being passed
2140    */
2141    int addCuts(CbcNode * node, CoinWarmStartBasis *&lastws, bool canFix);
2142
2143    /** Traverse the tree from node to root and prep the model
2144
2145      addCuts1() begins the job of prepping the model to match the current
2146      subproblem. The model is stripped of all cuts, and the search tree is
2147      traversed from node to root to determine the changes required. Appropriate
2148      bounds changes are installed, a list of cuts is collected but not
2149      installed, and an appropriate basis (minus the cuts, but big enough to
2150      accommodate them) is constructed.
2151
2152      Returns true if new problem similar to old
2153
2154      \todo addCuts1() is called in contexts where it's known in advance that
2155        all that's desired is to determine a list of cuts and do the
2156        bookkeeping (adjust the reference counts). The work of installing
2157        bounds and building a basis goes to waste.
2158    */
2159    bool addCuts1(CbcNode * node, CoinWarmStartBasis *&lastws);
2160    /** Returns bounds just before where - initially original bounds.
2161        Also sets downstream nodes (lower if force 1, upper if 2)
2162    */
2163    void previousBounds (CbcNode * node, CbcNodeInfo * where, int iColumn,
2164                         double & lower, double & upper, int force);
2165    /** Set objective value in a node.  This is separated out so that
2166       odd solvers can use.  It may look at extra information in
2167       solverCharacteriscs_ and will also use bound from parent node
2168    */
2169    void setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode) const;
2170
2171    /** If numberBeforeTrust >0 then we are going to use CbcBranchDynamic.
2172        Scan and convert CbcSimpleInteger objects
2173    */
2174    void convertToDynamic();
2175    /// Set numberBeforeTrust in all objects
2176    void synchronizeNumberBeforeTrust(int type = 0);
2177    /// Zap integer information in problem (may leave object info)
2178    void zapIntegerInformation(bool leaveObjects = true);
2179    /// Use cliques for pseudocost information - return nonzero if infeasible
2180    int cliquePseudoCosts(int doStatistics);
2181    /// Fill in useful estimates
2182    void pseudoShadow(int type);
2183    /** Return pseudo costs
2184        If not all integers or not pseudo costs - returns all zero
2185        Length of arrays are numberIntegers() and entries
2186        correspond to integerVariable()[i]
2187        User must allocate arrays before call
2188    */
2189    void fillPseudoCosts(double * downCosts, double * upCosts,
2190                         int * priority = NULL,
2191                         int * numberDown = NULL, int * numberUp = NULL,
2192                         int * numberDownInfeasible = NULL,
2193                         int * numberUpInfeasible = NULL) const;
2194    /** Do heuristics at root.
2195        0 - don't delete
2196        1 - delete
2197        2 - just delete - don't even use
2198    */
2199    void doHeuristicsAtRoot(int deleteHeuristicsAfterwards = 0);
2200    /// Adjust heuristics based on model
2201    void adjustHeuristics();
2202    /// Get the hotstart solution
2203    inline const double * hotstartSolution() const {
2204        return hotstartSolution_;
2205    }
2206    /// Get the hotstart priorities
2207    inline const int * hotstartPriorities() const {
2208        return hotstartPriorities_;
2209    }
2210
2211    /// Return the list of cuts initially collected for this subproblem
2212    inline CbcCountRowCut ** addedCuts() const {
2213        return addedCuts_;
2214    }
2215    /// Number of entries in the list returned by #addedCuts()
2216    inline int currentNumberCuts() const {
2217        return currentNumberCuts_;
2218    }
2219    /// Global cuts
2220    inline CbcRowCuts * globalCuts() {
2221        return &globalCuts_;
2222    }
2223    /// Copy and set a pointer to a row cut which will be added instead of normal branching.
2224    void setNextRowCut(const OsiRowCut & cut);
2225    /// Get a pointer to current node (be careful)
2226    inline CbcNode * currentNode() const {
2227        return currentNode_;
2228    }
2229    /// Get a pointer to probing info
2230    inline CglTreeProbingInfo * probingInfo() const {
2231        return probingInfo_;
2232    }
2233    /// Thread specific random number generator
2234    inline CoinThreadRandom * randomNumberGenerator() {
2235        return &randomNumberGenerator_;
2236    }
2237    /// Set the number of iterations done in strong branching.
2238    inline void setNumberStrongIterations(int number) {
2239        numberStrongIterations_ = number;
2240    }
2241    /// Get the number of iterations done in strong branching.
2242    inline int numberStrongIterations() const {
2243        return numberStrongIterations_;
2244    }
2245    /// Get maximum number of iterations (designed to be used in heuristics)
2246    inline int maximumNumberIterations() const {
2247        return maximumNumberIterations_;
2248    }
2249    /// Set maximum number of iterations (designed to be used in heuristics)
2250    inline void setMaximumNumberIterations(int value) {
2251        maximumNumberIterations_ = value;
2252    }
2253# ifdef COIN_HAS_CLP
2254    /// Set depth for fast nodes
2255    inline void setFastNodeDepth(int value) {
2256        fastNodeDepth_ = value;
2257    }
2258    /// Get depth for fast nodes
2259    inline int fastNodeDepth() const {
2260        return fastNodeDepth_;
2261    }
2262    /// Get anything with priority >= this can be treated as continuous
2263    inline int continuousPriority() const {
2264        return continuousPriority_;
2265    }
2266    /// Set anything with priority >= this can be treated as continuous
2267    inline void setContinuousPriority(int value) {
2268        continuousPriority_ = value;
2269    }
2270    inline void incrementExtra(int nodes, int iterations) {
2271        numberExtraNodes_ += nodes;
2272        numberExtraIterations_ += iterations;
2273    }
2274#endif
2275    /// Number of extra iterations
2276    inline int numberExtraIterations() const {
2277        return numberExtraIterations_;
2278    }
2279    /// Increment strong info
2280    void incrementStrongInfo(int numberTimes, int numberIterations,
2281                             int numberFixed, bool ifInfeasible);
2282    /// Return strong info
2283    inline const int * strongInfo() const {
2284        return strongInfo_;
2285    }
2286
2287    /// Return mutable strong info
2288    inline int * mutableStrongInfo() {
2289        return strongInfo_;
2290    }
2291    /// Get stored row cuts for donor/recipient CbcModel
2292    CglStored * storedRowCuts() const {
2293        return storedRowCuts_;
2294    }
2295    /// Set stored row cuts for donor/recipient CbcModel
2296    void setStoredRowCuts(CglStored * cuts) {
2297        storedRowCuts_ = cuts;
2298    }
2299    /// Says whether all dynamic integers
2300    inline bool allDynamic () const {
2301        return ((ownership_&0x40000000) != 0) ;
2302    }
2303    /// Create C++ lines to get to current state
2304    void generateCpp( FILE * fp, int options);
2305    /// Generate an OsiBranchingInformation object
2306    OsiBranchingInformation usefulInformation() const;
2307    /** Warm start object produced by heuristic or strong branching
2308
2309        If get a valid integer solution outside branch and bound then it can take
2310        a reasonable time to solve LP which produces clean solution.  If this object has
2311        any size then it will be used in solve.
2312    */
2313    inline void setBestSolutionBasis(const CoinWarmStartBasis & bestSolutionBasis) {
2314        bestSolutionBasis_ = bestSolutionBasis;
2315    }
2316    /// Redo walkback arrays
2317    void redoWalkBack();
2318    //@}
2319
2320//---------------------------------------------------------------------------
2321
2322private:
2323    ///@name Private member data
2324    //@{
2325
2326    /// The solver associated with this model.
2327    OsiSolverInterface * solver_;
2328
2329    /** Ownership of objects and other stuff
2330
2331        0x80000000 model owns solver
2332        0x40000000 all variables CbcDynamicPseudoCost
2333    */
2334    unsigned int ownership_ ;
2335
2336    /// A copy of the solver, taken at the continuous (root) node.
2337    OsiSolverInterface * continuousSolver_;
2338
2339    /// A copy of the solver, taken at constructor or by saveReferenceSolver
2340    OsiSolverInterface * referenceSolver_;
2341
2342    /// Message handler
2343    CoinMessageHandler * handler_;
2344
2345    /** Flag to say if handler_ is the default handler.
2346
2347      The default handler is deleted when the model is deleted. Other
2348      handlers (supplied by the client) will not be deleted.
2349    */
2350    bool defaultHandler_;
2351
2352    /// Cbc messages
2353    CoinMessages messages_;
2354
2355    /// Array for integer parameters
2356    int intParam_[CbcLastIntParam];
2357
2358    /// Array for double parameters
2359    double dblParam_[CbcLastDblParam];
2360
2361    /** Pointer to an empty warm start object
2362
2363      It turns out to be useful to have this available as a base from
2364      which to build custom warm start objects. This is typed as CoinWarmStart
2365      rather than CoinWarmStartBasis to allow for the possibility that a
2366      client might want to apply a solver that doesn't use a basis-based warm
2367      start. See getEmptyBasis for an example of how this field can be used.
2368    */
2369    mutable CoinWarmStart *emptyWarmStart_ ;
2370
2371    /// Best objective
2372    double bestObjective_;
2373    /// Best possible objective
2374    double bestPossibleObjective_;
2375    /// Sum of Changes to objective by first solve
2376    double sumChangeObjective1_;
2377    /// Sum of Changes to objective by subsequent solves
2378    double sumChangeObjective2_;
2379
2380    /// Array holding the incumbent (best) solution.
2381    double * bestSolution_;
2382    /// Arrays holding other solutions.
2383    double ** savedSolutions_;
2384
2385    /** Array holding the current solution.
2386
2387      This array is used more as a temporary.
2388    */
2389    double * currentSolution_;
2390    /** For testing infeasibilities - will point to
2391        currentSolution_ or solver-->getColSolution()
2392    */
2393    mutable const double * testSolution_;
2394    /** Warm start object produced by heuristic or strong branching
2395
2396        If get a valid integer solution outside branch and bound then it can take
2397        a reasonable time to solve LP which produces clean solution.  If this object has
2398        any size then it will be used in solve.
2399    */
2400    CoinWarmStartBasis bestSolutionBasis_ ;
2401    /// Global cuts
2402    CbcRowCuts globalCuts_;
2403    /// Global conflict cuts
2404    CbcRowCuts * globalConflictCuts_;
2405
2406    /// Minimum degradation in objective value to continue cut generation
2407    double minimumDrop_;
2408    /// Number of solutions
2409    int numberSolutions_;
2410    /// Number of saved solutions
2411    int numberSavedSolutions_;
2412    /// Maximum number of saved solutions
2413    int maximumSavedSolutions_;
2414    /** State of search
2415        0 - no solution
2416        1 - only heuristic solutions
2417        2 - branched to a solution
2418        3 - no solution but many nodes
2419    */
2420    int stateOfSearch_;
2421    /// At which depths to do cuts
2422    int whenCuts_;
2423    /// Hotstart solution
2424    double * hotstartSolution_;
2425    /// Hotstart priorities
2426    int * hotstartPriorities_;
2427    /// Number of heuristic solutions
2428    int numberHeuristicSolutions_;
2429    /// Cumulative number of nodes
2430    int numberNodes_;
2431    /** Cumulative number of nodes for statistics.
2432        Must fix to match up
2433    */
2434    int numberNodes2_;
2435    /// Cumulative number of iterations
2436    int numberIterations_;
2437    /// Cumulative number of solves
2438    int numberSolves_;
2439    /// Status of problem - 0 finished, 1 stopped, 2 difficulties
2440    int status_;
2441    /** Secondary status of problem
2442        -1 unset (status_ will also be -1)
2443        0 search completed with solution
2444        1 linear relaxation not feasible (or worse than cutoff)
2445        2 stopped on gap
2446        3 stopped on nodes
2447        4 stopped on time
2448        5 stopped on user event
2449        6 stopped on solutions
2450     */
2451    int secondaryStatus_;
2452    /// Number of integers in problem
2453    int numberIntegers_;
2454    /// Number of rows at continuous
2455    int numberRowsAtContinuous_;
2456    /// Maximum number of cuts
2457    int maximumNumberCuts_;
2458    /** Current phase (so heuristics etc etc can find out).
2459        0 - initial solve
2460        1 - solve with cuts at root
2461        2 - solve with cuts
2462        3 - other e.g. strong branching
2463        4 - trying to validate a solution
2464        5 - at end of search
2465    */
2466    int phase_;
2467
2468    /// Number of entries in #addedCuts_
2469    int currentNumberCuts_;
2470
2471    /** Current limit on search tree depth
2472
2473      The allocated size of #walkback_. Increased as needed.
2474    */
2475    int maximumDepth_;
2476    /** Array used to assemble the path between a node and the search tree root
2477
2478      The array is resized when necessary. #maximumDepth_  is the current
2479      allocated size.
2480    */
2481    CbcNodeInfo ** walkback_;
2482    CbcNodeInfo ** lastNodeInfo_;
2483    const OsiRowCut ** lastCut_;
2484    int lastDepth_;
2485    int lastNumberCuts2_;
2486    int maximumCuts_;
2487    int * lastNumberCuts_;
2488
2489    /** The list of cuts initially collected for this subproblem
2490
2491      When the subproblem at this node is rebuilt, a set of cuts is collected
2492      for inclusion in the constraint system. If any of these cuts are
2493      subsequently removed because they have become loose, the corresponding
2494      entry is set to NULL.
2495    */
2496    CbcCountRowCut ** addedCuts_;
2497
2498    /** A pointer to a row cut which will be added instead of normal branching.
2499        After use it should be set to NULL.
2500    */
2501    OsiRowCut * nextRowCut_;
2502
2503    /// Current node so can be used elsewhere
2504    CbcNode * currentNode_;
2505
2506    /// Indices of integer variables
2507    int * integerVariable_;
2508    /// Whether of not integer
2509    char * integerInfo_;
2510    /// Holds solution at continuous (after cuts)
2511    double * continuousSolution_;
2512    /// Array marked whenever a solution is found if non-zero
2513    int * usedInSolution_;
2514    /**
2515        Special options
2516        0 bit (1) - check if cuts valid (if on debugger list)
2517        1 bit (2) - use current basis to check integer solution (rather than all slack)
2518        2 bit (4) - don't check integer solution (by solving LP)
2519        3 bit (8) - fast analyze
2520        4 bit (16) - non-linear model - so no well defined CoinPackedMatrix
2521        5 bit (32) - keep names
2522        6 bit (64) - try for dominated columns
2523        7 bit (128) - SOS type 1 but all declared integer
2524        8 bit (256) - Set to say solution just found, unset by doing cuts
2525        9 bit (512) - Try reduced model after 100 nodes
2526        10 bit (1024) - Switch on some heuristics even if seems unlikely
2527        11 bit (2048) - Mark as in small branch and bound
2528        12 bit (4096) - Funny cuts so do slow way (in some places)
2529        13 bit (8192) - Funny cuts so do slow way (in other places)
2530        14 bit (16384) - Use Cplex! for fathoming
2531        15 bit (32768) - Try reduced model after 0 nodes
2532        16 bit (65536) - Original model had integer bounds
2533        17 bit (131072) - Perturbation switched off
2534        18 bit (262144) - donor CbcModel
2535        19 bit (524288) - recipient CbcModel
2536    */
2537    int specialOptions_;
2538    /** More special options
2539        at present bottom 6 bits used for shadow price mode
2540        1024 for experimental hotstart
2541        2048,4096 breaking out of cuts
2542        8192 slowly increase minimum drop
2543        16384 gomory
2544        32768 more heuristics in sub trees
2545        65536 no cuts in preprocessing
2546        131072 Time limits elapsed
2547        18 bit (262144) - Perturb fathom nodes
2548        19 bit (524288) - No limit on fathom nodes
2549        20 bit (1048576) - Reduce sum of infeasibilities before cuts
2550        21 bit (2097152) - Reduce sum of infeasibilities after cuts
2551    */
2552    int moreSpecialOptions_;
2553    /// User node comparison function
2554    CbcCompareBase * nodeCompare_;
2555    /// User feasibility function (see CbcFeasibleBase.hpp)
2556    CbcFeasibilityBase * problemFeasibility_;
2557    /// Tree
2558    CbcTree * tree_;
2559    /// Pointer to top of tree
2560    CbcFullNodeInfo * topOfTree_;
2561    /// A pointer to model to be used for subtrees
2562    CbcModel * subTreeModel_;
2563    /// A pointer to model from CbcHeuristic
2564    CbcModel * heuristicModel_;
2565    /// Number of times any subtree stopped on nodes, time etc
2566    int numberStoppedSubTrees_;
2567    /// Variable selection function
2568    CbcBranchDecision * branchingMethod_;
2569    /// Cut modifier function
2570    CbcCutModifier * cutModifier_;
2571    /// Strategy
2572    CbcStrategy * strategy_;
2573    /// Parent model
2574    CbcModel * parentModel_;
2575    /** Whether to automatically do presolve before branch and bound.
2576        0 - no
2577        1 - ordinary presolve
2578        2 - integer presolve (dodgy)
2579    */
2580    /// Pointer to array[getNumCols()] (for speed) of column lower bounds
2581    const double * cbcColLower_;
2582    /// Pointer to array[getNumCols()] (for speed) of column upper bounds
2583    const double * cbcColUpper_;
2584    /// Pointer to array[getNumRows()] (for speed) of row lower bounds
2585    const double * cbcRowLower_;
2586    /// Pointer to array[getNumRows()] (for speed) of row upper bounds
2587    const double * cbcRowUpper_;
2588    /// Pointer to array[getNumCols()] (for speed) of primal solution vector
2589    const double * cbcColSolution_;
2590    /// Pointer to array[getNumRows()] (for speed) of dual prices
2591    const double * cbcRowPrice_;
2592    /// Get a pointer to array[getNumCols()] (for speed) of reduced costs
2593    const double * cbcReducedCost_;
2594    /// Pointer to array[getNumRows()] (for speed) of row activity levels.
2595    const double * cbcRowActivity_;
2596    /// Pointer to user-defined data structure
2597    void * appData_;
2598    /// Presolve for CbcTreeLocal
2599    int presolve_;
2600    /** Maximum number of candidates to consider for strong branching.
2601      To disable strong branching, set this to 0.
2602    */
2603    int numberStrong_;
2604    /** \brief The number of branches before pseudo costs believed
2605           in dynamic strong branching.
2606
2607      A value of 0 is  off.
2608    */
2609    int numberBeforeTrust_;
2610    /** \brief The number of variables for which to compute penalties
2611           in dynamic strong branching.
2612    */
2613    int numberPenalties_;
2614    /// For threads - stop after this many "iterations"
2615    int stopNumberIterations_;
2616    /** Scale factor to make penalties match strong.
2617        Should/will be computed */
2618    double penaltyScaleFactor_;
2619    /// Number of analyze iterations to do
2620    int numberAnalyzeIterations_;
2621    /// Arrays with analysis results
2622    double * analyzeResults_;
2623    /// Number of nodes infeasible by normal branching (before cuts)
2624    int numberInfeasibleNodes_;
2625    /** Problem type as set by user or found by analysis.  This will be extended
2626        0 - not known
2627        1 - Set partitioning <=
2628        2 - Set partitioning ==
2629        3 - Set covering
2630    */
2631    int problemType_;
2632    /// Print frequency
2633    int printFrequency_;
2634    /// Number of cut generators
2635    int numberCutGenerators_;
2636    // Cut generators
2637    CbcCutGenerator ** generator_;
2638    // Cut generators before any changes
2639    CbcCutGenerator ** virginGenerator_;
2640    /// Number of heuristics
2641    int numberHeuristics_;
2642    /// Heuristic solvers
2643    CbcHeuristic ** heuristic_;
2644    /// Pointer to heuristic solver which found last solution (or NULL)
2645    CbcHeuristic * lastHeuristic_;
2646    /// Depth for fast nodes
2647    int fastNodeDepth_;
2648    /*! Pointer to the event handler */
2649# ifdef CBC_ONLY_CLP
2650    ClpEventHandler *eventHandler_ ;
2651# else
2652    CbcEventHandler *eventHandler_ ;
2653# endif
2654
2655    /// Total number of objects
2656    int numberObjects_;
2657
2658    /** \brief Integer and Clique and ... information
2659
2660      \note The code assumes that the first objects on the list will be
2661        SimpleInteger objects for each integer variable, followed by
2662        Clique objects. Portions of the code that understand Clique objects
2663        will fail if they do not immediately follow the SimpleIntegers.
2664        Large chunks of the code will fail if the first objects are not
2665        SimpleInteger. As of 2003.08, SimpleIntegers and Cliques are the only
2666        objects.
2667    */
2668    OsiObject ** object_;
2669    /// Now we may not own objects - just point to solver's objects
2670    bool ownObjects_;
2671
2672    /// Original columns as created by integerPresolve or preprocessing
2673    int * originalColumns_;
2674    /// How often to scan global cuts
2675    int howOftenGlobalScan_;
2676    /** Number of times global cuts violated.  When global cut pool then this
2677        should be kept for each cut and type of cut */
2678    int numberGlobalViolations_;
2679    /// Number of extra iterations in fast lp
2680    int numberExtraIterations_;
2681    /// Number of extra nodes in fast lp
2682    int numberExtraNodes_;
2683    /** Value of objective at continuous
2684        (Well actually after initial round of cuts)
2685    */
2686    double continuousObjective_;
2687    /** Value of objective before root node cuts added
2688    */
2689    double originalContinuousObjective_;
2690    /// Number of infeasibilities at continuous
2691    int continuousInfeasibilities_;
2692    /// Maximum number of cut passes at root
2693    int maximumCutPassesAtRoot_;
2694    /// Maximum number of cut passes
2695    int maximumCutPasses_;
2696    /// Preferred way of branching
2697    int preferredWay_;
2698    /// Current cut pass number
2699    int currentPassNumber_;
2700    /// Maximum number of cuts (for whichGenerator_)
2701    int maximumWhich_;
2702    /// Maximum number of rows
2703    int maximumRows_;
2704    /// Random seed
2705    int randomSeed_;
2706    /// Multiple root tries
2707    int multipleRootTries_;
2708    /// Current depth
2709    int currentDepth_;
2710    /// Thread specific random number generator
2711    mutable CoinThreadRandom randomNumberGenerator_;
2712    /// Work basis for temporary use
2713    CoinWarmStartBasis workingBasis_;
2714    /// Which cut generator generated this cut
2715    int * whichGenerator_;
2716    /// Maximum number of statistics
2717    int maximumStatistics_;
2718    /// statistics
2719    CbcStatistics ** statistics_;
2720    /// Maximum depth reached
2721    int maximumDepthActual_;
2722    /// Number of reduced cost fixings
2723    double numberDJFixed_;
2724    /// Probing info
2725    CglTreeProbingInfo * probingInfo_;
2726    /// Number of fixed by analyze at root
2727    int numberFixedAtRoot_;
2728    /// Number fixed by analyze so far
2729    int numberFixedNow_;
2730    /// Whether stopping on gap
2731    bool stoppedOnGap_;
2732    /// Whether event happened
2733    mutable bool eventHappened_;
2734    /// Number of long strong goes
2735    int numberLongStrong_;
2736    /// Number of old active cuts
2737    int numberOldActiveCuts_;
2738    /// Number of new cuts
2739    int numberNewCuts_;
2740    /// Strategy worked out - mainly at root node
2741    int searchStrategy_;
2742    /** Strategy for strong branching
2743        0 - normal
2744        when to do all fractional
2745        1 - root node
2746        2 - depth less than modifier
2747        4 - if objective == best possible
2748        6 - as 2+4
2749        when to do all including satisfied
2750        10 - root node etc.
2751        If >=100 then do when depth <= strategy/100 (otherwise 5)
2752     */
2753    int strongStrategy_;
2754    /// Number of iterations in strong branching
2755    int numberStrongIterations_;
2756    /** 0 - number times strong branching done, 1 - number fixed, 2 - number infeasible
2757        Second group of three is a snapshot at node [6] */
2758    int strongInfo_[7];
2759    /**
2760        For advanced applications you may wish to modify the behavior of Cbc
2761        e.g. if the solver is a NLP solver then you may not have an exact
2762        optimum solution at each step.  This gives characteristics - just for one BAB.
2763        For actually saving/restoring a solution you need the actual solver one.
2764    */
2765    OsiBabSolver * solverCharacteristics_;
2766    /// Whether to force a resolve after takeOffCuts
2767    bool resolveAfterTakeOffCuts_;
2768    /// Maximum number of iterations (designed to be used in heuristics)
2769    int maximumNumberIterations_;
2770    /// Anything with priority >= this can be treated as continuous
2771    int continuousPriority_;
2772    /// Number of outstanding update information items
2773    int numberUpdateItems_;
2774    /// Maximum number of outstanding update information items
2775    int maximumNumberUpdateItems_;
2776    /// Update items
2777    CbcObjectUpdateData * updateItems_;
2778    /// Stored row cuts for donor/recipient CbcModel
2779    CglStored * storedRowCuts_;
2780    /**
2781       Parallel
2782       0 - off
2783       1 - testing
2784       2-99 threads
2785       other special meanings
2786    */
2787    int numberThreads_;
2788    /** thread mode
2789        always use numberThreads for branching
2790        1 set then deterministic
2791        2 set then use numberThreads for root cuts
2792        4 set then use numberThreads in root mini branch and bound
2793        default is 0
2794    */
2795    int threadMode_;
2796    /// Thread stuff for master
2797    CbcBaseModel * master_;
2798    /// Pointer to masterthread
2799    CbcThread * masterThread_;
2800//@}
2801};
2802/// So we can use osiObject or CbcObject during transition
2803void getIntegerInformation(const OsiObject * object, double & originalLower,
2804                           double & originalUpper) ;
2805// So we can call from other programs
2806// Real main program
2807class OsiClpSolverInterface;
2808int CbcMain (int argc, const char *argv[], OsiClpSolverInterface & solver, CbcModel ** babSolver);
2809int CbcMain (int argc, const char *argv[], CbcModel & babSolver);
2810// four ways of calling
2811int callCbc(const char * input2, OsiClpSolverInterface& solver1);
2812int callCbc(const char * input2);
2813int callCbc(const std::string input2, OsiClpSolverInterface& solver1);
2814int callCbc(const std::string input2) ;
2815// When we want to load up CbcModel with options first
2816void CbcMain0 (CbcModel & babSolver);
2817int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver);
2818// two ways of calling
2819int callCbc(const char * input2, CbcModel & babSolver);
2820int callCbc(const std::string input2, CbcModel & babSolver);
2821// And when CbcMain0 already called to initialize
2822int callCbc1(const char * input2, CbcModel & babSolver);
2823int callCbc1(const std::string input2, CbcModel & babSolver);
2824// And when CbcMain0 already called to initialize (with call back) (see CbcMain1 for whereFrom)
2825int callCbc1(const char * input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2826int callCbc1(const std::string input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2827int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
2828// For uniform setting of cut and heuristic options
2829void setCutAndHeuristicOptions(CbcModel & model);
2830#endif
2831
Note: See TracBrowser for help on using the repository browser.