Ignore:
Timestamp:
Sep 29, 2006 4:48:36 PM (13 years ago)
Author:
pbonami
Message:

astyled the devel branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/devel/Bonmin/src/CbcBonmin/BonCbcNode.cpp

    r58 r62  
    2828
    2929
    30 namespace Bonmin{
     30namespace Bonmin
     31{
    3132//Default constructor
    32 BonCbcFullNodeInfo::BonCbcFullNodeInfo()
    33     :
    34     CbcFullNodeInfo(),
    35     sequenceOfInfeasiblesSize_(0),
    36     sequenceOfUnsolvedSize_(0)
     33  BonCbcFullNodeInfo::BonCbcFullNodeInfo()
     34      :
     35      CbcFullNodeInfo(),
     36      sequenceOfInfeasiblesSize_(0),
     37      sequenceOfUnsolvedSize_(0)
     38  {}
     39
     40  BonCbcFullNodeInfo::BonCbcFullNodeInfo(CbcModel * model,
     41      int numberRowsAtContinuous) :
     42      CbcFullNodeInfo(model, numberRowsAtContinuous),
     43      sequenceOfInfeasiblesSize_(0),
     44      sequenceOfUnsolvedSize_(0)
     45  {}
     46
     47// Copy constructor
     48  BonCbcFullNodeInfo::BonCbcFullNodeInfo ( const BonCbcFullNodeInfo &other):
     49      CbcFullNodeInfo(other),
     50      sequenceOfInfeasiblesSize_(other.sequenceOfInfeasiblesSize_),
     51      sequenceOfUnsolvedSize_(other.sequenceOfUnsolvedSize_)
     52
     53  {}
     54
     55
     56  void
     57  BonCbcFullNodeInfo::allBranchesGone()
     58  {
     59    IpoptWarmStart * ipws = dynamic_cast<IpoptWarmStart *>(basis_);
     60    if (ipws)
     61      ipws->flushPoint();
     62  }
     63
     64  BonCbcFullNodeInfo::~BonCbcFullNodeInfo()
    3765{}
    3866
    39 BonCbcFullNodeInfo::BonCbcFullNodeInfo(CbcModel * model,
    40     int numberRowsAtContinuous) :
    41     CbcFullNodeInfo(model, numberRowsAtContinuous),
    42     sequenceOfInfeasiblesSize_(0),
    43     sequenceOfUnsolvedSize_(0)
    44 {
    45 }
    46 
    47 // Copy constructor
    48 BonCbcFullNodeInfo::BonCbcFullNodeInfo ( const BonCbcFullNodeInfo &other):
    49     CbcFullNodeInfo(other),
    50     sequenceOfInfeasiblesSize_(other.sequenceOfInfeasiblesSize_),
    51     sequenceOfUnsolvedSize_(other.sequenceOfUnsolvedSize_)
    52 
    53 {}
    54 
    55 
    56 void
    57 BonCbcFullNodeInfo::allBranchesGone()
    58 {
    59   IpoptWarmStart * ipws = dynamic_cast<IpoptWarmStart *>(basis_);
    60   if(ipws)
    61     ipws->flushPoint();
    62 }
    63 
    64 BonCbcFullNodeInfo::~BonCbcFullNodeInfo()
    65 {}
    66 
    67 CbcNodeInfo *
    68 BonCbcFullNodeInfo::clone() const
    69 {
    70   return new BonCbcFullNodeInfo(*this);
    71 }
    72 /****************************************************************************************************/
     67  CbcNodeInfo *
     68  BonCbcFullNodeInfo::clone() const
     69  {
     70    return new BonCbcFullNodeInfo(*this);
     71  }
     72  /****************************************************************************************************/
    7373
    7474// Default constructor
    75 BonCbcPartialNodeInfo::BonCbcPartialNodeInfo ()
    76     : CbcPartialNodeInfo(),
    77     sequenceOfInfeasiblesSize_(0),
    78     sequenceOfUnsolvedSize_(0)
    79 {
    80 }
     75  BonCbcPartialNodeInfo::BonCbcPartialNodeInfo ()
     76      : CbcPartialNodeInfo(),
     77      sequenceOfInfeasiblesSize_(0),
     78      sequenceOfUnsolvedSize_(0)
     79  {}
    8180// Constructor from current state
    82 BonCbcPartialNodeInfo::BonCbcPartialNodeInfo (CbcModel * model,CbcNodeInfo *parent, CbcNode *owner,
    83     int numberChangedBounds,
    84     const int *variables,
    85     const double *boundChanges,
    86     const CoinWarmStartDiff *basisDiff)
    87     : CbcPartialNodeInfo(parent,owner,numberChangedBounds,variables,
    88         boundChanges,basisDiff),
    89     sequenceOfInfeasiblesSize_(0),
    90     sequenceOfUnsolvedSize_(0)
    91 {
    92   IpoptInterface * ipopt = dynamic_cast<IpoptInterface *>(model->solver());
    93   assert (ipopt);
    94   Ipopt::ApplicationReturnStatus optimization_status
    95   = ipopt->getOptStatus();
    96   BonCbcPartialNodeInfo * nlpParent = dynamic_cast<BonCbcPartialNodeInfo *> (parent);
    97   int numberInfeasible = 0;
    98   int numberUnsolved = 0;
    99   if(nlpParent)//father is not root
     81  BonCbcPartialNodeInfo::BonCbcPartialNodeInfo (CbcModel * model,CbcNodeInfo *parent, CbcNode *owner,
     82      int numberChangedBounds,
     83      const int *variables,
     84      const double *boundChanges,
     85      const CoinWarmStartDiff *basisDiff)
     86      : CbcPartialNodeInfo(parent,owner,numberChangedBounds,variables,
     87          boundChanges,basisDiff),
     88      sequenceOfInfeasiblesSize_(0),
     89      sequenceOfUnsolvedSize_(0)
    10090  {
    101     numberInfeasible = nlpParent->getSequenceOfInfeasiblesSize();
    102     numberUnsolved =  nlpParent->getSequenceOfUnsolvedSize();
     91    IpoptInterface * ipopt = dynamic_cast<IpoptInterface *>(model->solver());
     92    assert (ipopt);
     93    Ipopt::ApplicationReturnStatus optimization_status
     94    = ipopt->getOptStatus();
     95    BonCbcPartialNodeInfo * nlpParent = dynamic_cast<BonCbcPartialNodeInfo *> (parent);
     96    int numberInfeasible = 0;
     97    int numberUnsolved = 0;
     98    if (nlpParent)//father is not root
     99    {
     100      numberInfeasible = nlpParent->getSequenceOfInfeasiblesSize();
     101      numberUnsolved =  nlpParent->getSequenceOfUnsolvedSize();
    103102//       if(!nlpParent->numberBranchesLeft_){
    104103//      IpoptWarmStartDiff * ipws = dynamic_cast<IpoptWarmStartDiff *>(nlpParent->basisDiff_);
    105104//      ipws->flushPoint();
    106105//       }
     106    }
     107    else {
     108      BonCbcFullNodeInfo * nlpRoot = dynamic_cast<BonCbcFullNodeInfo *> (parent);
     109      if (nlpRoot) {
     110        numberInfeasible = nlpRoot->getSequenceOfInfeasiblesSize();
     111        numberUnsolved =  nlpRoot->getSequenceOfUnsolvedSize();
     112      }
     113    }
     114    if ((optimization_status==Ipopt::Unrecoverable_Exception)||
     115        (optimization_status==Ipopt::NonIpopt_Exception_Thrown)||
     116        (optimization_status==Ipopt::Insufficient_Memory)||
     117        (optimization_status==Ipopt::Restoration_Failed)||
     118        (optimization_status==Ipopt::Internal_Error)||
     119        (optimization_status==Ipopt::Maximum_Iterations_Exceeded))
     120      sequenceOfUnsolvedSize_ = numberUnsolved + 1;
     121
     122    if (optimization_status==Ipopt::Infeasible_Problem_Detected)
     123      sequenceOfInfeasiblesSize_ = numberInfeasible + 1;
    107124  }
    108   else {
    109     BonCbcFullNodeInfo * nlpRoot = dynamic_cast<BonCbcFullNodeInfo *> (parent);
    110     if(nlpRoot) {
    111       numberInfeasible = nlpRoot->getSequenceOfInfeasiblesSize();
    112       numberUnsolved =  nlpRoot->getSequenceOfUnsolvedSize();
    113     }
    114   }
    115   if((optimization_status==Ipopt::Unrecoverable_Exception)||
    116       (optimization_status==Ipopt::NonIpopt_Exception_Thrown)||
    117       (optimization_status==Ipopt::Insufficient_Memory)||
    118       (optimization_status==Ipopt::Restoration_Failed)||
    119       (optimization_status==Ipopt::Internal_Error)||
    120       (optimization_status==Ipopt::Maximum_Iterations_Exceeded))
    121     sequenceOfUnsolvedSize_ = numberUnsolved + 1;
    122125
    123   if(optimization_status==Ipopt::Infeasible_Problem_Detected)
    124     sequenceOfInfeasiblesSize_ = numberInfeasible + 1;
    125 }
     126  BonCbcPartialNodeInfo::BonCbcPartialNodeInfo (const BonCbcPartialNodeInfo & rhs)
    126127
    127 BonCbcPartialNodeInfo::BonCbcPartialNodeInfo (const BonCbcPartialNodeInfo & rhs)
    128 
    129     : CbcPartialNodeInfo(rhs),
    130     sequenceOfInfeasiblesSize_(rhs.sequenceOfInfeasiblesSize_),
    131     sequenceOfUnsolvedSize_(rhs.sequenceOfUnsolvedSize_)
     128      : CbcPartialNodeInfo(rhs),
     129      sequenceOfInfeasiblesSize_(rhs.sequenceOfInfeasiblesSize_),
     130      sequenceOfUnsolvedSize_(rhs.sequenceOfUnsolvedSize_)
    132131
    133132{}
    134133
    135 CbcNodeInfo *
    136 BonCbcPartialNodeInfo::clone() const
    137 {
    138   return (new BonCbcPartialNodeInfo(*this));
    139 }
     134  CbcNodeInfo *
     135  BonCbcPartialNodeInfo::clone() const
     136  {
     137    return (new BonCbcPartialNodeInfo(*this));
     138  }
    140139
    141 void
    142 BonCbcPartialNodeInfo::allBranchesGone()
    143 {
    144   IpoptWarmStartDiff * ipws = dynamic_cast<IpoptWarmStartDiff *>(basisDiff_);
    145   if(ipws)
    146     ipws->flushPoint();
    147 }
     140  void
     141  BonCbcPartialNodeInfo::allBranchesGone()
     142  {
     143    IpoptWarmStartDiff * ipws = dynamic_cast<IpoptWarmStartDiff *>(basisDiff_);
     144    if (ipws)
     145      ipws->flushPoint();
     146  }
    148147
    149 BonCbcPartialNodeInfo::~BonCbcPartialNodeInfo ()
     148  BonCbcPartialNodeInfo::~BonCbcPartialNodeInfo ()
    150149{}
    151150}
Note: See TracChangeset for help on using the changeset viewer.