diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-11-26 14:00:10 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-11-26 14:00:10 +1100 |
commit | 7ad1aed1a3ba88e2c40c82da05b9bf35eedc4096 (patch) | |
tree | c85fd1eac0a0be0b10a7892a1ec81fe8d07f6c56 /clang/include | |
parent | f823ccc928ae09a63ffef5b6cfe47966e2da1890 (diff) | |
parent | 7210673084d691b0c125a5bda3c868438c19eff1 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/include')
-rw-r--r-- | clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp b/clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp index 0b08866..8dbdc39 100644 --- a/clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp +++ b/clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp @@ -171,14 +171,19 @@ struct MinCostFlow : public Operator<Domain> { _solver.ChgCost(i, costs[i].template as<MCFClass::CNumber>()); } _solver.SolveMCF(); - if (_solver.MCFGetStatus() == MCFClass::kUnfeasible){ + if (_solver.MCFGetStatus() != MCFClass::kOK) { return -infinity<Domain>(); - } else if (_solver.MCFGetFO() == MCFClass::Inf<MCFClass::FONumber>()) { - return infinity<Domain>(); - } else if (_solver.MCFGetFO() == -MCFClass::Inf<MCFClass::FONumber>()) { - return -infinity<Domain>(); } else { - return _solver.MCFGetFO(); + MCFClass::FONumber num = _solver.MCFGetFO(); + if (num == MCFClass::Inf<MCFClass::FONumber>()) { + return infinity<Domain>(); + } else if (num == -MCFClass::Inf<MCFClass::FONumber>()) { + return -infinity<Domain>(); + } else { + if (((int)num) == -2147483648) + return -infinity<Domain>(); + return num; + } } } void print(std::ostream& cout) const { @@ -217,30 +222,6 @@ private: mutable MCFSimplex _solver; }; -/*#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); |