Skip to content

Commit 534d625

Browse files
committed
add warning for callback and progress
no support in MadNLP :(
1 parent 91512d3 commit 534d625

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/OptimizationMadNLP/src/OptimizationMadNLP.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,11 @@ function __map_optimizer_args(cache,
273273
nvar = length(cache.u0)
274274
ncon = length(cache.lcons)
275275

276+
if !isnothing(progress) || !isnothing(callback)
277+
@warn("MadNLP doesn't currently support user defined callbacks.")
278+
end
279+
# TODO: add support for user callbacks in MadNLP
280+
276281
meta = NLPModels.NLPModelMeta(
277282
nvar;
278283
ncon,
@@ -352,15 +357,11 @@ function SciMLBase.__solve(cache::OptimizationBase.OptimizationCache{
352357
maxtime = maxtime,
353358
verbose = get(cache.solver_args, :verbose, false),
354359
progress = cache.progress,
355-
callback = cache.callback)
360+
callback = cache.callback
361+
)
356362

357363
results = MadNLP.solve!(solver)
358364

359-
# if cache.progress
360-
# # Set progressbar to 1 to finish it
361-
# Base.@logmsg(Base.LogLevel(-1), "", progress = 1, _id = :OptimizationMadNLP)
362-
# end
363-
364365
stats = OptimizationBase.OptimizationStats(; time = results.counters.total_time,
365366
iterations = results.iter,
366367
fevals = results.counters.obj_cnt,
@@ -374,7 +375,7 @@ function SciMLBase.__solve(cache::OptimizationBase.OptimizationCache{
374375
results.objective;
375376
original = results,
376377
retcode,
377-
stats = stats)
378+
stats)
378379
end
379380

380381
end

0 commit comments

Comments
 (0)