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.
on-restart-benchmarks/include/minizinc/solver_instance_defs.hh
Jip J. Dekker fad1b07018 Squashed 'software/minizinc/' content from commit 4f10c8205
git-subtree-dir: software/minizinc
git-subtree-split: 4f10c82056ffcb1041d7ffef29d77a7eef92cf76
2021-06-16 14:06:46 +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