Skip to content

Commit 0ebf32a

Browse files
committed
highs: add messages to NotImplementedError
1 parent 7403f8f commit 0ebf32a

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

mip/highs.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,17 @@ def add_constr(self: "SolverHighs", lin_expr: "mip.LinExpr", name: str = ""):
333333
self._cons_col[name] = row
334334

335335
def add_lazy_constr(self: "SolverHighs", lin_expr: "mip.LinExpr"):
336-
raise NotImplementedError()
336+
raise NotImplementedError("HiGHS doesn't support lazy constraints!")
337337

338338
def add_sos(
339339
self: "SolverHighs",
340340
sos: List[Tuple["mip.Var", numbers.Real]],
341341
sos_type: int,
342342
):
343-
raise NotImplementedError()
343+
raise NotImplementedError("HiGHS doesn't support SOS!")
344344

345345
def add_cut(self: "SolverHighs", lin_expr: "mip.LinExpr"):
346-
raise NotImplementedError()
346+
raise NotImplementedError("HiGHS doesn't support cut callbacks!")
347347

348348
def get_objective_bound(self: "SolverHighs") -> numbers.Real:
349349
return self._get_double_info_value("mip_dual_bound")
@@ -420,10 +420,10 @@ def generate_cuts(
420420
max_cuts: int = mip.INT_MAX,
421421
min_viol: numbers.Real = 1e-4,
422422
) -> "mip.CutPool":
423-
raise NotImplementedError()
423+
raise NotImplementedError("HiGHS doesn't support manual cut generation.")
424424

425425
def clique_merge(self, constrs: Optional[List["mip.Constr"]] = None):
426-
raise NotImplementedError()
426+
raise NotImplementedError("HiGHS doesn't support clique merging!")
427427

428428
def optimize(
429429
self: "SolverHighs",
@@ -442,7 +442,6 @@ def optimize(
442442
mip.OptimizationStatus.OPTIMAL,
443443
mip.OptimizationStatus.FEASIBLE,
444444
):
445-
# TODO: also handle primal/dual rays?
446445
n, m = self.num_cols(), self.num_rows()
447446
col_value = ffi.new("double[]", n)
448447
col_dual = ffi.new("double[]", n)
@@ -473,10 +472,10 @@ def get_objective_value(self: "SolverHighs") -> numbers.Real:
473472
def get_log(
474473
self: "SolverHighs",
475474
) -> List[Tuple[numbers.Real, Tuple[numbers.Real, numbers.Real]]]:
476-
raise NotImplementedError()
475+
raise NotImplementedError("HiGHS doesn't give access to a progress log.")
477476

478477
def get_objective_value_i(self: "SolverHighs", i: int) -> numbers.Real:
479-
raise NotImplementedError()
478+
raise NotImplementedError("HiGHS doesn't store multiple solutions.")
480479

481480
def get_num_solutions(self: "SolverHighs") -> int:
482481
# Multiple solutions are not supported (through C API?).
@@ -499,7 +498,7 @@ def set_objective_sense(self: "SolverHighs", sense: str):
499498
check(self._lib.Highs_changeObjectiveSense(self._model, sense_map[sense]))
500499

501500
def set_start(self: "SolverHighs", start: List[Tuple["mip.Var", numbers.Real]]):
502-
raise NotImplementedError()
501+
raise NotImplementedError("HiGHS doesn't support a start solution.")
503502

504503
def set_objective(self: "SolverHighs", lin_expr: "mip.LinExpr", sense: str = ""):
505504
# set coefficients
@@ -545,10 +544,10 @@ def set_max_solutions(self: "SolverHighs", max_solutions: int):
545544
self._get_int_option_value("mip_max_improving_sols", max_solutions)
546545

547546
def get_pump_passes(self: "SolverHighs") -> int:
548-
raise NotImplementedError()
547+
raise NotImplementedError("HiGHS doesn't support pump passes.")
549548

550549
def set_pump_passes(self: "SolverHighs", passes: int):
551-
raise NotImplementedError()
550+
raise NotImplementedError("HiGHS doesn't support pump passes.")
552551

553552
def get_max_nodes(self: "SolverHighs") -> int:
554553
return self._get_int_option_value("mip_max_nodes")
@@ -584,10 +583,10 @@ def num_int(self: "SolverHighs") -> int:
584583
return sum(vt != mip.CONTINUOUS for vt in self._var_type)
585584

586585
def get_emphasis(self: "SolverHighs") -> mip.SearchEmphasis:
587-
raise NotImplementedError()
586+
raise NotImplementedError("HiGHS doesn't support search emphasis.")
588587

589588
def set_emphasis(self: "SolverHighs", emph: mip.SearchEmphasis):
590-
raise NotImplementedError()
589+
raise NotImplementedError("HiGHS doesn't support search emphasis.")
591590

592591
def get_cutoff(self: "SolverHighs") -> numbers.Real:
593592
return self._get_double_option_value("objective_bound")
@@ -908,7 +907,7 @@ def var_get_x(self: "SolverHighs", var: "mip.Var") -> numbers.Real:
908907
return self._x[var.idx]
909908

910909
def var_get_xi(self: "SolverHighs", var: "mip.Var", i: int) -> numbers.Real:
911-
raise NotImplementedError()
910+
raise NotImplementedError("HiGHS doesn't store multiple solutions.")
912911

913912
def var_get_name(self: "SolverHighs", idx: int) -> str:
914913
return self._var_name[idx]
@@ -971,7 +970,7 @@ def get_status(self: "SolverHighs") -> mip.OptimizationStatus:
971970

972971
def cgraph_density(self: "SolverHighs") -> float:
973972
"""Density of the conflict graph"""
974-
raise NotImplementedError()
973+
raise NotImplementedError("HiGHS doesn't support conflict graph.")
975974

976975
def conflicting(
977976
self: "SolverHighs",
@@ -980,18 +979,18 @@ def conflicting(
980979
) -> bool:
981980
"""Checks if two assignment to binary variables are in conflict,
982981
returns none if no conflict graph is available"""
983-
raise NotImplementedError()
982+
raise NotImplementedError("HiGHS doesn't support conflict graph.")
984983

985984
def conflicting_nodes(
986985
self: "SolverHighs", v1: Union["mip.Var", "mip.LinExpr"]
987986
) -> Tuple[List["mip.Var"], List["mip.Var"]]:
988987
"""Returns all assignment conflicting with the assignment in v1 in the
989988
conflict graph.
990989
"""
991-
raise NotImplementedError()
990+
raise NotImplementedError("HiGHS doesn't support conflict graph.")
992991

993992
def feature_values(self: "SolverHighs") -> List[float]:
994-
raise NotImplementedError()
993+
raise NotImplementedError("HiGHS doesn't support feature extraction.")
995994

996995
def feature_names(self: "SolverHighs") -> List[str]:
997-
raise NotImplementedError()
996+
raise NotImplementedError("HiGHS doesn't support feature extraction.")

0 commit comments

Comments
 (0)