From 3a977266646bb07c121ec5dacf4a44e07a834c3e Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Wed, 6 Aug 2025 13:21:18 +0200 Subject: [PATCH] linear_solver: backport .lp support to solve_model --- ortools/linear_solver/python/solve_model.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ortools/linear_solver/python/solve_model.py b/ortools/linear_solver/python/solve_model.py index 5cded45323..8cc93b9cfa 100644 --- a/ortools/linear_solver/python/solve_model.py +++ b/ortools/linear_solver/python/solve_model.py @@ -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