ConstraintFeatures: Store lhs and sense

This commit is contained in:
2021-03-02 18:14:07 -06:00
parent 3a60deac63
commit b6ea0c5f1b
6 changed files with 61 additions and 14 deletions

View File

@@ -4,7 +4,7 @@
import logging
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional
from typing import Any, Dict, List, Optional, Tuple
from miplearn.instance import Instance
from miplearn.types import (
@@ -162,6 +162,17 @@ class InternalSolver(ABC):
"""
pass
@abstractmethod
def get_constraint_lhs(self, cid: str) -> Dict[str, float]:
"""
Returns a list of tuples encoding the left-hand side of the constraint.
The first element of the tuple is the name of the variable and the second
element is the coefficient. For example, the left-hand side of "2 x1 + x2 <= 3"
is encoded as [{"x1": 2, "x2": 1}].
"""
pass
@abstractmethod
def add_constraint(self, cobj: Constraint) -> None:
"""