1
0
This repository has been archived on 2025-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
half-reif-benchmarks/include/minizinc/solver_instance_defs.hh
Jip J. Dekker 9b7e65e00b Squashed 'software/minizinc/' content from commit 5a577826
git-subtree-dir: software/minizinc
git-subtree-split: 5a577826da4d7cf6195f28b5604d8d20a01fbc6e
2021-06-18 09:34:50 +10:00

39 lines
970 B
C++

#ifndef SOLVER_INSTANCE_DEFS_HH
#define SOLVER_INSTANCE_DEFS_HH
#include <minizinc/flatten.hh>
namespace MiniZinc {
template <class Var>
class MultipleObjectivesTemplate {
public:
class Objective {
public:
Objective() {}
Objective(Var v, double w) : _objVar{v}, _weight(w) {}
Var getVariable() const { return _objVar; }
double getWeight() const { return _weight; }
void setVariable(Var vd) { _objVar = vd; }
void setWeight(double w) { _weight = w; }
private:
Var _objVar{};
double _weight = 1.0;
};
using ArrayOfObjectives = std::vector<Objective>;
const ArrayOfObjectives& getObjectives() const { return _objs; }
size_t size() const { return _objs.size(); }
void add(const Objective& obj) { _objs.push_back(obj); }
private:
ArrayOfObjectives _objs;
};
/// Typical MultipleObjectives
using MultipleObjectives = MultipleObjectivesTemplate<Expression*>;
} // namespace MiniZinc
#endif // SOLVER_INSTANCE_DEFS_HH