source: stable/2.8/Cbc/src/CbcModel.hpp @ 1883

Last change on this file since 1883 was 1883, checked in by stefan, 6 years ago

sync with trunk rev 1882

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