diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-01-05 08:28:14 -0500 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-02-12 06:55:16 -0500 |
| commit | de2e2536976faecc0a90d1276c9a02789bd479cc (patch) | |
| tree | ad962cf80fcdddb74b47247dc4e81e7000ae9648 /native/src | |
| parent | 299ad40e3f0ae8fe2a8436371cce7edd22d98b8c (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.cpp | 15 |
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 | ||
| 25 | std::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 | |||
| 25 | void dump_lp_solution( | 40 | void dump_lp_solution( |
| 26 | VarMapper& vars, | 41 | VarMapper& vars, |
| 27 | const ResourceSharingInfo& info, | 42 | const ResourceSharingInfo& info, |
