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 _IPCBCSTARTPOINTREADER_H_ 00011 #define _IPCBCSTARTPOINTREADER_H_ 00012 #include <string> 00013 #include <list> 00014 #include <fstream> 00015 #include <iostream> 00016 #include "IpoptInterface.hpp" 00017 00020 class IpCbcStartPointReader 00021 { 00022 public: 00024 IpCbcStartPointReader(std::string fileName = ""): 00025 fileName_(fileName), 00026 primals_(NULL), 00027 duals_(NULL) 00028 {} 00030 IpCbcStartPointReader(const char * fileName): 00031 fileName_(fileName), 00032 primals_(NULL), 00033 duals_(NULL) 00034 {} 00035 00037 bool readFile(); 00039 bool readFile(const std::string &fileName) 00040 { 00041 fileName_=fileName; 00042 return readFile(); 00043 } 00045 bool readAndApply(IpoptInterface& solver); 00046 ~IpCbcStartPointReader() 00047 { 00048 gutsOfDestructor(); 00049 } 00050 00051 00053 void gutsOfDestructor() 00054 { 00055 if(primals_!=NULL) 00056 delete[] primals_; 00057 if(duals_!=NULL) 00058 delete[] duals_; 00059 } 00060 00062 const double * getPrimals() 00063 { 00064 return primals_; 00065 } 00067 const double * getDuals() 00068 { 00069 return duals_; 00070 } 00071 private: 00073 std::string fileName_; 00074 00076 double * primals_; 00078 double * duals_; 00079 }; 00080 #endif /*_IPCBCINITPOINTREADER_H_*/