Bonmin  1.8.8
BonSolReader.hpp
Go to the documentation of this file.
1 // (C) Copyright CNRS 2011
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors :
6 // Pierre Bonami, LIF, CNRS,
7 //
8 // Date : 03/01/2011
9 
10 #ifndef SolReader_HPP
11 #define SolReader_HPP
12 #include <string>
13 #include <vector>
14 #include <list>
15 #include <fstream>
16 #include <iostream>
17 #include <CoinHelperFunctions.hpp>
18 #include "OsiSolverInterface.hpp"
19 #include "BonTypes.hpp"
20 
21 namespace Bonmin{
24 class SolReader
25 {
26 public:
28  SolReader(const char * fileName, const char * suffix);
30  SolReader(const std::string & fileName="", const std::string& suffix=".col");
32  bool readFile();
34  bool readFile(const std::string &file)
35  {
36  file_=file;
37  return readFile();
38  }
39 
41  void copySol(double * x);
42 
43  const double * x(){
44  return x_();
45  }
46 
48  void set_n_cols(int n){
49  x_.resize(n);
50  }
51 private:
53  std::string file_;
54 
56  std::string suffix_;
57 
60 };
61 }
62 #endif
void set_n_cols(int n)
Set the number of variables in the problem.
const double * x()
std::string suffix_
Suffix of the file (&quot;.col&quot;, &quot;.row&quot;)
void copySol(double *x)
Copy the names to Names.
std::string file_
Name of the file to read.
A class for reading a .col or .row file containing name for variables and constraints (usually ampl g...
bool readFile(const std::string &file)
Reads the .sol file fileName.
bool readFile()
Reads the .sol file.
SolReader(const char *fileName, const char *suffix)
Constructor with a file name given by a const char *.
vector< double > x_
Sol values.