summaryrefslogtreecommitdiff
path: root/impl/Operator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'impl/Operator.hpp')
-rw-r--r--impl/Operator.hpp33
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);