@@ -77,9 +77,6 @@ class _OptionsSimplex(_OptionsCommonLegacy, TypedDict, total=False):
7777
7878###
7979
80- __docformat__ : Final = "restructuredtext en" # undocumented
81- LINPROG_METHODS : Final [Sequence [MethodLinprog | MethodLinprogLegacy ]] = ... # undocumented
82-
8380class OptimizeResult (_OptimizeResult ):
8481 x : onp .Array1D [np .float64 ] | None
8582 fun : float | None
@@ -90,6 +87,27 @@ class OptimizeResult(_OptimizeResult):
9087 message : str
9188 nit : int
9289
90+ @type_check_only
91+ class _OptimizeResultSensitivity (_OptimizeResult ):
92+ residual : onp .Array1D [np .float64 ]
93+ marginals : onp .Array1D [np .float64 ]
94+
95+ @type_check_only
96+ class _OptimizeResultHighs (OptimizeResult ):
97+ crossover_nit : int
98+ lower : _OptimizeResultSensitivity
99+ upper : _OptimizeResultSensitivity
100+ eqlin : _OptimizeResultSensitivity
101+ ineqlin : _OptimizeResultSensitivity
102+ mip_node_count : int # only exists if `success=True`
103+ mip_dual_bound : float # only exists if `success=True`
104+ mip_gap : float # only exists if `success=True`
105+
106+ ###
107+
108+ __docformat__ : Final = "restructuredtext en" # undocumented
109+ LINPROG_METHODS : Final [Sequence [MethodLinprog | MethodLinprogLegacy ]] = ... # undocumented
110+
93111def linprog_verbose_callback (res : OptimizeResult ) -> None : ...
94112def linprog_terse_callback (res : OptimizeResult ) -> None : ...
95113
@@ -107,7 +125,7 @@ def linprog(
107125 options : _OptionsHighs | None = None ,
108126 x0 : onp .ToFloat1D | None = None ,
109127 integrality : _Max3 | Sequence [_Max3 ] | onp .CanArrayND [npc .integer ] | None = None ,
110- ) -> OptimizeResult : ...
128+ ) -> _OptimizeResultHighs : ...
111129@overload # highs-ds
112130def linprog (
113131 c : onp .ToFloat1D ,
@@ -122,7 +140,7 @@ def linprog(
122140 options : _OptionsHighsDS | None = None ,
123141 x0 : onp .ToFloat1D | None = None ,
124142 integrality : _Max3 | Sequence [_Max3 ] | onp .CanArrayND [npc .integer ] | None = None ,
125- ) -> OptimizeResult : ...
143+ ) -> _OptimizeResultHighs : ...
126144@overload # highs-ipm
127145def linprog (
128146 c : onp .ToFloat1D ,
@@ -137,7 +155,7 @@ def linprog(
137155 options : _OptionsHighsIPM | None = None ,
138156 x0 : onp .ToFloat1D | None = None ,
139157 integrality : _Max3 | Sequence [_Max3 ] | onp .CanArrayND [npc .integer ] | None = None ,
140- ) -> OptimizeResult : ...
158+ ) -> _OptimizeResultHighs : ...
141159@overload # interior-point (legacy, see https://github.com/scipy/scipy/issues/15707)
142160@deprecated ("`method='interior-point'` is deprecated and will be removed in SciPy 1.17. Please use one of the HIGHS solvers." )
143161def linprog (
@@ -199,4 +217,4 @@ def linprog(
199217 options : _OptionsHighs | None = None ,
200218 x0 : onp .ToFloat1D | None = None ,
201219 integrality : _Max3 | Sequence [_Max3 ] | onp .CanArrayND [npc .integer ] | None = None ,
202- ) -> OptimizeResult : ...
220+ ) -> _OptimizeResultHighs : ...
0 commit comments