Bonmin 1.8.9
Loading...
Searching...
No Matches
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>
19#include "BonTypes.hpp"
20
21namespace Bonmin{
25{
26public:
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 }
51private:
53 std::string file_;
54
56 std::string suffix_;
57
60};
61}
62#endif
A class for reading a .col or .row file containing name for variables and constraints (usually ampl g...
SolReader(const std::string &fileName="", const std::string &suffix=".col")
Constructor with a file name given by a string and also default (empty string)
const double * x()
bool readFile()
Reads the .sol file.
bool readFile(const std::string &file)
Reads the .sol file fileName.
void copySol(double *x)
Copy the names to Names.
SolReader(const char *fileName, const char *suffix)
Constructor with a file name given by a const char *.
void set_n_cols(int n)
Set the number of variables in the problem.
A small wrap around std::vector to give easy access to array for interfacing with fortran code.
Definition BonTypes.hpp:9
(C) Copyright International Business Machines Corporation 2007