diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-08-07 17:56:43 +1000 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-08-07 17:56:43 +1000 |
commit | 59fb7d23578c4da14f9c14cc413090b1af13328c (patch) | |
tree | 42d187c4b182a025578377f77d1c5e369751b5b3 /impl/Operator.hpp | |
parent | c26f38114fedde81effb938ffbedfe922d77a322 (diff) |
Merge complete! Get onto the right branch.
Diffstat (limited to 'impl/Operator.hpp')
-rw-r--r-- | impl/Operator.hpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/impl/Operator.hpp b/impl/Operator.hpp index 49507c4..0c6e9df 100644 --- a/impl/Operator.hpp +++ b/impl/Operator.hpp @@ -124,16 +124,45 @@ struct Comma : public Operator<Domain> { template<typename Domain> struct Guard : public Operator<Domain> { virtual Domain eval(const std::vector<Domain>& arguments) const { + Domain result = arguments[2]; if (arguments[0] < arguments[1]) { - return -infinity<Domain>(); + result = -infinity<Domain>(); } - return arguments[2]; + log::operators << "Guard: " + << arguments[0] << " >= " << arguments[1] + << " ? " << arguments[2] + << " -> " << result << std::endl; + return result; } void print(std::ostream& cout) const { cout << "guard"; } }; +/*#include "TemplateConstraintMatrix.hpp" + +template<typename Domain> +struct MinimumCostFlow : public Operator<Domain> { + MinimumCostFlow() { + } + Domain solve(const Domain& d) const { + + } + virtual Domain eval(const std::vector<Domain>& arguments) const { + if (arguments.size() != 1) + throw "Incorrect number of arguments."; + return solve(arguments[0]); + } + void print(std::ostream& cout) const { + cout << "minCostFlow"; + } +private: + TemplateConstraintMatrix& constraint; // T + std::vector<Domain> guard; // c + std::vector<std::vector<Domain>> multiplication; //A + unsigned int row; +};*/ + template<typename T> std::ostream& operator<<(std::ostream& cout, const Operator<T>& op) { op.print(cout); |