/home/coin/SVN-release/OS-1.1.1/Bonmin/src/Interfaces/BonTMINLP.cpp

Go to the documentation of this file.
00001 // (C) Copyright International Business Machines (IBM) 2005, 2007
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // Authors :
00006 // Pierre Bonami, IBM
00007 //
00008 // Date : 26/09/2006
00009 
00010 #include "BonTMINLP.hpp"
00011 #include "IpBlas.hpp"
00012 
00013 namespace Bonmin{
00014 
00016 TMINLP::SosInfo::SosInfo():
00017         num(0), 
00018         types(NULL), 
00019         priorities(NULL), 
00020         numNz(0), 
00021         starts(NULL),
00022         indices(NULL), 
00023         weights(NULL)
00024 {}
00025 
00027 TMINLP::SosInfo::SosInfo(const SosInfo & source):
00028         num(source.num), 
00029         types(NULL), 
00030         priorities(NULL), 
00031         numNz(source.numNz), 
00032         starts(NULL),
00033         indices(NULL),
00034         weights(NULL)
00035 {
00036 
00037   if(num > 0) {
00038     assert(source.types!=NULL);
00039     assert(source.priorities!=NULL);
00040     assert(source.starts!=NULL);
00041     assert(source.indices!=NULL);
00042     assert(source.weights!=NULL);
00043     types = new char[num];
00044     priorities = new int[num];
00045     starts = new int[num + 1];
00046     indices = new int[numNz];
00047     weights = new double[numNz];
00048     for(int i = 0 ; i < num ; i++) {
00049       source.types[i] = types[i];
00050       source.priorities[i] = priorities[i];
00051       source.starts[i] = starts[i];
00052     }
00053     for(int i = 0 ; i < numNz ; i++) {
00054       source.indices[i] = indices[i];
00055       source.weights[i] = weights[i];
00056     }
00057   }
00058   else {
00059     assert(source.types==NULL);
00060     assert(source.priorities==NULL);
00061     assert(source.starts==NULL);
00062     assert(source.indices==NULL);
00063     assert(source.weights==NULL);
00064   }
00065 
00066 }
00067 
00068 
00070 void 
00071 TMINLP::SosInfo::gutsOfDestructor()
00072 {
00073   num = 0;
00074   numNz = 0;
00075   if(types) delete [] types;
00076   types = NULL;
00077   if(starts) delete [] starts;
00078   starts = NULL;
00079   if(indices) delete [] indices;
00080   indices = NULL;
00081   if(priorities) delete [] priorities;
00082   priorities = NULL;
00083   if(weights) delete [] weights;
00084   weights = NULL;
00085 }
00086 
00087 
00088 void TMINLP::PerturbInfo::SetPerturbationArray(Index numvars, const double* perturb_radius) {
00089   delete [] perturb_radius_;
00090   if (perturb_radius) {
00091     perturb_radius_ = new double[numvars];
00092     for(int i=0; i<numvars; i++) {
00093       perturb_radius_[i] = perturb_radius[i];
00094     }
00095   }
00096 }
00097 
00098 TMINLP::TMINLP()
00099 {}
00100 
00101 TMINLP::TMINLP(const TMINLP & source)
00102 {
00103 }
00104      
00106 TMINLP::~TMINLP()
00107 {
00108 }
00109 
00110 
00111 }

Generated on Tue Sep 30 03:01:23 2008 by  doxygen 1.4.7