aboutsummaryrefslogtreecommitdiffstats
path: root/native/src
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-01-05 08:28:14 -0500
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-02-12 06:55:16 -0500
commitde2e2536976faecc0a90d1276c9a02789bd479cc (patch)
treead962cf80fcdddb74b47247dc4e81e7000ae9648 /native/src
parent299ad40e3f0ae8fe2a8436371cce7edd22d98b8c (diff)
Add support for dumping LPs to iostreams
Quite handy when debugging LPs...
Diffstat (limited to 'native/src')
-rw-r--r--native/src/linprog/io.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/native/src/linprog/io.cpp b/native/src/linprog/io.cpp
index 14eeca5..801e833 100644
--- a/native/src/linprog/io.cpp
+++ b/native/src/linprog/io.cpp
@@ -22,6 +22,21 @@ std::ostream& operator<<(std::ostream &os, const LinearExpression &exp)
22 return os; 22 return os;
23} 23}
24 24
25std::ostream& operator<<(std::ostream &os, const LinearProgram &lp)
26{
27 os << "maximize " << *lp.get_objective() << " subject to:" << std::endl;
28 foreach (lp.get_equalities(), it)
29 {
30 os << *(it->first) << " = " << it->second << std::endl;
31 }
32 foreach (lp.get_inequalities(), it)
33 {
34 os << *(it->first) << " <= " << it->second << std::endl;
35 }
36
37 return os;
38}
39
25void dump_lp_solution( 40void dump_lp_solution(
26 VarMapper& vars, 41 VarMapper& vars,
27 const ResourceSharingInfo& info, 42 const ResourceSharingInfo& info,