source: branches/sandbox/Cbc/src/CbcNode_ansi.hpp @ 1287

Last change on this file since 1287 was 1287, checked in by bjarni, 10 years ago

Recommitting (rev 1276) Astyle formatting options based on ansi (A1), k&r (A3), stroustrup (A4), and banner (A6)

File size: 26.4 KB
Line 
1/* $Id: CbcNode.hpp 1271 2009-11-05 15:57:25Z forrest $ */
2// Copyright (C) 2002, International Business Machines
3// Corporation and others.  All Rights Reserved.
4#ifndef CbcNode_H
5#define CbcNode_H
6
7#include <string>
8#include <vector>
9
10#include "CoinWarmStartBasis.hpp"
11#include "CoinSearchTree.hpp"
12#include "CbcBranchBase.hpp"
13
14class OsiSolverInterface;
15class OsiSolverBranch;
16
17class OsiCuts;
18class OsiRowCut;
19class OsiRowCutDebugger;
20class CoinWarmStartBasis;
21class CbcCountRowCut;
22class CbcModel;
23class CbcNode;
24class CbcSubProblem;
25class CbcGeneralBranchingObject;
26
27//#############################################################################
28/** Information required to recreate the subproblem at this node
29
30  When a subproblem is initially created, it is represented by a CbcNode
31  object and an attached CbcNodeInfo object.
32
33  The CbcNode contains information needed while the subproblem remains live.
34  The CbcNode is deleted when the last branch arm has been evaluated.
35
36  The CbcNodeInfo contains information required to maintain the branch-and-cut
37  search tree structure (links and reference counts) and to recreate the
38  subproblem for this node (basis, variable bounds, cutting planes). A
39  CbcNodeInfo object remains in existence until all nodes have been pruned from
40  the subtree rooted at this node.
41
42  The principle used to maintain the reference count is that the reference
43  count is always the sum of all potential and actual children of the node.
44  Specifically,
45  <ul>
46    <li> Once it's determined how the node will branch, the reference count
47         is set to the number of potential children (<i>i.e.</i>, the number
48         of arms of the branch).
49    <li> As each child is created by CbcNode::branch() (converting a potential
50         child to the active subproblem), the reference count is decremented.
51    <li> If the child survives and will become a node in the search tree
52         (converting the active subproblem into an actual child), increment the
53         reference count.
54  </ul>
55  Notice that the active subproblem lives in a sort of limbo, neither a
56  potential or an actual node in the branch-and-cut tree.
57
58  CbcNodeInfo objects come in two flavours. A CbcFullNodeInfo object contains
59  a full record of the information required to recreate a subproblem.
60  A CbcPartialNodeInfo object expresses this information in terms of
61  differences from the parent.
62*/
63
64class CbcNodeInfo
65{
66
67public:
68
69    /** \name Constructors & destructors */
70//@{
71    /** Default Constructor
72
73      Creates an empty NodeInfo object.
74    */
75    CbcNodeInfo ();
76
77    /// Copy constructor
78    CbcNodeInfo ( const CbcNodeInfo &);
79
80#if 0
81    /** Construct with parent
82
83      Creates a NodeInfo object which knows its parent and assumes it will
84      in turn have two children.
85    */
86    CbcNodeInfo (CbcNodeInfo * parent);
87#endif
88
89    /** Construct with parent and owner
90
91      As for `construct with parent', and attached to \p owner.
92    */
93    CbcNodeInfo (CbcNodeInfo * parent, CbcNode * owner);
94
95    /** Destructor
96
97      Note that the destructor will recursively delete the parent if this
98      nodeInfo is the last child.
99    */
100    virtual ~CbcNodeInfo();
101//@}
102
103
104    /** \brief Modify model according to information at node
105
106        The routine modifies the model according to bound and basis
107        information at node and adds any cuts to the addCuts array.
108    */
109    virtual void applyToModel (CbcModel *model, CoinWarmStartBasis *&basis,
110                               CbcCountRowCut **addCuts,
111                               int &currentNumberCuts) const = 0 ;
112    /// Just apply bounds to one variable - force means overwrite by lower,upper (1=>infeasible)
113    virtual int applyBounds(int iColumn, double & lower, double & upper,int force) = 0;
114
115    /** Builds up row basis backwards (until original model).
116        Returns NULL or previous one to apply .
117        Depends on Free being 0 and impossible for cuts
118    */
119    virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis & basis) const = 0;
120    /// Clone
121    virtual CbcNodeInfo * clone() const = 0;
122    /// Called when number branches left down to zero
123    virtual void allBranchesGone() {}
124#if 1
125    /// Increment number of references
126    inline void increment(int amount=1)
127    {
128        numberPointingToThis_+=amount;/*printf("CbcNodeInfo %x incremented by %d to %d\n",this,amount,numberPointingToThis_);*/
129    }
130
131    /// Decrement number of references and return number left
132    inline int decrement(int amount=1)
133    {
134        numberPointingToThis_-=amount;/*printf("CbcNodeInfo %x decremented by %d to %d\n",this,amount,numberPointingToThis_);*/
135        return numberPointingToThis_;
136    }
137#else
138    /// Increment number of references
139    void increment(int amount=1);
140    /// Decrement number of references and return number left
141    int decrement(int amount=1);
142#endif
143    /** Initialize reference counts
144
145      Initialize the reference counts used for tree maintenance.
146    */
147
148    inline void initializeInfo(int number)
149    {
150        numberPointingToThis_=number;
151        numberBranchesLeft_=number;
152    }
153
154    /// Return number of branches left in object
155    inline int numberBranchesLeft() const
156    {
157        return numberBranchesLeft_;
158    }
159
160    /// Set number of branches left in object
161    inline void setNumberBranchesLeft(int value)
162    {
163        numberBranchesLeft_ = value;
164    }
165
166    /// Return number of objects pointing to this
167    inline int numberPointingToThis() const
168    {
169        return numberPointingToThis_;
170    }
171
172    /// Set number of objects pointing to this
173    inline void setNumberPointingToThis(int number)
174    {
175        numberPointingToThis_=number;
176    }
177
178    /// Increment number of objects pointing to this
179    inline void incrementNumberPointingToThis()
180    {
181        numberPointingToThis_ ++;
182    }
183
184    /// Say one branch taken
185    inline int branchedOn()
186    {
187        numberPointingToThis_--;
188        numberBranchesLeft_--;
189        return numberBranchesLeft_;
190    }
191
192    /// Say thrown away
193    inline void throwAway()
194    {
195        numberPointingToThis_-=numberBranchesLeft_;
196        numberBranchesLeft_=0;
197    }
198
199    /// Parent of this
200    CbcNodeInfo * parent() const
201    {
202        return parent_;
203    }
204    /// Set parent null
205    inline void nullParent()
206    {
207        parent_=NULL;
208    }
209
210    void addCuts(OsiCuts & cuts,int numberToBranch, //int * whichGenerator,
211                 int numberPointingToThis);
212    void addCuts(int numberCuts, CbcCountRowCut ** cuts,int numberToBranch);
213    /** Delete cuts (decrements counts)
214        Slow unless cuts in same order as saved
215    */
216    void deleteCuts(int numberToDelete,CbcCountRowCut ** cuts);
217    void deleteCuts(int numberToDelete,int * which);
218
219    /// Really delete a cut
220    void deleteCut(int whichOne);
221
222    /// Decrement active cut counts
223    void decrementCuts(int change=1);
224
225    /// Increment active cut counts
226    void incrementCuts(int change=1);
227
228    /// Decrement all active cut counts in chain starting at parent
229    void decrementParentCuts(CbcModel * model, int change=1);
230
231    /// Increment all active cut counts in parent chain
232    void incrementParentCuts(CbcModel * model, int change=1);
233
234    /// Array of pointers to cuts
235    inline CbcCountRowCut ** cuts() const
236    {
237        return cuts_;
238    }
239
240    /// Number of row cuts (this node)
241    inline int numberCuts() const
242    {
243        return numberCuts_;
244    }
245    inline void setNumberCuts(int value)
246    {
247        numberCuts_=value;
248    }
249
250    /// Set owner null
251    inline void nullOwner()
252    {
253        owner_=NULL;
254    }
255    const inline CbcNode * owner() const
256    {
257        return owner_;
258    }
259    inline CbcNode * mutableOwner() const
260    {
261        return owner_;
262    }
263    /// The node number
264    inline int nodeNumber() const
265    {
266        return nodeNumber_;
267    }
268    inline void setNodeNumber(int node)
269    {
270        nodeNumber_=node;
271    }
272    /** Deactivate node information.
273        1 - bounds
274        2 - cuts
275        4 - basis!
276    */
277    void deactivate(int mode=3);
278    /// Say if normal
279    inline bool allActivated() const
280    {
281        return (active_==7);
282    }
283    /// Say if marked
284    inline bool marked() const
285    {
286        return ((active_&8)!=0);
287    }
288    /// Mark
289    inline void mark()
290    {
291        active_ |= 8;
292    }
293    /// Unmark
294    inline void unmark()
295    {
296        active_ &= ~8;
297    }
298
299    /// Branching object for the parent
300    inline const OsiBranchingObject * parentBranch() const
301    {
302        return parentBranch_;
303    }
304    /// If we need to take off parent based data
305    void unsetParentBasedData();
306protected:
307
308    /** Number of other nodes pointing to this node.
309
310      Number of existing and potential search tree nodes pointing to this node.
311      `Existing' means referenced by #parent_ of some other CbcNodeInfo.
312      `Potential' means children still to be created (#numberBranchesLeft_ of
313      this CbcNodeInfo).
314    */
315    int numberPointingToThis_;
316
317    /// parent
318    CbcNodeInfo * parent_;
319
320    /// Copy of the branching object of the parent when the node is created
321    OsiBranchingObject * parentBranch_;
322
323    /// Owner
324    CbcNode * owner_;
325
326    /// Number of row cuts (this node)
327    int numberCuts_;
328
329    /// The node number
330    int nodeNumber_;
331
332    /// Array of pointers to cuts
333    CbcCountRowCut ** cuts_;
334
335    /** Number of rows in problem (before these cuts).  This
336        means that for top of chain it must be rows at continuous */
337    int numberRows_;
338
339    /** Number of branch arms left to explore at this node
340
341      \todo There seems to be redundancy between this field and
342        CbcBranchingObject::numberBranchesLeft_. It'd be good to sort out if
343        both are necessary.
344    */
345    int numberBranchesLeft_;
346    /** Active node information.
347        1 - bounds
348        2 - cuts
349        4 - basis!
350    */
351    int active_;
352
353private:
354
355    /// Illegal Assignment operator
356    CbcNodeInfo & operator=(const CbcNodeInfo& rhs);
357
358    /// routine common to constructors
359    void setParentBasedData();
360};
361
362/** \brief Holds complete information for recreating a subproblem.
363
364  A CbcFullNodeInfo object contains all necessary information (bounds, basis,
365  and cuts) required to recreate a subproblem.
366
367  \todo While there's no explicit statement, the code often makes the implicit
368        assumption that an CbcFullNodeInfo structure will appear only at the
369        root node of the search tree. Things will break if this assumption
370        is violated.
371*/
372
373class CbcFullNodeInfo : public CbcNodeInfo
374{
375
376public:
377
378    /** \brief Modify model according to information at node
379
380        The routine modifies the model according to bound information at node,
381        creates a new basis according to information at node, but with the size
382        passed in through basis, and adds any cuts to the addCuts array.
383
384      \note The basis passed in via basis is solely a vehicle for passing in
385        the desired basis size. It will be deleted and a new basis returned.
386    */
387    virtual void applyToModel (CbcModel *model, CoinWarmStartBasis *&basis,
388                               CbcCountRowCut **addCuts,
389                               int &currentNumberCuts) const ;
390
391    /// Just apply bounds to one variable - force means overwrite by lower,upper (1=>infeasible)
392    virtual int applyBounds(int iColumn, double & lower, double & upper,int force) ;
393
394    /** Builds up row basis backwards (until original model).
395        Returns NULL or previous one to apply .
396        Depends on Free being 0 and impossible for cuts
397    */
398    virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis & basis) const ;
399    // Default Constructor
400    CbcFullNodeInfo ();
401
402    /** Constructor from continuous or satisfied
403    */
404    CbcFullNodeInfo (CbcModel * model,
405                     int numberRowsAtContinuous);
406
407    // Copy constructor
408    CbcFullNodeInfo ( const CbcFullNodeInfo &);
409
410    // Destructor
411    ~CbcFullNodeInfo ();
412
413    /// Clone
414    virtual CbcNodeInfo * clone() const;
415    /// Lower bounds
416    inline const double * lower() const
417    {
418        return lower_;
419    }
420    /// Upper bounds
421    inline const double * upper() const
422    {
423        return upper_;
424    }
425protected:
426    // Data
427    /** Full basis
428
429      This MUST BE A POINTER to avoid cutting extra information in derived
430      warm start classes.
431    */
432    CoinWarmStartBasis *basis_;
433    int numberIntegers_;
434    // Bounds stored in full
435    double * lower_;
436    double * upper_;
437private:
438    /// Illegal Assignment operator
439    CbcFullNodeInfo & operator=(const CbcFullNodeInfo& rhs);
440};
441
442
443
444/** \brief Holds information for recreating a subproblem by incremental change
445           from the parent.
446
447  A CbcPartialNodeInfo object contains changes to the bounds and basis, and
448  additional cuts, required to recreate a subproblem by modifying and
449  augmenting the parent subproblem.
450*/
451
452class CbcPartialNodeInfo : public CbcNodeInfo
453{
454
455public:
456
457    /** \brief Modify model according to information at node
458
459        The routine modifies the model according to bound and basis change
460        information at node and adds any cuts to the addCuts array.
461    */
462    virtual void applyToModel (CbcModel *model, CoinWarmStartBasis *&basis,
463                               CbcCountRowCut **addCuts,
464                               int &currentNumberCuts) const ;
465
466    /// Just apply bounds to one variable - force means overwrite by lower,upper (1=>infeasible)
467    virtual int applyBounds(int iColumn, double & lower, double & upper,int force) ;
468    /** Builds up row basis backwards (until original model).
469        Returns NULL or previous one to apply .
470        Depends on Free being 0 and impossible for cuts
471    */
472    virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis & basis ) const ;
473    // Default Constructor
474    CbcPartialNodeInfo ();
475
476    // Constructor from current state
477    CbcPartialNodeInfo (CbcNodeInfo * parent, CbcNode * owner,
478                        int numberChangedBounds,const int * variables,
479                        const double * boundChanges,
480                        const CoinWarmStartDiff *basisDiff) ;
481
482    // Copy constructor
483    CbcPartialNodeInfo ( const CbcPartialNodeInfo &);
484
485    // Destructor
486    ~CbcPartialNodeInfo ();
487
488    /// Clone
489    virtual CbcNodeInfo * clone() const;
490    /// Basis diff information
491    inline const CoinWarmStartDiff *basisDiff() const
492    {
493        return basisDiff_ ;
494    }
495    /// Which variable (top bit if upper bound changing)
496    inline const int * variables() const
497    {
498        return variables_;
499    }
500    // New bound
501    inline const double * newBounds() const
502    {
503        return newBounds_;
504    }
505    /// Number of bound changes
506    inline int numberChangedBounds() const
507    {
508        return numberChangedBounds_;
509    }
510protected:
511    /* Data values */
512
513    /// Basis diff information
514    CoinWarmStartDiff *basisDiff_ ;
515    /// Which variable (top bit if upper bound changing)
516    int * variables_;
517    // New bound
518    double * newBounds_;
519    /// Number of bound changes
520    int numberChangedBounds_;
521private:
522
523    /// Illegal Assignment operator
524    CbcPartialNodeInfo & operator=(const CbcPartialNodeInfo& rhs);
525};
526
527
528/** Information required while the node is live
529
530  When a subproblem is initially created, it is represented by an CbcNode
531  object and an attached CbcNodeInfo object.
532
533  The CbcNode contains information (depth, branching instructions), that's
534  needed while the subproblem remains `live', <i>i.e.</i>, while the
535  subproblem is not fathomed and there are branch arms still be be
536  evaluated.  The CbcNode is deleted when the last branch arm has been
537  evaluated.
538
539  The CbcNodeInfo object contains the information needed to maintain the
540  search tree and recreate the subproblem for the node. It remains in
541  existence until there are no nodes remaining in the subtree rooted at this
542  node.
543*/
544
545class CbcNode : public CoinTreeNode
546{
547
548public:
549
550    /// Default Constructor
551    CbcNode ();
552
553    /// Construct and increment parent reference count
554    CbcNode (CbcModel * model, CbcNode * lastNode);
555
556    /// Copy constructor
557    CbcNode (const CbcNode &);
558
559    /// Assignment operator
560    CbcNode & operator= (const CbcNode& rhs);
561
562    /// Destructor
563    ~CbcNode ();
564
565    /** Create a description of the subproblem at this node
566
567      The CbcNodeInfo structure holds the information (basis & variable bounds)
568      required to recreate the subproblem for this node. It also links the node
569      to its parent (via the parent's CbcNodeInfo object).
570
571      If lastNode == NULL, a CbcFullNodeInfo object will be created. All
572      parameters except \p model are unused.
573
574      If lastNode != NULL, a CbcPartialNodeInfo object will be created. Basis and
575      bounds information will be stored in the form of differences between the
576      parent subproblem and this subproblem.
577      (More precisely, \p lastws, \p lastUpper, \p lastLower,
578      \p numberOldActiveCuts, and \p numberNewCuts are used.)
579    */
580    void
581    createInfo(CbcModel * model,
582               CbcNode * lastNode,
583               const CoinWarmStartBasis *lastws,
584               const double * lastLower, const double * lastUpper,
585               int numberOldActiveCuts,int numberNewCuts);
586
587    /** Create a branching object for the node
588
589      The routine scans the object list of the model and selects a set of
590      unsatisfied objects as candidates for branching. The candidates are
591      evaluated, and an appropriate branch object is installed.
592
593      The numberPassesLeft is decremented to stop fixing one variable each time
594      and going on and on (e.g. for stock cutting, air crew scheduling)
595
596      If evaluation determines that an object is monotone or infeasible,
597      the routine returns immediately. In the case of a monotone object,
598      the branch object has already been called to modify the model.
599
600      Return value:
601      <ul>
602        <li>  0: A branching object has been installed
603        <li> -1: A monotone object was discovered
604        <li> -2: An infeasible object was discovered
605      </ul>
606    */
607    int chooseBranch (CbcModel * model,
608                      CbcNode * lastNode,
609                      int numberPassesLeft);
610    /** Create a branching object for the node - when dynamic pseudo costs
611
612      The routine scans the object list of the model and selects a set of
613      unsatisfied objects as candidates for branching. The candidates are
614      evaluated, and an appropriate branch object is installed.
615      This version gives preference in evaluation to variables which
616      have not been evaluated many times.  It also uses numberStrong
617      to say give up if last few tries have not changed incumbent.
618      See Achterberg, Koch and Martin.
619
620      The numberPassesLeft is decremented to stop fixing one variable each time
621      and going on and on (e.g. for stock cutting, air crew scheduling)
622
623      If evaluation determines that an object is monotone or infeasible,
624      the routine returns immediately. In the case of a monotone object,
625      the branch object has already been called to modify the model.
626
627      Return value:
628      <ul>
629        <li>  0: A branching object has been installed
630        <li> -1: A monotone object was discovered
631        <li> -2: An infeasible object was discovered
632        <li> >0: Number of quich branching objects (and branches will be non NULL)
633      </ul>
634    */
635    int chooseDynamicBranch (CbcModel * model,
636                             CbcNode * lastNode,
637                             OsiSolverBranch * & branches,
638                             int numberPassesLeft);
639    /** Create a branching object for the node
640
641      The routine scans the object list of the model and selects a set of
642      unsatisfied objects as candidates for branching. The candidates are
643      evaluated, and an appropriate branch object is installed.
644
645      The numberPassesLeft is decremented to stop fixing one variable each time
646      and going on and on (e.g. for stock cutting, air crew scheduling)
647
648      If evaluation determines that an object is monotone or infeasible,
649      the routine returns immediately. In the case of a monotone object,
650      the branch object has already been called to modify the model.
651
652      Return value:
653      <ul>
654        <li>  0: A branching object has been installed
655        <li> -1: A monotone object was discovered
656        <li> -2: An infeasible object was discovered
657      </ul>
658      Branch state:
659      <ul>
660        <li> -1: start
661        <li> -1: A monotone object was discovered
662        <li> -2: An infeasible object was discovered
663      </ul>
664    */
665    int chooseOsiBranch (CbcModel * model,
666                         CbcNode * lastNode,
667                         OsiBranchingInformation * usefulInfo,
668                         int branchState);
669    /** Create a branching object for the node
670
671      The routine scans the object list of the model and selects a set of
672      unsatisfied objects as candidates for branching. It then solves a
673      series of problems and a CbcGeneral branch object is installed.
674
675      If evaluation determines that an object is infeasible,
676      the routine returns immediately.
677
678      Return value:
679      <ul>
680        <li>  0: A branching object has been installed
681        <li> -2: An infeasible object was discovered
682      </ul>
683    */
684    int chooseClpBranch (CbcModel * model,
685                         CbcNode * lastNode);
686    int analyze(CbcModel * model,double * results);
687    /// Decrement active cut counts
688    void decrementCuts(int change=1);
689
690    /// Decrement all active cut counts in chain starting at parent
691    void decrementParentCuts(CbcModel * model, int change=1);
692
693    /// Nulls out node info
694    void nullNodeInfo();
695    /** Initialize reference counts in attached CbcNodeInfo
696
697      This is a convenience routine, which will initialize the reference counts
698      in the attached CbcNodeInfo object based on the attached
699      OsiBranchingObject.
700
701      \sa CbcNodeInfo::initializeInfo(int).
702    */
703    void initializeInfo();
704
705    /// Does next branch and updates state
706    int branch(OsiSolverInterface * solver);
707
708    /** Double checks in case node can change its mind!
709        Returns objective value
710        Can change objective etc */
711    double checkIsCutoff(double cutoff);
712    // Information to make basis and bounds
713    inline CbcNodeInfo * nodeInfo() const
714    {
715        return nodeInfo_;
716    }
717
718    // Objective value
719    inline double objectiveValue() const
720    {
721        return objectiveValue_;
722    }
723    inline void setObjectiveValue(double value)
724    {
725        objectiveValue_=value;
726    }
727    /// Number of arms defined for the attached OsiBranchingObject.
728    inline int numberBranches() const
729    {
730        if (branch_)
731            return (branch_->numberBranches()) ;
732        else
733            return (-1) ;
734    }
735
736    /* Active arm of the attached OsiBranchingObject.
737
738     In the simplest instance, coded -1 for the down arm of the branch, +1 for
739     the up arm. But see OsiBranchingObject::way()
740       Use nodeInfo--.numberBranchesLeft_ to see how active
741    */
742    int way() const;
743    /// Depth in branch-and-cut search tree
744    inline int depth() const
745    {
746        return depth_;
747    }
748    /// Set depth in branch-and-cut search tree
749    inline void setDepth(int value)
750    {
751        depth_ = value;
752    }
753    /// Get the number of objects unsatisfied at this node.
754    inline int numberUnsatisfied() const
755    {
756        return numberUnsatisfied_;
757    }
758    /// Set the number of objects unsatisfied at this node.
759    inline void setNumberUnsatisfied(int value)
760    {
761        numberUnsatisfied_ = value;
762    }
763    /// Get sum of "infeasibilities" reported by each object
764    inline double sumInfeasibilities() const
765    {
766        return sumInfeasibilities_;
767    }
768    /// Set sum of "infeasibilities" reported by each object
769    inline void setSumInfeasibilities(double value)
770    {
771        sumInfeasibilities_ = value;
772    }
773    // Guessed objective value (for solution)
774    inline double guessedObjectiveValue() const
775    {
776        return guessedObjectiveValue_;
777    }
778    inline void setGuessedObjectiveValue(double value)
779    {
780        guessedObjectiveValue_=value;
781    }
782    /// Branching object for this node
783    inline const OsiBranchingObject * branchingObject() const
784    {
785        return branch_;
786    }
787    /// Modifiable branching object for this node
788    inline OsiBranchingObject * modifiableBranchingObject() const
789    {
790        return branch_;
791    }
792    /// Set branching object for this node (takes ownership)
793    inline void setBranchingObject(OsiBranchingObject * branchingObject)
794    {
795        branch_ = branchingObject;
796    }
797    /// The node number
798    inline int nodeNumber() const
799    {
800        return nodeNumber_;
801    }
802    inline void setNodeNumber(int node)
803    {
804        nodeNumber_=node;
805    }
806    /// Returns true if on tree
807    inline bool onTree() const
808    {
809        return (state_&1)!=0;
810    }
811    /// Sets true if on tree
812    inline void setOnTree(bool yesNo)
813    {
814        if (yesNo) state_ |= 1;
815        else state_ &= ~1;
816    }
817    /// Returns true if active
818    inline bool active() const
819    {
820        return (state_&2)!=0;
821    }
822    /// Sets true if active
823    inline void setActive(bool yesNo)
824    {
825        if (yesNo) state_ |= 2;
826        else state_ &= ~2;
827    }
828    /// Print
829    void print() const;
830    /// Debug
831    inline void checkInfo() const
832    {
833        assert (nodeInfo_->numberBranchesLeft()==
834                branch_->numberBranchesLeft());
835    }
836
837private:
838    // Data
839    /// Information to make basis and bounds
840    CbcNodeInfo * nodeInfo_;
841    /// Objective value
842    double objectiveValue_;
843    /// Guessed satisfied Objective value
844    double guessedObjectiveValue_;
845    /// Sum of "infeasibilities" reported by each object
846    double sumInfeasibilities_;
847    /// Branching object for this node
848    OsiBranchingObject * branch_;
849    /// Depth of the node in the search tree
850    int depth_;
851    /// The number of objects unsatisfied at this node.
852    int numberUnsatisfied_;
853    /// The node number
854    int nodeNumber_;
855    /** State
856        1 - on tree
857        2 - active
858    */
859    int state_;
860};
861
862
863#endif
Note: See TracBrowser for help on using the repository browser.