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 _BONSTARTPOINTREADER_H_ 00011 #define _BONSTARTPOINTREADER_H_ 00012 #include <string> 00013 #include <list> 00014 #include <fstream> 00015 #include <iostream> 00016 #include "BonOsiTMINLPInterface.hpp" 00017 00018 00019 00020 namespace Bonmin { 00023 class StartPointReader 00024 { 00025 public: 00027 StartPointReader(std::string fileName = ""): 00028 fileName_(fileName), 00029 primals_(NULL), 00030 duals_(NULL) 00031 {} 00033 StartPointReader(const char * fileName): 00034 fileName_(fileName), 00035 primals_(NULL), 00036 duals_(NULL) 00037 {} 00038 00040 bool readFile(); 00042 bool readFile(const std::string &fileName) 00043 { 00044 fileName_=fileName; 00045 return readFile(); 00046 } 00048 bool readAndApply(OsiTMINLPInterface * solver); 00049 ~StartPointReader() 00050 { 00051 gutsOfDestructor(); 00052 } 00053 00054 00056 void gutsOfDestructor() 00057 { 00058 if(primals_!=NULL) 00059 delete[] primals_; 00060 if(duals_!=NULL) 00061 delete[] duals_; 00062 } 00063 00065 const double * getPrimals() 00066 { 00067 return primals_; 00068 } 00070 const double * getDuals() 00071 { 00072 return duals_; 00073 } 00074 private: 00076 std::string fileName_; 00077 00079 double * primals_; 00081 double * duals_; 00082 }; 00083 00084 } 00085 #endif /*_IPCBCINITPOINTREADER_H_*/