28 cout <<
"constructing LpDataBase" << endl;
36 cout << l <<
" <= " << vname <<
" <= " << r << endl;
45 cout << cname <<
": ";
46 for (LpParser::TermArray::const_iterator it = terms.begin(); it != terms.end(); ++it)
47 cout <<
" + " << it->coef <<
" " << it->var;
48 cout <<
" " << compare <<
" " << constant << endl;
59 for (LpParser::TermArray::const_iterator it = terms.begin(); it != terms.end(); ++it)
60 cout <<
" + " << it->coef <<
" " << it->var;
62 cout <<
"Subject To\n";
70 cout << vname <<
": BINARY\n";
72 cout << vname <<
": INTEGER\n";
77 void test1(
string const& filename)
79 cout <<
"////////////// test1 ////////////////" << endl;
85 void test2(
string const& filename)
87 cout <<
"////////////// test2 ////////////////" << endl;
100 int main(
int argc,
char** argv)
108 cout <<
"at least 1 argument is required" << endl;
Base class for lp database. Only pure virtual functions are defined. User needs to inheritate this cl...
Custom class that inheritates LpParser::LpDataBase with all the required callbacks defined...
bool parse_file(const string &filename)
std::vector< Term > TermArray
array of terms
LpParser::int64_t int64_t
use int64_t in base type
void test2(string const &filename)
test 2: use class wrapper BookshelfParser::Driver
void set_integer(string const &vname, bool binary)
set integer variables
void add_objective(bool minimize, LpParser::TermArray const &terms)
add object terms
void test1(string const &filename)
test 1: use function wrapper BookshelfParser::read
void add_constraint(string const &cname, LpParser::TermArray const &terms, char compare, double constant)
add constraint that terms compare constant.
bool read(LpDataBase &db, const string &lpFile)
API for LpParser. Read LP file and initialize database by calling user-defined callback functions...
int main(int argc, char **argv)
main function
void add_variable(string const &vname, double l, double r)
add variable that l <= vname <= r.