/home/coin/SVN-release/OS-2.1.1/Bonmin/src/Interfaces/BonAuxInfos.cpp

Go to the documentation of this file.
00001 // (C) Copyright International Business Machines Corporation 2007
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // Authors :
00006 // Pierre Bonami, International Business Machines Corporation
00007 //
00008 // Date : 04/23/2007
00009 
00010 #include "BonAuxInfos.hpp"
00011 #include "CoinHelperFunctions.hpp"
00012 
00013 namespace Bonmin
00014 {
00016   AuxInfo::AuxInfo(int type):
00017       OsiBabSolver(type),
00018       infeasibleNode_(false),
00019       objValue_ (COIN_DBL_MAX),
00020       nlpSolution_(NULL),
00021       numcols_(0),
00022       hasNlpSolution_(false),
00023       bestSolution2_(make_referenced(std::vector<double>())),
00024       bestObj2_(make_referenced(COIN_DBL_MAX))
00025   {}
00026 
00028   AuxInfo::AuxInfo(const OsiBabSolver &other):
00029       OsiBabSolver(other),
00030       infeasibleNode_(false),
00031       objValue_ (COIN_DBL_MAX),
00032       nlpSolution_(NULL),
00033       numcols_(0),
00034       hasNlpSolution_(false),
00035       bestSolution2_(make_referenced(std::vector<double>())),
00036       bestObj2_(make_referenced(COIN_DBL_MAX))
00037   {}
00038 
00040   AuxInfo::AuxInfo(const AuxInfo &other):
00041       OsiBabSolver(other),
00042       infeasibleNode_(other.infeasibleNode_),
00043       objValue_ (other.objValue_),
00044       nlpSolution_(NULL),
00045       numcols_(other.numcols_),
00046       hasNlpSolution_(other.hasNlpSolution_),
00047       bestSolution2_(other.bestSolution2_),
00048       bestObj2_(other.bestObj2_)
00049   {
00050     if (other.nlpSolution_!=NULL) {
00051       assert(numcols_ > 0);
00052       nlpSolution_ = new double[numcols_ + 1];
00053       CoinCopyN(other.nlpSolution_, numcols_+1, nlpSolution_);
00054     }
00055   }
00056 
00058   AuxInfo::~AuxInfo()
00059   {
00060     if (nlpSolution_ != NULL)
00061       delete [] nlpSolution_;
00062   }
00063 
00065   OsiAuxInfo *
00066   AuxInfo::clone() const
00067   {
00068     return new AuxInfo(*this);
00069   }
00070 
00072   void
00073   AuxInfo::setNlpSolution(const double * sol, int numcols, double objValue)
00074   {
00075     if (numcols_ < numcols) {
00076       delete [] nlpSolution_;
00077       nlpSolution_ = NULL;
00078     }
00079     if (nlpSolution_ == NULL) {
00080       nlpSolution_ = new double[numcols + 1];
00081       numcols_ = numcols;
00082     }
00083     CoinCopyN(sol,  numcols, nlpSolution_);
00084     nlpSolution_[numcols] = objValue;
00085     objValue_ = objValue;
00086   }
00087 
00088 }/* end namespace Bonmin*/
00089 

Generated on Mon May 3 03:05:16 2010 by  doxygen 1.4.7