Changeset 510


Ignore:
Timestamp:
Apr 26, 2007 10:17:08 AM (12 years ago)
Author:
pbonami
Message:

Make Smart pointer for storing asl*

Location:
trunk/Bonmin/experimental/NotConvex
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Bonmin/experimental/NotConvex/BonCouenneSetup.cpp

    r509 r510  
    2222namespace Bonmin{
    2323 
    24   CouenneSetup::~CouenneSetup(){
    25     if(aslfg_ != NULL)
    26       ASL_free(&aslfg_);
     24  SmartAsl::~SmartAsl(){
     25    if(asl != NULL)
     26      ASL_free(&asl);
    2727  }
    2828 
     29  CouenneSetup::~CouenneSetup(){
     30  }
    2931 
    3032  void CouenneSetup::InitializeBonmin(char **& argv){
     
    4345    /* Read the model in various places. */
    4446    ci->readAmplNlFile(argv,roptions(),options(),journalist());
    45     aslfg_ = readASLfg (argv);
     47    aslfg_ = new SmartAsl;
     48    aslfg_->asl = readASLfg (argv);
    4649   
    4750   
    4851    /* Initialize Couenne cut generator.*/
    49     CouenneCutGenerator * couenneCg = new CouenneCutGenerator(ci, aslfg_, true, CURRENT_ONLY,1);
     52    CouenneCutGenerator * couenneCg = new CouenneCutGenerator(ci, aslfg_->asl, true, CURRENT_ONLY,1);
    5053    CouenneProblem * couenneProb = couenneCg -> Problem();
    5154
  • trunk/Bonmin/experimental/NotConvex/BonCouenneSetup.hpp

    r509 r510  
    1313struct ASL;
    1414
     15
     16
    1517namespace Bonmin{
     18 
     19  class SmartAsl : public Ipopt::ReferencedObject{
     20public:
     21    ASL * asl;
     22    SmartAsl():
     23      Ipopt::ReferencedObject(),
     24      asl(NULL)
     25    {}
     26    virtual ~SmartAsl();
     27  };
     28 
    1629  class CouenneSetup : public BabSetupBase{
    1730public:
     
    4457      BabSetupBase::readOptionsFile("couenne.opt");}
    4558private:
    46       ASL * aslfg_;
     59      SmartPtr<SmartAsl> aslfg_;
    4760  };
    4861 
Note: See TracChangeset for help on using the changeset viewer.