Skip to content

Implement personal callback for Ipopt solver #103

Answered by tmigot
ocots asked this question in Q&A
Discussion options

You must be logged in to vote

Short answer: Yes !

The longer answer, now.

(temp) pkg> st
      Status `~/temp/Project.toml`
  [54578032] ADNLPModels v0.5.1
  [b6b21f68] Ipopt v1.2.0 `https://github.com/jump-dev/Ipopt.jl#master`
  [a4795742] NLPModels v0.19.2
  [f4238b75] NLPModelsIpopt v0.10.0

What follows only works with the master branch of Ipopt (so it will need Ipopt > 1.2.0).

In the unit tests, there is the following example that give an example of a simple callback:

using Test, ADNLPModels, Ipopt, NLPModelsIpopt
function callback(alg_mod, iter_count, args...)
    return iter_count < 1
  end
  nlp = ADNLPModel(x -> (x[1] - 1)^2 + 100 * (x[2] - x[1]^2)^2, [-1.2; 1.0])
  stats = ipopt(nlp, tol = 1e-12, callback = …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@tmigot
Comment options

Answer selected by ocots
Comment options

You must be logged in to vote
1 reply
@tmigot
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants