linear_solver: backport .lp support to solve_model

This commit is contained in:
Corentin Le Molgat
2025-08-06 13:21:18 +02:00
parent 260856bf0f
commit 3a97726664

View File

@@ -32,11 +32,15 @@ def main(argv: Sequence[str]) -> None:
model = model_builder.ModelBuilder()
# Load MPS or proto file.
# Load MPS, LP, or proto file.
if _INPUT.value.endswith(".mps"):
if not model.import_from_mps_file(_INPUT.value):
print(f"Cannot import MPS file: '{_INPUT.value}'")
return
elif _INPUT.value.endswith(".lp"):
if not model.import_from_lp_file(_INPUT.value):
print(f"Cannot import LP file: '{_INPUT.value}'")
return
elif not model.import_from_proto_file(_INPUT.value):
print(f"Cannot import Proto file: '{_INPUT.value}'")
return