Ignore:
Timestamp:
Nov 9, 2009 6:33:07 PM (10 years ago)
Author:
EdwinStraver
Message:

Changed formatting using AStyle -A4 -p

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/Cbc/src/CbcNode_ansi.hpp

    r1276 r1286  
    6262*/
    6363
    64 class CbcNodeInfo
    65 {
     64class CbcNodeInfo {
    6665
    6766public:
     
    111110                               int &currentNumberCuts) const = 0 ;
    112111    /// 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;
     112    virtual int applyBounds(int iColumn, double & lower, double & upper, int force) = 0;
    114113
    115114    /** Builds up row basis backwards (until original model).
     
    124123#if 1
    125124    /// 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_);*/
     125    inline void increment(int amount = 1) {
     126        numberPointingToThis_ += amount;/*printf("CbcNodeInfo %x incremented by %d to %d\n",this,amount,numberPointingToThis_);*/
    129127    }
    130128
    131129    /// 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_);*/
     130    inline int decrement(int amount = 1) {
     131        numberPointingToThis_ -= amount;/*printf("CbcNodeInfo %x decremented by %d to %d\n",this,amount,numberPointingToThis_);*/
    135132        return numberPointingToThis_;
    136133    }
    137134#else
    138135    /// Increment number of references
    139     void increment(int amount=1);
     136    void increment(int amount = 1);
    140137    /// Decrement number of references and return number left
    141     int decrement(int amount=1);
     138    int decrement(int amount = 1);
    142139#endif
    143140    /** Initialize reference counts
     
    146143    */
    147144
    148     inline void initializeInfo(int number)
    149     {
    150         numberPointingToThis_=number;
    151         numberBranchesLeft_=number;
     145    inline void initializeInfo(int number) {
     146        numberPointingToThis_ = number;
     147        numberBranchesLeft_ = number;
    152148    }
    153149
    154150    /// Return number of branches left in object
    155     inline int numberBranchesLeft() const
    156     {
     151    inline int numberBranchesLeft() const {
    157152        return numberBranchesLeft_;
    158153    }
    159154
    160155    /// Set number of branches left in object
    161     inline void setNumberBranchesLeft(int value)
    162     {
     156    inline void setNumberBranchesLeft(int value) {
    163157        numberBranchesLeft_ = value;
    164158    }
    165159
    166160    /// Return number of objects pointing to this
    167     inline int numberPointingToThis() const
    168     {
     161    inline int numberPointingToThis() const {
    169162        return numberPointingToThis_;
    170163    }
    171164
    172165    /// Set number of objects pointing to this
    173     inline void setNumberPointingToThis(int number)
    174     {
    175         numberPointingToThis_=number;
     166    inline void setNumberPointingToThis(int number) {
     167        numberPointingToThis_ = number;
    176168    }
    177169
    178170    /// Increment number of objects pointing to this
    179     inline void incrementNumberPointingToThis()
    180     {
     171    inline void incrementNumberPointingToThis() {
    181172        numberPointingToThis_ ++;
    182173    }
    183174
    184175    /// Say one branch taken
    185     inline int branchedOn()
    186     {
     176    inline int branchedOn() {
    187177        numberPointingToThis_--;
    188178        numberBranchesLeft_--;
     
    191181
    192182    /// Say thrown away
    193     inline void throwAway()
    194     {
    195         numberPointingToThis_-=numberBranchesLeft_;
    196         numberBranchesLeft_=0;
     183    inline void throwAway() {
     184        numberPointingToThis_ -= numberBranchesLeft_;
     185        numberBranchesLeft_ = 0;
    197186    }
    198187
    199188    /// Parent of this
    200     CbcNodeInfo * parent() const
    201     {
     189    CbcNodeInfo * parent() const {
    202190        return parent_;
    203191    }
    204192    /// Set parent null
    205     inline void nullParent()
    206     {
    207         parent_=NULL;
    208     }
    209 
    210     void addCuts(OsiCuts & cuts,int numberToBranch, //int * whichGenerator,
     193    inline void nullParent() {
     194        parent_ = NULL;
     195    }
     196
     197    void addCuts(OsiCuts & cuts, int numberToBranch, //int * whichGenerator,
    211198                 int numberPointingToThis);
    212     void addCuts(int numberCuts, CbcCountRowCut ** cuts,int numberToBranch);
     199    void addCuts(int numberCuts, CbcCountRowCut ** cuts, int numberToBranch);
    213200    /** Delete cuts (decrements counts)
    214201        Slow unless cuts in same order as saved
    215202    */
    216     void deleteCuts(int numberToDelete,CbcCountRowCut ** cuts);
    217     void deleteCuts(int numberToDelete,int * which);
     203    void deleteCuts(int numberToDelete, CbcCountRowCut ** cuts);
     204    void deleteCuts(int numberToDelete, int * which);
    218205
    219206    /// Really delete a cut
     
    221208
    222209    /// Decrement active cut counts
    223     void decrementCuts(int change=1);
     210    void decrementCuts(int change = 1);
    224211
    225212    /// Increment active cut counts
    226     void incrementCuts(int change=1);
     213    void incrementCuts(int change = 1);
    227214
    228215    /// Decrement all active cut counts in chain starting at parent
    229     void decrementParentCuts(CbcModel * model, int change=1);
     216    void decrementParentCuts(CbcModel * model, int change = 1);
    230217
    231218    /// Increment all active cut counts in parent chain
    232     void incrementParentCuts(CbcModel * model, int change=1);
     219    void incrementParentCuts(CbcModel * model, int change = 1);
    233220
    234221    /// Array of pointers to cuts
    235     inline CbcCountRowCut ** cuts() const
    236     {
     222    inline CbcCountRowCut ** cuts() const {
    237223        return cuts_;
    238224    }
    239225
    240226    /// Number of row cuts (this node)
    241     inline int numberCuts() const
    242     {
     227    inline int numberCuts() const {
    243228        return numberCuts_;
    244229    }
    245     inline void setNumberCuts(int value)
    246     {
    247         numberCuts_=value;
     230    inline void setNumberCuts(int value) {
     231        numberCuts_ = value;
    248232    }
    249233
    250234    /// Set owner null
    251     inline void nullOwner()
    252     {
    253         owner_=NULL;
    254     }
    255     const inline CbcNode * owner() const
    256     {
     235    inline void nullOwner() {
     236        owner_ = NULL;
     237    }
     238    const inline CbcNode * owner() const {
    257239        return owner_;
    258240    }
    259     inline CbcNode * mutableOwner() const
    260     {
     241    inline CbcNode * mutableOwner() const {
    261242        return owner_;
    262243    }
    263244    /// The node number
    264     inline int nodeNumber() const
    265     {
     245    inline int nodeNumber() const {
    266246        return nodeNumber_;
    267247    }
    268     inline void setNodeNumber(int node)
    269     {
    270         nodeNumber_=node;
     248    inline void setNodeNumber(int node) {
     249        nodeNumber_ = node;
    271250    }
    272251    /** Deactivate node information.
     
    275254        4 - basis!
    276255    */
    277     void deactivate(int mode=3);
     256    void deactivate(int mode = 3);
    278257    /// Say if normal
    279     inline bool allActivated() const
    280     {
    281         return (active_==7);
     258    inline bool allActivated() const {
     259        return (active_ == 7);
    282260    }
    283261    /// Say if marked
    284     inline bool marked() const
    285     {
    286         return ((active_&8)!=0);
     262    inline bool marked() const {
     263        return ((active_&8) != 0);
    287264    }
    288265    /// Mark
    289     inline void mark()
    290     {
     266    inline void mark() {
    291267        active_ |= 8;
    292268    }
    293269    /// Unmark
    294     inline void unmark()
    295     {
     270    inline void unmark() {
    296271        active_ &= ~8;
    297272    }
    298273
    299274    /// Branching object for the parent
    300     inline const OsiBranchingObject * parentBranch() const
    301     {
     275    inline const OsiBranchingObject * parentBranch() const {
    302276        return parentBranch_;
    303277    }
     
    371345*/
    372346
    373 class CbcFullNodeInfo : public CbcNodeInfo
    374 {
     347class CbcFullNodeInfo : public CbcNodeInfo {
    375348
    376349public:
     
    390363
    391364    /// 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) ;
     365    virtual int applyBounds(int iColumn, double & lower, double & upper, int force) ;
    393366
    394367    /** Builds up row basis backwards (until original model).
     
    414387    virtual CbcNodeInfo * clone() const;
    415388    /// Lower bounds
    416     inline const double * lower() const
    417     {
     389    inline const double * lower() const {
    418390        return lower_;
    419391    }
    420392    /// Upper bounds
    421     inline const double * upper() const
    422     {
     393    inline const double * upper() const {
    423394        return upper_;
    424395    }
     
    450421*/
    451422
    452 class CbcPartialNodeInfo : public CbcNodeInfo
    453 {
     423class CbcPartialNodeInfo : public CbcNodeInfo {
    454424
    455425public:
     
    465435
    466436    /// 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) ;
     437    virtual int applyBounds(int iColumn, double & lower, double & upper, int force) ;
    468438    /** Builds up row basis backwards (until original model).
    469439        Returns NULL or previous one to apply .
     
    476446    // Constructor from current state
    477447    CbcPartialNodeInfo (CbcNodeInfo * parent, CbcNode * owner,
    478                         int numberChangedBounds,const int * variables,
     448                        int numberChangedBounds, const int * variables,
    479449                        const double * boundChanges,
    480450                        const CoinWarmStartDiff *basisDiff) ;
     
    489459    virtual CbcNodeInfo * clone() const;
    490460    /// Basis diff information
    491     inline const CoinWarmStartDiff *basisDiff() const
    492     {
     461    inline const CoinWarmStartDiff *basisDiff() const {
    493462        return basisDiff_ ;
    494463    }
    495464    /// Which variable (top bit if upper bound changing)
    496     inline const int * variables() const
    497     {
     465    inline const int * variables() const {
    498466        return variables_;
    499467    }
    500468    // New bound
    501     inline const double * newBounds() const
    502     {
     469    inline const double * newBounds() const {
    503470        return newBounds_;
    504471    }
    505472    /// Number of bound changes
    506     inline int numberChangedBounds() const
    507     {
     473    inline int numberChangedBounds() const {
    508474        return numberChangedBounds_;
    509475    }
     
    543509*/
    544510
    545 class CbcNode : public CoinTreeNode
    546 {
     511class CbcNode : public CoinTreeNode {
    547512
    548513public:
     
    583548               const CoinWarmStartBasis *lastws,
    584549               const double * lastLower, const double * lastUpper,
    585                int numberOldActiveCuts,int numberNewCuts);
     550               int numberOldActiveCuts, int numberNewCuts);
    586551
    587552    /** Create a branching object for the node
     
    684649    int chooseClpBranch (CbcModel * model,
    685650                         CbcNode * lastNode);
    686     int analyze(CbcModel * model,double * results);
     651    int analyze(CbcModel * model, double * results);
    687652    /// Decrement active cut counts
    688     void decrementCuts(int change=1);
     653    void decrementCuts(int change = 1);
    689654
    690655    /// Decrement all active cut counts in chain starting at parent
    691     void decrementParentCuts(CbcModel * model, int change=1);
     656    void decrementParentCuts(CbcModel * model, int change = 1);
    692657
    693658    /// Nulls out node info
     
    711676    double checkIsCutoff(double cutoff);
    712677    // Information to make basis and bounds
    713     inline CbcNodeInfo * nodeInfo() const
    714     {
     678    inline CbcNodeInfo * nodeInfo() const {
    715679        return nodeInfo_;
    716680    }
    717681
    718682    // Objective value
    719     inline double objectiveValue() const
    720     {
     683    inline double objectiveValue() const {
    721684        return objectiveValue_;
    722685    }
    723     inline void setObjectiveValue(double value)
    724     {
    725         objectiveValue_=value;
     686    inline void setObjectiveValue(double value) {
     687        objectiveValue_ = value;
    726688    }
    727689    /// Number of arms defined for the attached OsiBranchingObject.
    728     inline int numberBranches() const
    729     {
     690    inline int numberBranches() const {
    730691        if (branch_)
    731692            return (branch_->numberBranches()) ;
     
    742703    int way() const;
    743704    /// Depth in branch-and-cut search tree
    744     inline int depth() const
    745     {
     705    inline int depth() const {
    746706        return depth_;
    747707    }
    748708    /// Set depth in branch-and-cut search tree
    749     inline void setDepth(int value)
    750     {
     709    inline void setDepth(int value) {
    751710        depth_ = value;
    752711    }
    753712    /// Get the number of objects unsatisfied at this node.
    754     inline int numberUnsatisfied() const
    755     {
     713    inline int numberUnsatisfied() const {
    756714        return numberUnsatisfied_;
    757715    }
    758716    /// Set the number of objects unsatisfied at this node.
    759     inline void setNumberUnsatisfied(int value)
    760     {
     717    inline void setNumberUnsatisfied(int value) {
    761718        numberUnsatisfied_ = value;
    762719    }
    763720    /// Get sum of "infeasibilities" reported by each object
    764     inline double sumInfeasibilities() const
    765     {
     721    inline double sumInfeasibilities() const {
    766722        return sumInfeasibilities_;
    767723    }
    768724    /// Set sum of "infeasibilities" reported by each object
    769     inline void setSumInfeasibilities(double value)
    770     {
     725    inline void setSumInfeasibilities(double value) {
    771726        sumInfeasibilities_ = value;
    772727    }
    773728    // Guessed objective value (for solution)
    774     inline double guessedObjectiveValue() const
    775     {
     729    inline double guessedObjectiveValue() const {
    776730        return guessedObjectiveValue_;
    777731    }
    778     inline void setGuessedObjectiveValue(double value)
    779     {
    780         guessedObjectiveValue_=value;
     732    inline void setGuessedObjectiveValue(double value) {
     733        guessedObjectiveValue_ = value;
    781734    }
    782735    /// Branching object for this node
    783     inline const OsiBranchingObject * branchingObject() const
    784     {
     736    inline const OsiBranchingObject * branchingObject() const {
    785737        return branch_;
    786738    }
    787739    /// Modifiable branching object for this node
    788     inline OsiBranchingObject * modifiableBranchingObject() const
    789     {
     740    inline OsiBranchingObject * modifiableBranchingObject() const {
    790741        return branch_;
    791742    }
    792743    /// Set branching object for this node (takes ownership)
    793     inline void setBranchingObject(OsiBranchingObject * branchingObject)
    794     {
     744    inline void setBranchingObject(OsiBranchingObject * branchingObject) {
    795745        branch_ = branchingObject;
    796746    }
    797747    /// The node number
    798     inline int nodeNumber() const
    799     {
     748    inline int nodeNumber() const {
    800749        return nodeNumber_;
    801750    }
    802     inline void setNodeNumber(int node)
    803     {
    804         nodeNumber_=node;
     751    inline void setNodeNumber(int node) {
     752        nodeNumber_ = node;
    805753    }
    806754    /// Returns true if on tree
    807     inline bool onTree() const
    808     {
    809         return (state_&1)!=0;
     755    inline bool onTree() const {
     756        return (state_&1) != 0;
    810757    }
    811758    /// Sets true if on tree
    812     inline void setOnTree(bool yesNo)
    813     {
     759    inline void setOnTree(bool yesNo) {
    814760        if (yesNo) state_ |= 1;
    815761        else state_ &= ~1;
    816762    }
    817763    /// Returns true if active
    818     inline bool active() const
    819     {
    820         return (state_&2)!=0;
     764    inline bool active() const {
     765        return (state_&2) != 0;
    821766    }
    822767    /// Sets true if active
    823     inline void setActive(bool yesNo)
    824     {
     768    inline void setActive(bool yesNo) {
    825769        if (yesNo) state_ |= 2;
    826770        else state_ &= ~2;
     
    829773    void print() const;
    830774    /// Debug
    831     inline void checkInfo() const
    832     {
    833         assert (nodeInfo_->numberBranchesLeft()==
     775    inline void checkInfo() const {
     776        assert (nodeInfo_->numberBranchesLeft() ==
    834777                branch_->numberBranchesLeft());
    835778    }
Note: See TracChangeset for help on using the changeset viewer.