Skip to content
Snippets Groups Projects
Commit a8244198 authored by Thorsten Wißmann's avatar Thorsten Wißmann
Browse files

Some GMLMIP improvements

parent bd573393
Branches
No related tags found
No related merge requests found
......@@ -271,13 +271,14 @@ bool Formula<ModalValueType>::run_solver(glp_prob *problem, glp_iocp* parameters
// Modify glp problem to match node
for(unsigned int i = 0; i < current_node.size(); i++){
if(current_node[i])
if(current_node[i]) {
glp_set_row_bnds(problem, i+1, GLP_LO, 1.0, 0.0); // > 0
//+1 since valuations go zero to 2^(n+m)-1, glpk rows go 1 to 2^(n+m).
else if (strict || static_cast<int>(i) <= index)
} else if (strict || static_cast<int>(i) <= index) {
glp_set_row_bnds(problem, i+1, GLP_UP, 0.0, 0.0); // leq 0
else
} else {
glp_set_row_bnds(problem, i+1, GLP_FR, 0.0, 0.0); // don't care
}
}
if (!strict) {
......
......@@ -33,8 +33,9 @@ int main (int argc, char *argv[]){
// this turns into an endless loop
//bdd b = bdd_and(f->modal(new bdd(f->variable(0)), 4, 0),
// bdd_not(f->modal(new bdd(f->variable(0)), 6, 0)));
bdd b = bdd_or(f->modal(new bdd(f->variable(4)), 4, 0),
bdd_not(f->modal(new bdd(bdd_not(f->variable(7))), 3, 0)));
bdd b = bdd_and(bdd_and(f->modal(new bdd(f->variable(8)), 4, 0),
bdd_not(f->modal(new bdd(bdd_not(f->variable(7))), 3, 0))),
bdd_not(f->modal(new bdd(bdd_not(f->variable(9))), 3, 0)));
f->set_bdd(b);
// bdd_varblockall();
// bdd_reorder(BDD_REORDER_WIN3ITE);
......@@ -62,6 +63,7 @@ int main (int argc, char *argv[]){
cout << vsa.size() << " possible assignments\n";
for (unsigned int i = 0; i < vsa.size(); i++) {
SatisfyingAssignment& sat = vsa[i];
cout << i << ")";
for (int v=0; v < sat.get_size(); v++) {
if (sat.get_array_i(v)==1 && f->has_variable_back(v)) {
cout << " p" << f->variable_back(v) << "=1,";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment