Bonmin
1.7
|
00001 // (C) Copyright Carnegie Mellon University 2005 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // Authors : 00006 // Pierre Bonami, Carnegie Mellon University, 00007 // 00008 // Date : 26/05/2005 00009 00010 #ifndef BoundsReader_HPP 00011 #define BoundsReader_HPP 00012 00013 #include <string> 00014 #include "BonOsiTMINLPInterface.hpp" 00015 00016 00017 namespace Bonmin { 00020 class BoundsReader 00021 { 00022 public: 00023 //Default constructor 00024 BoundsReader(): 00025 fileName_(), 00026 lowerBounds_(NULL), 00027 upperBounds_(NULL), 00028 nLower_(0), 00029 nUpper_(0) 00030 {} 00031 00032 // Constructor with name of the file to read passed. 00033 BoundsReader(const std::string &fileName): 00034 fileName_(fileName), 00035 lowerBounds_(NULL), 00036 upperBounds_(NULL), 00037 indexLowers_(NULL), 00038 indexUppers_(NULL), 00039 nLower_(0), 00040 nUpper_(0) 00041 {} 00042 00043 // Set the name of the file to read. 00044 void setFileName(const std::string &fileName) 00045 { 00046 fileName_ = fileName; 00047 } 00048 00049 // Destructor 00050 ~BoundsReader(); 00051 00052 // Cleanup allocated data 00053 void gutsOfDestructor(); 00054 00055 00056 // Read the file with given fileName 00057 void read(const std::string &); 00058 00059 //Read the file named fileName_ 00060 void read(); 00061 00062 //Read fileName_ and apply the bounds read to solver 00063 void readAndApply(OsiTMINLPInterface * solver); 00064 private: 00065 00067 std::string fileName_; 00069 double * lowerBounds_; 00071 double * upperBounds_; 00073 int * indexLowers_; 00075 int * indexUppers_; 00077 int nLower_; 00079 int nUpper_; 00080 }; 00081 } 00082 #endif