InternalSolver: Better specify and test infeasibility

This commit is contained in:
2021-01-21 09:15:14 -06:00
parent 05497cab07
commit 6890840c6d
9 changed files with 134 additions and 65 deletions

View File

@@ -10,6 +10,7 @@ from typing import Any, List
import numpy as np
from miplearn.types import TrainingSample
import pyomo.environ as pe
class Instance(ABC):
@@ -30,7 +31,7 @@ class Instance(ABC):
@abstractmethod
def to_model(self) -> Any:
"""
Returns a concrete Pyomo model corresponding to this instance.
Returns the optimization model corresponding to this instance.
"""
pass
@@ -163,3 +164,12 @@ class Instance(ABC):
data = json.dumps(self.__dict__, indent=2).encode("utf-8")
with gzip.GzipFile(filename, "w") as f:
f.write(data)
class PyomoInstance(Instance, ABC):
@abstractmethod
def to_model(self) -> pe.ConcreteModel:
"""
Returns the concrete Pyomo model corresponding to this instance.
"""
pass