mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 01:18:52 -06:00
Request constraint features/categories in bulk
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import logging
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any, List, Optional, Hashable, TYPE_CHECKING, Dict
|
||||
from typing import Any, List, Hashable, TYPE_CHECKING, Dict
|
||||
|
||||
from miplearn.features import Sample
|
||||
|
||||
@@ -96,11 +96,11 @@ class Instance(ABC):
|
||||
"""
|
||||
return {}
|
||||
|
||||
def get_constraint_features(self, cid: str) -> List[float]:
|
||||
return [0.0]
|
||||
def get_constraint_features(self) -> Dict[str, List[float]]:
|
||||
return {}
|
||||
|
||||
def get_constraint_category(self, cid: str) -> Optional[Hashable]:
|
||||
return cid
|
||||
def get_constraint_categories(self) -> Dict[str, Hashable]:
|
||||
return {}
|
||||
|
||||
def has_static_lazy_constraints(self) -> bool:
|
||||
return False
|
||||
|
||||
@@ -56,14 +56,14 @@ class PickleGzInstance(Instance):
|
||||
return self.instance.get_variable_categories()
|
||||
|
||||
@overrides
|
||||
def get_constraint_features(self, cid: str) -> Optional[List[float]]:
|
||||
def get_constraint_features(self) -> Dict[str, List[float]]:
|
||||
assert self.instance is not None
|
||||
return self.instance.get_constraint_features(cid)
|
||||
return self.instance.get_constraint_features()
|
||||
|
||||
@overrides
|
||||
def get_constraint_category(self, cid: str) -> Optional[Hashable]:
|
||||
def get_constraint_categories(self) -> Dict[str, Hashable]:
|
||||
assert self.instance is not None
|
||||
return self.instance.get_constraint_category(cid)
|
||||
return self.instance.get_constraint_categories()
|
||||
|
||||
@overrides
|
||||
def has_static_lazy_constraints(self) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user