1 #ifndef SOLVER_INSTANCE_DEFS_HH
2 #define SOLVER_INSTANCE_DEFS_HH
3 
4 #include <minizinc/flatten.hh>
5 
6 namespace MiniZinc {
7 
8 template <class Var>
9 class MultipleObjectivesTemplate {
10 public:
11   class Objective {
12   public:
Objective()13     Objective() {}
Objective(Var v,double w)14     Objective(Var v, double w) : _objVar{v}, _weight(w) {}
getVariable() const15     Var getVariable() const { return _objVar; }
getWeight() const16     double getWeight() const { return _weight; }
setVariable(Var vd)17     void setVariable(Var vd) { _objVar = vd; }
setWeight(double w)18     void setWeight(double w) { _weight = w; }
19 
20   private:
21     Var _objVar{};
22     double _weight = 1.0;
23   };
24   using ArrayOfObjectives = std::vector<Objective>;
getObjectives() const25   const ArrayOfObjectives& getObjectives() const { return _objs; }
size() const26   size_t size() const { return _objs.size(); }
add(const Objective & obj)27   void add(const Objective& obj) { _objs.push_back(obj); }
28 
29 private:
30   ArrayOfObjectives _objs;
31 };
32 
33 /// Typical MultipleObjectives
34 using MultipleObjectives = MultipleObjectivesTemplate<Expression*>;
35 
36 }  // namespace MiniZinc
37 
38 #endif  // SOLVER_INSTANCE_DEFS_HH
39