summaryrefslogtreecommitdiffhomepage
path: root/ir/lpp
diff options
context:
space:
mode:
authorSebastian Hack <hack@cs.uni-saarland.de>2012-09-13 13:56:41 +0200
committerSebastian Hack <hack@cs.uni-saarland.de>2012-09-13 13:57:04 +0200
commitf8574b88e20c97401a3feff152fc30002e5e2ee8 (patch)
treeb0ae0e5e91699ef77440b987551e9aeb80600c21 /ir/lpp
parent7af4a072cd198f7d10c3f9235d09a3922d8bb793 (diff)
changed the dump format to match the cplex lp format
Diffstat (limited to 'ir/lpp')
-rw-r--r--ir/lpp/lpp.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/ir/lpp/lpp.c b/ir/lpp/lpp.c
index 04732a7..9ac76f4 100644
--- a/ir/lpp/lpp.c
+++ b/ir/lpp/lpp.c
@@ -412,20 +412,35 @@ void lpp_dump_plain(lpp_t *lpp, FILE *f)
{
int i;
+ fprintf(f, lpp->opt_type == lpp_minimize ? "Minimize\n" : "Maximize\n");
for(i = 0; i < lpp->cst_next; ++i) {
lpp_name_t *cst = lpp->csts[i];
+
fprintf(f, "%16s: ", cst->name);
matrix_foreach_in_row(lpp->m, cst->nr, elm) {
lpp_name_t *var = lpp->vars[elm->col];
/* TODO Perhaps better a define LPP_COL_RHS */
if(elm->col > 0)
- fprintf(f, "%+4.1f*%-16s ", elm->val, var->name);
+ fprintf(f, "%+4.1f %-16s ", elm->val, var->name);
+ }
+
+ if (i == 0) {
+ fprintf(f, "\nSubject To\n");
+ continue;
}
fprintf(f, "%3s %+4.1f\n",
lpp_cst_op_to_str(cst->type.cst_type), matrix_get(lpp->m, cst->nr, 0));
}
+
+ fprintf(f, "Binary\n");
+ for(i = 0; i < lpp->var_next; ++i) {
+ lpp_name_t *var = lpp->vars[i];
+ if (var->type.var_type == lpp_binary)
+ fprintf(f, "%16s\n", var->name);
+ }
+ fprintf(f, "End\n");
}
/**