@@ -170,56 +170,14 @@ function GenericExecutionStats{T, S, V, Tsp}(;
170170 )
171171end
172172
173- function GenericExecutionStats (
174- nlp:: AbstractNLPModel{T, S} ;
175- status:: Symbol = :unknown ,
176- solution:: S = similar (nlp. meta. x0),
177- objective:: T = T (Inf ),
178- dual_feas:: T = T (Inf ),
179- primal_feas:: T = unconstrained (nlp) ? zero (T) : T (Inf ),
180- multipliers:: S = similar (nlp. meta. y0),
181- multipliers_L:: V = similar (nlp. meta. y0, has_bounds (nlp) ? nlp. meta. nvar : 0 ),
182- multipliers_U:: V = similar (nlp. meta. y0, has_bounds (nlp) ? nlp. meta. nvar : 0 ),
183- iter:: Int = - 1 ,
184- elapsed_time:: Real = Inf ,
185- solver_specific:: Dict{Symbol, Tsp} = Dict {Symbol, Any} (),
186- ) where {T, S, V, Tsp}
187- check_status (status)
188- return GenericExecutionStats {T, S, V, Tsp} (
189- false ,
190- status,
191- false ,
192- solution,
193- false ,
194- objective,
195- false ,
196- dual_feas,
197- false ,
198- primal_feas,
199- false ,
200- multipliers,
201- false ,
202- multipliers_L,
203- multipliers_U,
204- false ,
205- iter,
206- false ,
207- elapsed_time,
208- false ,
209- solver_specific,
210- )
211- end
212-
213173"""
214174 reset!(stats::GenericExecutionStats)
215- reset!(stats::GenericExecutionStats, nlp::AbstractNLPModel )
175+ reset!(stats::GenericExecutionStats, problem )
216176
217177Reset the internal flags of `stats` to `false` to Indicate
218178that the contents should not be trusted.
219- If an `AbstractNLPModel` is also provided,
220- the pre-allocated vectors are adjusted to the problem size.
221179"""
222- function NLPModels . reset! (stats:: GenericExecutionStats )
180+ function reset! (stats:: GenericExecutionStats{T, S, V, Tsp} ) where {T, S, V, Tsp}
223181 stats. status_reliable = false
224182 stats. solution_reliable = false
225183 stats. objective_reliable = false
@@ -233,16 +191,8 @@ function NLPModels.reset!(stats::GenericExecutionStats)
233191 stats
234192end
235193
236- function NLPModels. reset! (
237- stats:: GenericExecutionStats{T, S} ,
238- nlp:: AbstractNLPModel{T, S} ,
239- ) where {T, S}
240- stats. solution = similar (nlp. meta. x0)
241- stats. multipliers = similar (nlp. meta. y0)
242- stats. multipliers_L = similar (nlp. meta. y0, has_bounds (nlp) ? nlp. meta. nvar : 0 )
243- stats. multipliers_U = similar (nlp. meta. y0, has_bounds (nlp) ? nlp. meta. nvar : 0 )
244- reset! (stats)
245- stats
194+ function reset! (stats:: GenericExecutionStats , problem:: Any )
195+ return reset! (stats)
246196end
247197
248198"""
@@ -508,7 +458,7 @@ function getStatus(stats::AbstractExecutionStats)
508458end
509459
510460"""
511- get_status(nlp , kwargs...)
461+ get_status(problem , kwargs...)
512462
513463Return the output of the solver based on the information in the keyword arguments.
514464Use `show_statuses()` for the full list.
@@ -525,9 +475,11 @@ The keyword arguments may contain:
525475- `max_eval::Integer`: limit on the number of evaluations defined by `eval_fun` (default: `typemax(Int)`);
526476- `max_time::Float64 = Inf`: limit on the time (default: `Inf`);
527477- `max_iter::Integer`: limit on the number of iterations (default: `typemax(Int)`).
478+
479+ The `problem` is used to check number of evaluations with SolverCore.eval_fun(problem).
528480"""
529481function get_status (
530- nlp:: AbstractNLPModel ;
482+ nlp;
531483 elapsed_time:: Float64 = 0.0 ,
532484 iter:: Integer = 0 ,
533485 optimal:: Bool = false ,
@@ -565,6 +517,4 @@ function get_status(
565517 :unknown
566518 end
567519end
568-
569- eval_fun (nlp:: AbstractNLPModel ) = neval_obj (nlp) + neval_cons (nlp)
570- eval_fun (nls:: AbstractNLSModel ) = neval_residual (nls) + neval_cons (nls)
520+ eval_fun (:: Any ) = typemax (Int)
0 commit comments