76 next_free_id_ = other.next_free_id_;
77 id_to_name_ = other.id_to_name_;
78 if (!other.nonempty_name_to_id_.has_value()) {
79 nonempty_name_to_id_ = std::nullopt;
81 nonempty_name_to_id_.emplace();
82 for (
const auto& [
id,
name] : id_to_name_) {
84 const auto [it, success] =
85 nonempty_name_to_id_->insert({absl::string_view(
name),
id});
120 : variables(check_names),
121 auxiliary_objectives(check_names),
122 linear_constraints(check_names),
123 quadratic_constraints(check_names),
124 second_order_cone_constraints(check_names),
125 sos1_constraints(check_names),
126 sos2_constraints(check_names),
127 indicator_constraints(check_names) {}
130 const bool check_names) {
134 model.variables().names()))
135 <<
"ModelProto.variables are invalid";
138 <<
"ModelProto.auxiliary_objectives are invalid";
140 const std::string& objective_name =
model.objective().name();
143 <<
"duplicate objective name: " << objective_name;
148 {},
model.linear_constraints().ids(),
model.linear_constraints().names()))
149 <<
"ModelProto.linear_constraints are invalid";
152 <<
"ModelProto.quadratic_constraints are invalid";
154 {},
model.second_order_cone_constraints(),
156 <<
"ModelProto.second_order_cone_constraints are invalid";
159 <<
"ModelProto.sos1_constraints are invalid";
162 <<
"ModelProto.sos2_constraints are invalid";
165 <<
"ModelProto.indicator_constraints are invalid";
170 if (model_update.objective_updates().has_direction_update()) {
171 maximize = model_update.objective_updates().direction_update();
174 model_update.new_variables().ids(),
175 model_update.new_variables().names()))
176 <<
"invalid variables";
178 model_update.auxiliary_objectives_updates().deleted_objective_ids(),
179 model_update.auxiliary_objectives_updates().new_objectives(),
181 <<
"invalid auxiliary objectives";
187 model_update.deleted_linear_constraint_ids(),
188 model_update.new_linear_constraints().ids(),
189 model_update.new_linear_constraints().names()))
190 <<
"invalid linear constraints";
192 model_update.quadratic_constraint_updates().deleted_constraint_ids(),
193 model_update.quadratic_constraint_updates().new_constraints(),
195 <<
"invalid quadratic constraints";
197 model_update.second_order_cone_constraint_updates()
198 .deleted_constraint_ids(),
199 model_update.second_order_cone_constraint_updates().new_constraints(),
201 <<
"invalid second-order cone constraints";
203 model_update.sos1_constraint_updates().deleted_constraint_ids(),
204 model_update.sos1_constraint_updates().new_constraints(),
206 <<
"invalid sos1 constraints";
208 model_update.sos2_constraint_updates().deleted_constraint_ids(),
209 model_update.sos2_constraint_updates().new_constraints(),
211 <<
"invalid sos2 constraints";
213 model_update.indicator_constraint_updates().deleted_constraint_ids(),
214 model_update.indicator_constraint_updates().new_constraints(),
216 <<
"invalid indicator constraints";
217 return absl::OkStatus();