julia> using JuMP, Ipopt
julia> function solve()
model = Model(Ipopt.Optimizer)
@variable(model, x[1:2] >= 0.001, start = 1)
@NLobjective(model, Max, 16 * log(x[1]) + 9 * log(x[2]))
@NLconstraint(model, x[1]^2 / 100 + x[2]^2 / 36 == 100)
optimize!(model)
@assert termination_status(model) == LOCALLY_SOLVED
return value.(x)
end
solve (generic function with 1 method)
julia> solve()
This is Ipopt version 3.13.4, running with linear solver mumps.
NOTE: Other linear solvers might be more efficient (see Ipopt documentation).
Number of nonzeros in equality constraint Jacobian...: 2
Number of nonzeros in inequality constraint Jacobian.: 0
Number of nonzeros in Lagrangian Hessian.............: 4
Total number of variables............................: 2
variables with only lower bounds: 2
variables with lower and upper bounds: 0
variables with only upper bounds: 0
Total number of equality constraints.................: 1
Total number of inequality constraints...............: 0
inequality constraints with only lower bounds: 0
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 0
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
0 0.0000000e+00 1.00e+02 1.19e+01 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0
1 1.6922650e+02 7.28e+04 6.03e+07 -1.0 1.58e+03 - 6.27e-04 1.00e+00f 1
2 1.5946715e+02 1.86e+04 3.79e+08 -1.0 8.15e+02 6.0 1.00e+00 1.00e+00h 1
3 1.4227187e+02 4.62e+03 9.46e+07 -1.0 3.78e+02 - 1.00e+00 1.00e+00h 1
4 1.2546702e+02 1.13e+03 2.36e+07 -1.0 1.87e+02 - 1.00e+00 1.00e+00h 1
5 1.1009062e+02 2.60e+02 5.87e+06 -1.0 8.97e+01 - 1.00e+00 1.00e+00h 1
6 9.8892524e+01 4.69e+01 1.35e+06 -1.0 3.81e+01 - 1.00e+00 1.00e+00h 1
7 9.4544237e+01 3.74e+00 1.82e+05 -1.0 1.08e+01 - 1.00e+00 1.00e+00h 1
8 9.4089100e+01 3.38e-02 3.22e+03 -1.0 1.02e+00 - 1.00e+00 1.00e+00h 1
9 9.4091188e+01 5.90e-06 7.70e-01 -1.0 1.33e-02 - 1.00e+00 1.00e+00h 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
10 1.0032943e+02 5.03e+00 1.77e-01 -1.7 2.08e+01 - 7.29e-01 1.00e+00f 1
11 1.0359036e+02 1.03e+01 2.84e-02 -1.7 2.50e+01 - 1.00e+00 1.00e+00f 1
12 1.0239742e+02 2.68e-01 4.61e-03 -1.7 2.93e+00 - 1.00e+00 1.00e+00h 1
13 1.0236419e+02 7.69e-04 1.14e-05 -1.7 2.52e-01 - 1.00e+00 1.00e+00h 1
14 1.0236410e+02 6.26e-06 1.01e-07 -3.8 1.47e-02 - 1.00e+00 1.00e+00h 1
15 1.0236410e+02 4.59e-10 2.27e-11 -5.7 1.26e-04 - 1.00e+00 1.00e+00h 1
16 1.0236410e+02 5.68e-14 2.56e-14 -8.6 1.29e-06 - 1.00e+00 1.00e+00h 1
Number of Iterations....: 16
(scaled) (unscaled)
Objective...............: -1.0236409660088709e+02 1.0236409660088709e+02
Dual infeasibility......: 2.5600289097858465e-14 2.5600289097858465e-14
Constraint violation....: 5.6843418860808015e-14 5.6843418860808015e-14
Complementarity.........: 2.5059564600335962e-09 -2.5059564600335962e-09
Overall NLP error.......: 2.5059564600335962e-09 5.6843418860808015e-14
Number of objective function evaluations = 17
Number of objective gradient evaluations = 17
Number of equality constraint evaluations = 17
Number of inequality constraint evaluations = 0
Number of equality constraint Jacobian evaluations = 17
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations = 16
Total CPU secs in IPOPT (w/o function evaluations) = 0.009
Total CPU secs in NLP function evaluations = 0.000
EXIT: Optimal Solution Found.
2-element Vector{Float64}:
79.99999999824524
36.00000000140383
2 Likes