Bonmin  1.7
BonSolReader.hpp
Go to the documentation of this file.
00001 // (C) Copyright CNRS 2011
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // Authors :
00006 // Pierre Bonami, LIF, CNRS,
00007 //
00008 // Date : 03/01/2011
00009 
00010 #ifndef SolReader_HPP
00011 #define SolReader_HPP
00012 #include <string>
00013 #include <vector>
00014 #include <list>
00015 #include <fstream>
00016 #include <iostream>
00017 #include <CoinHelperFunctions.hpp>
00018 #include "OsiSolverInterface.hpp"
00019 #include "BonTypes.hpp"
00020 
00021 namespace Bonmin{
00024 class SolReader
00025 {
00026 public:
00028   SolReader(const char * fileName, const char * suffix);
00030   SolReader(const std::string & fileName="", const std::string& suffix=".col");
00032   bool readFile();
00034   bool readFile(const std::string &file)
00035   {
00036     file_=file;
00037     return readFile();
00038   }
00039 
00041   void copySol(double * x);
00042 
00043   const double * x(){
00044     return x_();
00045   }
00046 
00048   void set_n_cols(int n){
00049     x_.resize(n);
00050   }
00051 private:
00053   std::string file_;
00054 
00056   std::string suffix_;
00057 
00059  vector<double> x_;
00060 };
00061 }
00062 #endif