Skip to content

Commit 4ec941b

Browse files
committed
feat: add sanitize missings to default model solve
1 parent 397152d commit 4ec941b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

linopy/model.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,7 @@ def solve(
10491049
keep_files: bool = False,
10501050
env: Any = None,
10511051
sanitize_zeros: bool = True,
1052+
sanitize_missings: bool = True,
10521053
sanitize_infinities: bool = True,
10531054
slice_size: int = 2_000_000,
10541055
remote: RemoteHandler | OetcHandler = None, # type: ignore
@@ -1106,6 +1107,9 @@ def solve(
11061107
Whether to set terms with zero coefficient as missing.
11071108
This will remove unneeded overhead in the lp file writing.
11081109
The default is True.
1110+
sanitize_missings : bool, optional
1111+
Whether to ignore constraints with only missing coefficients.
1112+
This will remove unneeded overhead in the lp file writing.
11091113
sanitize_infinities : bool, optional
11101114
Whether to filter out constraints that are subject to `<= inf` or `>= -inf`.
11111115
slice_size : int, optional
@@ -1195,6 +1199,9 @@ def solve(
11951199
if sanitize_zeros:
11961200
self.constraints.sanitize_zeros()
11971201

1202+
if sanitize_missings:
1203+
self.constraints.sanitize_missings()
1204+
11981205
if sanitize_infinities:
11991206
self.constraints.sanitize_infinities()
12001207

0 commit comments

Comments
 (0)