Skip to content

Commit 379ab61

Browse files
committed
update highs and jsquery
1 parent 0cec581 commit 379ab61

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

docs/python-mip_theme/static/lib/jquery/jquery.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mip/highs.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,21 @@
3030
# need library matching operating system
3131
platform = sys.platform.lower()
3232
if "linux" in platform:
33-
pattern = "highs_bindings.*.so"
33+
patterns = ["highs_bindings.*.so", "_core.*.so"]
3434
elif platform.startswith("win"):
35-
pattern = "highs_bindings.*.pyd"
35+
patterns = ["highs_bindings.*.pyd", "_core.*.pyd"]
3636
elif any(platform.startswith(p) for p in ("darwin", "macos")):
37-
pattern = "highs_bindings.*.so"
37+
patterns = ["highs_bindings.*.so", "_core.*.so"]
3838
else:
3939
raise NotImplementedError(f"{sys.platform} not supported!")
4040

4141
# there should only be one match
42-
[libfile] = glob.glob(os.path.join(pkg_path, pattern))
42+
matched_files = []
43+
for pattern in patterns:
44+
matched_files.extend(glob.glob(os.path.join(pkg_path, pattern)))
45+
if len(matched_files) != 1:
46+
raise FileNotFoundError(f"Could not find HiGHS library in {pkg_path}.")
47+
[libfile] = matched_files
4348
logger.debug("Choosing HiGHS library {libfile} via highspy package.")
4449

4550
highslib = ffi.dlopen(libfile)

mip/lists.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def add(
4949
return new_var
5050

5151
def __getitem__(self: "VarList", key):
52+
if key is None:
53+
raise KeyError("Empty key access (e.g., varlist[]) is not allowed in Python 3.13")
5254
if isinstance(key, str):
5355
return self.__model.var_by_name(key)
5456
return self.__vars[key]

mip/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ def constr_by_name(self: "Model", name: str) -> Optional["mip.Constr"]:
471471
constraint or None if not found
472472
"""
473473
cidx = self.solver.constr_get_index(name)
474-
if cidx < 0 or cidx > len(self.constrs):
474+
if cidx < 0 or cidx >= len(self.constrs):
475475
return None
476476
return self.constrs[cidx]
477477

@@ -484,7 +484,7 @@ def var_by_name(self: "Model", name: str) -> Optional["mip.Var"]:
484484
Variable or None if not found
485485
"""
486486
v = self.solver.var_get_index(name)
487-
if v < 0 or v > len(self.vars):
487+
if v < 0 or v >= len(self.vars):
488488
return None
489489
return self.vars[v]
490490

0 commit comments

Comments
 (0)