8 #ifndef LPPARSER_DATABASE_H
9 #define LPPARSER_DATABASE_H
31 using std::ostringstream;
33 typedef unsigned int uint32_t;
43 class IntegerArray :
public vector<int64_t>
49 typedef vector<int64_t> base_type;
50 using base_type::size_type;
51 using base_type::value_type;
52 using base_type::allocator_type;
57 IntegerArray(
const allocator_type& alloc = allocator_type())
63 IntegerArray(size_type n,
const value_type& val,
const allocator_type& alloc = allocator_type())
64 : base_type(n, val, alloc) {}
69 class StringArray :
public vector<string>
73 typedef vector<string> base_type;
74 using base_type::size_type;
75 using base_type::value_type;
76 using base_type::allocator_type;
81 StringArray(
const allocator_type& alloc = allocator_type())
87 StringArray(size_type n,
const value_type& val,
const allocator_type& alloc = allocator_type())
88 : base_type(n, val, alloc) {}
101 Term(
double c,
string const& v) : coef(c), var(v) {}
129 virtual void add_constraint(
string const& cname, TermArray
const& terms,
char compare,
double constant) = 0;
133 virtual void add_objective(
bool minimize, TermArray
const& terms) = 0;
137 virtual void set_integer(
string const& vname,
bool binary) = 0;
virtual void add_constraint(string const &cname, TermArray const &terms, char compare, double constant)=0
add constraint that terms compare constant.
Base class for lp database. Only pure virtual functions are defined. User needs to inheritate this cl...
std::vector< Term > TermArray
array of terms
virtual void set_integer(string const &vname, bool binary)=0
set integer variables
std::vector< std::string > StringArray
string array
virtual void add_objective(bool minimize, TermArray const &terms)=0
add object terms
mathematical utilities such as abs
Term(double c, string const &v)
constructor
std::iterator_traits< Iterator >::value_type max(Iterator first, Iterator last)
get max of an array
double lowest< double >()
specialization for floating point types
virtual void add_variable(string const &vname, double l=limbo::lowest< double >(), double r=std::numeric_limits< double >::max())=0
add variable that l <= vname <= r.
a term denotes coefficient times a variable
std::vector< int64_t > IntegerArray
integer array