113 model_subset: infeasible_subsystem_pb2.ModelSubsetProto, mod:
model.Model
115 """Returns an equivalent `ModelSubset` to the input proto."""
116 if model_subset.quadratic_constraints:
117 raise NotImplementedError(
118 "quadratic_constraints not yet implemented for ModelSubset in Python"
120 if model_subset.second_order_cone_constraints:
121 raise NotImplementedError(
122 "second_order_cone_constraints not yet implemented for ModelSubset in"
125 if model_subset.sos1_constraints:
126 raise NotImplementedError(
127 "sos1_constraints not yet implemented for ModelSubset in Python"
129 if model_subset.sos2_constraints:
130 raise NotImplementedError(
131 "sos2_constraints not yet implemented for ModelSubset in Python"
133 if model_subset.indicator_constraints:
134 raise NotImplementedError(
135 "indicator_constraints not yet implemented for ModelSubset in Python"
139 mod.get_variable(var_id): parse_model_subset_bounds(bounds)
140 for var_id, bounds
in model_subset.variable_bounds.items()
142 variable_integrality=frozenset(
143 mod.get_variable(var_id)
for var_id
in model_subset.variable_integrality
146 mod.get_linear_constraint(con_id): parse_model_subset_bounds(bounds)
147 for con_id, bounds
in model_subset.linear_constraints.items()
152@dataclasses.dataclass(frozen=True)
187 infeasible_system_result: infeasible_subsystem_pb2.ComputeInfeasibleSubsystemResultProto,
189) -> ComputeInfeasibleSubsystemResult:
190 """Returns an equivalent `ComputeInfeasibleSubsystemResult` to the input proto."""
193 infeasible_subsystem=parse_model_subset(
194 infeasible_system_result.infeasible_subsystem, mod
196 is_minimal=infeasible_system_result.is_minimal,