48 string obj_name(name);
49 if (name_to_no_.count(obj_name) != 0)
50 throw std::runtime_error(
"Name of objective already encountered: " + obj_name);
51 name_to_no_.emplace(obj_name,
getNoObjs());
52 name_to_nonzero_coeffs_.emplace(obj_name, vector<SCIP_VAR*>{});
53 no_to_name_.push_back(obj_name);
66 if (var_to_coeffs_.count(var) == 0)
68 auto obj_no = name_to_no_.at(obj_name);
69 var_to_coeffs_[var].at(obj_no) = val;
70 name_to_nonzero_coeffs_.at(obj_name).push_back(var);
73 std::cout <<
"addObjCoeff with zero value\n";
84 if (var_to_coeffs_.count(var))
85 return (var_to_coeffs_[var]).at(non_ignored_objs_.at(obj));
96 auto obj_name = no_to_name_.at(non_ignored_objs_.at(obj));
97 return name_to_nonzero_coeffs_.at(obj_name).size();
110 assert (weight.size() == non_ignored_objs_.size());
111 if (var_to_coeffs_.count(var)) {
112 auto& coeffs = var_to_coeffs_[var];
113 return std::inner_product(begin(weight),
115 begin(non_ignored_objs_),
117 std::plus<ValueType>(),
118 [&coeffs](
ValueType w,
size_t obj){
return w*coeffs[obj];});
131 auto obj_name = no_to_name_.at(non_ignored_objs_.at(obj));
132 return name_to_nonzero_coeffs_.at(obj_name);
145 if (var_to_coeffs_.count(var))
146 return var_to_coeffs_[var].at(non_ignored_objs_.at(obj)) * sol_val;
156 for (
auto it=begin(var_to_coeffs_); it!=end(var_to_coeffs_); ++it) {
157 std::transform(begin(it->second), end(it->second),
158 begin(it->second), std::negate<ValueType>());
168 auto obj_ind_1 = non_ignored_objs_.at(obj_1);
169 auto obj_ind_2 = non_ignored_objs_.at(obj_2);
170 auto it = std::find(begin(non_ignored_objs_), end(non_ignored_objs_), obj_ind_1);
171 assert (it != end(non_ignored_objs_));
172 non_ignored_objs_.erase(it);
173 it = std::find(begin(non_ignored_objs_), end(non_ignored_objs_), obj_ind_2);
174 assert (it != end(non_ignored_objs_));
175 non_ignored_objs_.erase(it);
176 ignored_obj_.push(obj_ind_1);
177 ignored_obj_.push(obj_ind_2);
184 auto obj = ignored_obj_.top();
186 non_ignored_objs_.push_back(obj);
187 obj = ignored_obj_.top();
189 non_ignored_objs_.push_back(obj);
190 std::sort(begin(non_ignored_objs_), end(non_ignored_objs_));
std::vector< ValueType > WeightType
Type for weight vectors.
Class storing multiple objectives of given problem instance.
SCIP_Real ValueType
Type for computed values.
void addObjCoeff(SCIP_VAR *var, const char *obj_name, polyscip::ValueType val)
polyscip::ValueType getObjVal(SCIP_VAR *var, std::size_t obj_no, polyscip::ValueType sol_val)
void addObjName(const char *name)
General types used for PolySCIP.
std::vector< ValueType > OutcomeType
Type for points, rays in objective space.
std::vector< SCIP_VAR * > getNonZeroCoeffVars(std::size_t obj_no) const
std::size_t getNumberNonzeroCoeffs(std::size_t obj_no) const
C++ wrapper classes for SCIP.
void ignoreObjectives(std::size_t obj_1, std::size_t obj_2)
polyscip::ValueType getObjCoeff(SCIP_VAR *var, std::size_t obj_no)
polyscip::ValueType getWeightedObjVal(SCIP_VAR *var, const polyscip::WeightType &weight)
std::size_t getNoObjs() const
void unignoreObjectives()