Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dual convention #40

Closed
odow opened this issue Oct 20, 2024 · 13 comments
Closed

Dual convention #40

odow opened this issue Oct 20, 2024 · 13 comments
Assignees
Labels
AMPL bug Something isn't working

Comments

@odow
Copy link
Contributor

odow commented Oct 20, 2024

What is Uno's dual convention? Currently, Uno returns the negative of the Ipopt dual:

See the

  Dual solution :
    c : 1.00000e+00

and

  Dual solution :
    c : -1.00000e+00

parts of the output.

Uno

julia> using JuMP, AmplNLWriter, Uno_jll

julia> begin
           model = Model() do
               return AmplNLWriter.Optimizer(Uno_jll.amplexe; directory = "/tmp/uno")
           end
           set_attribute(model, "preset", "ipopt")
           set_attribute(model, "linear_solver", "MUMPS")
           @variable(model, x >= 0)
           @objective(model, Min, -x)
           @constraint(model, c, x <= 2)
           optimize!(model)
           solution_summary(model; verbose = true)
       end
Model /tmp/uno/model.nl
Options:
- AMPL_write_solution_to_file = yes
- BQPD_kmax = 500
- BQPD_print_subproblem = no
- LP_solver = BQPD
- LS_backtracking_ratio = 0.5
- LS_min_step_length = 5e-7
- LS_scale_duals_with_step_length = yes
- QP_solver = BQPD
- TR_activity_tolerance = 1e-6
- TR_aggressive_decrease_factor = 4
- TR_decrease_factor = 2
- TR_increase_factor = 2
- TR_min_radius = 1e-7
- TR_radius = 10.
- TR_radius_reset_threshold = 1e-4
- armijo_decrease_fraction = 1e-8
- armijo_tolerance = 1e-9
- barrier_damping_factor = 1e-5
- barrier_default_multiplier = 1
- barrier_initial_parameter = 0.1
- barrier_k_epsilon = 10
- barrier_k_mu = 0.2
- barrier_k_sigma = 1e10
- barrier_push_variable_to_interior_k1 = 1e-2
- barrier_push_variable_to_interior_k2 = 1e-2
- barrier_regularization_exponent = 0.25
- barrier_small_direction_factor = 10.
- barrier_smax = 100
- barrier_tau_min = 0.99
- barrier_theta_mu = 1.5
- barrier_update_fraction = 10
- constraint_relaxation_strategy = feasibility_restoration
- convexify_QP = false
- dual_regularization_fraction = 1e-8
- enforce_linear_constraints = no
- filter_beta = 0.99999
- filter_capacity = 50
- filter_fact = 1e4
- filter_gamma = 1e-8
- filter_sufficient_infeasibility_decrease_factor = 0.9
- filter_switching_infeasibility_exponent = 1.1
- filter_type = standard
- filter_ubd = 1e4
- function_scaling_factor = 100
- function_scaling_threshold = 100
- funnel_beta = 0.9999
- funnel_fact = 1.5
- funnel_gamma = 0.001
- funnel_kappa = 0.5
- funnel_require_acceptance_wrt_current_iterate = no
- funnel_ubd = 1.0
- funnel_update_strategy = 1
- globalization_mechanism = LS
- globalization_strategy = waechter_filter_method
- hessian_model = exact
- l1_constraint_violation_coefficient = 1000.
- l1_relaxation_decrease_factor = 10.
- l1_relaxation_epsilon1 = 0.1
- l1_relaxation_epsilon2 = 0.1
- l1_relaxation_fixed_parameter = no
- l1_relaxation_initial_parameter = 1.
- l1_relaxation_residual_small_threshold = 1e-12
- l1_small_duals_threshold = 1e-10
- least_square_multiplier_max_norm = 1e3
- linear_solver = MUMPS
- logger = INFO
- loose_tolerance = 1e-6
- loose_tolerance_consecutive_iteration_threshold = 15
- max_iterations = 2000
- nonmonotone_filter_number_dominated_entries = 3
- primal_regularization_decrease_factor = 3.
- primal_regularization_fast_increase_factor = 100.
- primal_regularization_initial_factor = 1e-4
- primal_regularization_lb = 1e-20
- primal_regularization_slow_increase_factor = 8.
- print_solution = no
- progress_norm = L1
- protect_actual_reduction_against_roundoff = yes
- regularization_failure_threshold = 1e40
- regularization_increase_factor = 2
- regularization_initial_value = 1e-4
- residual_norm = INF
- residual_scaling_threshold = 100.
- scale_functions = yes
- scale_residuals = yes
- sparse_format = COO
- statistics_LS_step_length_column_order = 10
- statistics_SOC_column_order = 9
- statistics_TR_radius_column_order = 10
- statistics_barrier_parameter_column_order = 8
- statistics_complementarity_column_order = 105
- statistics_dual_feasibility_column_order = 102
- statistics_funnel_width_column_order = 25
- statistics_major_column_order = 1
- statistics_minor_column_order = 2
- statistics_objective_column_order = 100
- statistics_penalty_parameter_column_order = 5
- statistics_primal_feasibility_column_order = 101
- statistics_print_header_every_iterations = 15
- statistics_regularization_column_order = 21
- statistics_restoration_phase_column_order = 20
- statistics_stationarity_column_order = 104
- statistics_status_column_order = 200
- statistics_step_norm_column_order = 31
- subproblem = primal_dual_interior_point
- switch_to_optimality_requires_linearized_feasibility = no
- switching_delta = 1
- switching_infeasibility_exponent = 2
- threshold_unsuccessful_attempts = 8
- time_limit = inf
- tolerance = 1e-8
- unbounded_objective_threshold = -1e20
Problem /tmp/uno/model.nl_scaled_equalityconstrained_boundrelaxed
2 variables, 1 constraints

Options:
- AMPL_write_solution_to_file = yes
- LS_backtracking_ratio = 0.5
- LS_min_step_length = 5e-7
- LS_scale_duals_with_step_length = yes
- armijo_decrease_fraction = 1e-8
- armijo_tolerance = 1e-9
- barrier_damping_factor = 1e-5
- barrier_default_multiplier = 1
- barrier_initial_parameter = 0.1
- barrier_k_epsilon = 10
- barrier_k_mu = 0.2
- barrier_k_sigma = 1e10
- barrier_push_variable_to_interior_k1 = 1e-2
- barrier_push_variable_to_interior_k2 = 1e-2
- barrier_regularization_exponent = 0.25
- barrier_small_direction_factor = 10.
- barrier_tau_min = 0.99
- barrier_theta_mu = 1.5
- barrier_update_fraction = 10
- constraint_relaxation_strategy = feasibility_restoration
- dual_regularization_fraction = 1e-8
- filter_beta = 0.99999
- filter_capacity = 50
- filter_fact = 1e4
- filter_gamma = 1e-8
- filter_sufficient_infeasibility_decrease_factor = 0.9
- filter_type = standard
- filter_ubd = 1e4
- function_scaling_threshold = 100
- globalization_mechanism = LS
- globalization_strategy = waechter_filter_method
- l1_constraint_violation_coefficient = 1000.
- least_square_multiplier_max_norm = 1e3
- linear_solver = MUMPS
- logger = INFO
- loose_tolerance = 1e-6
- loose_tolerance_consecutive_iteration_threshold = 15
- max_iterations = 2000
- primal_regularization_decrease_factor = 3.
- primal_regularization_fast_increase_factor = 100.
- primal_regularization_initial_factor = 1e-4
- primal_regularization_lb = 1e-20
- primal_regularization_slow_increase_factor = 8.
- progress_norm = L1
- protect_actual_reduction_against_roundoff = yes
- regularization_failure_threshold = 1e40
- residual_norm = INF
- residual_scaling_threshold = 100.
- scale_functions = yes
- sparse_format = COO
- statistics_LS_step_length_column_order = 10
- statistics_barrier_parameter_column_order = 8
- statistics_complementarity_column_order = 105
- statistics_major_column_order = 1
- statistics_minor_column_order = 2
- statistics_objective_column_order = 100
- statistics_primal_feasibility_column_order = 101
- statistics_print_header_every_iterations = 15
- statistics_regularization_column_order = 21
- statistics_restoration_phase_column_order = 20
- statistics_stationarity_column_order = 104
- statistics_status_column_order = 200
- statistics_step_norm_column_order = 31
- subproblem = primal_dual_interior_point
- switch_to_optimality_requires_linearized_feasibility = no
- switching_delta = 1
- switching_infeasibility_exponent = 2
- threshold_unsuccessful_attempts = 8
- time_limit = inf
- tolerance = 1e-8
- unbounded_objective_threshold = -1e20
┌───────┬─────────┬────────────────┬─────────────┬───────┬────────────────┬──────────────┬─────────────┬───────────────┬──────────────┬─────────────────┬────────────────────────┐
│ iter  │ LS iter │ barrier param. │ step length │ phase │ regularization │ step norm    │ objective   │ primal feas.  │ stationarity │ complementarity │ status                 │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼───────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 0---           │ OPT   │ ---0.0099999900.51.99            │ initial point          │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼───────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 110.11           │ OPT   │ 00.10895-0.1189500.9050011.00152         │ accepted (f-type)      │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼───────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 210.11           │ OPT   │ 01.86224-1.9811900.8190740.854585        │ accepted (f-type)      │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼───────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 310.021           │ OPT   │ 00.000696375-1.9804902e-070.0202932       │ accepted (f-type)      │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼───────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 410.0001504241           │ OPT   │ 00.0191597-1.9996502.47172e-050.000347198     │ accepted (f-type)      │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼───────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 511.84491e-061           │ OPT   │ 00.000345352-201.84491e-111.84513e-06     │ accepted (f-type)      │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼───────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 612.5059e-091           │ OPT   │ 01.84262e-06-202.52021e-142.5076e-09      │ accepted (f-type)      │
└───────┴─────────┴────────────────┴─────────────┴───────┴────────────────┴──────────────┴─────────────┴───────────────┴──────────────┴─────────────────┴────────────────────────┘


Uno (LS feasibility_restoration waechter_filter_method primal_dual_interior_point)
Mon Oct 21 09:12:37 2024
────────────────────────────────────────
Status:					Converged with feasible KKT point
Objective value:			-2
Primal feasibility:			0
┌ Stationarity residual:		2.520206e-14
└ Complementarity residual:		2.507601e-09
┌ Feasibility stationarity residual:	2.520206e-14
└ Feasibility complementarity residual:	2.507601e-09
┌ Infeasibility measure:		0
│ Objective measure:			-2
└ Auxiliary measure:			4.788985e-08
CPU time:				0.002786s
Iterations:				6
Objective evaluations:			7
Constraints evaluations:		8
Objective gradient evaluations:		8
Jacobian evaluations:			8
Hessian evaluations:			6
Number of subproblems solved:		6
* Solver : AmplNLWriter

* Status
  Result count       : 1
  Termination status : LOCALLY_SOLVED
  Message from the solver:
  ""

* Candidate solution (result #1)
  Primal status      : FEASIBLE_POINT
  Dual status        : FEASIBLE_POINT
  Objective value    : -2.00000e+00
  Dual objective value : -2.00000e+00
  Primal solution :
    x : 2.00000e+00
  Dual solution :
    c : 1.00000e+00

* Work counters
  Solve time (sec)   : 5.44970e-02

Ipopt

julia> begin
           model = Model() do
               return AmplNLWriter.Optimizer(Ipopt_jll.amplexe; directory = "/tmp/uno")
           end
           @variable(model, x >= 0)
           @objective(model, Min, -x)
           @constraint(model, c, x <= 2)
           optimize!(model)
           solution_summary(model; verbose = true)
       end
Ipopt 3.14.16: 

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Eclipse Public License (EPL).
         For more information visit https://github.com/coin-or/Ipopt
******************************************************************************

This is Ipopt version 3.14.16, running with linear solver MUMPS 5.7.3.

Number of nonzeros in equality constraint Jacobian...:        0
Number of nonzeros in inequality constraint Jacobian.:        1
Number of nonzeros in Lagrangian Hessian.............:        0

Total number of variables............................:        1
                     variables with only lower bounds:        1
                variables with lower and upper bounds:        0
                     variables with only upper bounds:        0
Total number of equality constraints.................:        0
Total number of inequality constraints...............:        1
        inequality constraints with only lower bounds:        0
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        1

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0 -9.9999900e-03 0.00e+00 5.00e-01  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1 -1.1894999e-01 0.00e+00 9.05e-01  -1.0 1.09e-01    -  5.22e-01 1.00e+00f  1
   2 -1.9811895e+00 0.00e+00 4.24e-01  -1.7 3.15e+00    -  9.26e-02 5.91e-01f  1
   3 -1.9794257e+00 0.00e+00 2.00e-07  -1.7 1.76e-03    -  1.00e+00 1.00e+00f  1
   4 -1.9996449e+00 0.00e+00 2.86e-05  -3.8 2.02e-02    -  9.97e-01 1.00e+00f  1
   5 -1.9999982e+00 0.00e+00 1.84e-11  -5.7 3.53e-04    -  1.00e+00 1.00e+00f  1
   6 -2.0000000e+00 0.00e+00 2.51e-14  -8.6 1.84e-06    -  1.00e+00 1.00e+00f  1

Number of Iterations....: 6

                                   (scaled)                 (unscaled)
Objective...............:  -2.0000000174923991e+00   -2.0000000174923991e+00
Dual infeasibility......:   2.5148488989747521e-14    2.5148488989747521e-14
Constraint violation....:   0.0000000000000000e+00    0.0000000000000000e+00
Variable bound violation:   0.0000000000000000e+00    0.0000000000000000e+00
Complementarity.........:   2.5076007968172859e-09    2.5076007968172859e-09
Overall NLP error.......:   2.5076007968172859e-09    2.5076007968172859e-09


Number of objective function evaluations             = 7
Number of objective gradient evaluations             = 7
Number of equality constraint evaluations            = 0
Number of inequality constraint evaluations          = 7
Number of equality constraint Jacobian evaluations   = 0
Number of inequality constraint Jacobian evaluations = 7
Number of Lagrangian Hessian evaluations             = 6
Total seconds in IPOPT                               = 0.003

EXIT: Optimal Solution Found.
* Solver : AmplNLWriter

* Status
  Result count       : 1
  Termination status : LOCALLY_SOLVED
  Message from the solver:
  "Ipopt 3.14.16: Optimal Solution Found"

* Candidate solution (result #1)
  Primal status      : FEASIBLE_POINT
  Dual status        : FEASIBLE_POINT
  Objective value    : -2.00000e+00
  Dual objective value : -2.00000e+00
  Primal solution :
    x : 2.00000e+00
  Dual solution :
    c : -1.00000e+00

* Work counters
  Solve time (sec)   : 8.67858e-02
@cvanaret
Copy link
Owner

Uno and IPOPT/ASL (AMPL Solver Library) have a different Lagrangian definition:

  • Uno: $\mathcal{L}(x, y, z) = f(x) - y^T c(x) - z$
  • IPOPT: $\mathcal{L}(x, y, z) = f(x) + y^T c(x) - z$
  • ASL: $\nabla^2 \mathcal{L}(x, y, z) = \nabla^2 f(x) + \sum_{j=1}^m y_j \nabla^2 c(x)$. Not sure about the bound duals in the Lagrangian.

For the Hessian evaluation, Uno's call to the ASL function lagscale_ASL with scaling factor -1 compensates for that.

Can you post the nl file? I can't reproduce at the moment since ASL transforms the constraint into a bound. Uno finds the following primal-dual solution:

Primal solution:			2 
┌ Constraint multipliers:		
│ Lower bound multipliers:		1.252103e-09 
└ Upper bound multipliers:		-1

so there has to be something wrong in the way Uno calls ASL's write_sol function.

@cvanaret cvanaret self-assigned this Oct 20, 2024
@cvanaret cvanaret added bug Something isn't working AMPL labels Oct 20, 2024
@odow
Copy link
Contributor Author

odow commented Oct 20, 2024

g3 1 1 0
 1 1 1 0 0 0
 0 1
 0 0
 0 0 0
 0 0 0 1
 0 0 0 0 0
 1 1
 0 0
 0 0 0 0 0
C0
n0
O0 0
n0
x1
0 0
r
1 2
b
2 0
k0
J0 1
0 1
G0 1
0 -1

@odow
Copy link
Contributor Author

odow commented Oct 20, 2024

Different dual conventions are the bane of my life. Each time I hook up a new solver, I always encounter issues. I generally solve it by randomly whacking a bunch of - in places.

What do you do if the objective sense is Maximization?

@cvanaret
Copy link
Owner

If I maximize, I flip the sign of the objective (and its derivatives).
Here's Uno's primal-solution on your nl file. It has the right signs.

Primal solution:			2 2 
┌ Constraint multipliers:		-1 
│ Lower bound multipliers:		1.252103e-09 0 
└ Upper bound multipliers:		0 -1

So I think I should do another call to lagscale_ASL (with scaling factor 1) just before writing the solution.

@odow
Copy link
Contributor Author

odow commented Oct 20, 2024

Here's the current model.sol

shell> cat /tmp/uno/model.sol

Options
3
1
1
0
1
1
1
1
1.000000001252078
2.000000017492399
objno 0 0

I think we're looking for

shell> cat /tmp/uno/model.sol

Options
3
1
1
0
1
1
1
1
-1.000000001252078
2.000000017492399
objno 0 0

@cvanaret
Copy link
Owner

Got it.
I tried another call to lagscale_ASL but it has no effect when the coefficient is 1 (it doesn't revert any existing change). I'll write on the AMPL forum.

@odow
Copy link
Contributor Author

odow commented Oct 20, 2024

Did you try lagscale_ASL with another -1? (To flip the flip?)

@odow
Copy link
Contributor Author

odow commented Oct 20, 2024

@cvanaret
Copy link
Owner

@odow this should be fixed in commit fd9ad8f.

@odow odow closed this as completed Oct 25, 2024
@odow odow reopened this Oct 25, 2024
@odow
Copy link
Contributor Author

odow commented Oct 25, 2024

So the dual now matches AMPL for minimization. But not for maximization.

We should also think about returning suffixes for the dual of the variable bounds.

julia> using JuMP, AmplNLWriter, Uno_jll, Ipopt_jll, Test

julia> function main(args...)
           @testset "main" begin
               @testset "Model 1" begin
                   model = Model(
                       () -> AmplNLWriter.Optimizer(args...; directory = "/tmp"),
                   )
                   @variable(model, x)
                   @objective(model, Min, x)
                   c1 = @constraint(model, x >= 1)
                   optimize!(model)
                   @test dual(c1)  1.0 atol=1e-6
                   @info "Model 1"
                   @info " model.nl"
                   print(read("/tmp/model.nl", String))
                   @info " model.sol"
                   print(read("/tmp/model.sol", String))
               end
               @testset "Model 2" begin
                   model = Model(
                       () -> AmplNLWriter.Optimizer(args...; directory = "/tmp"),
                   )
                   @variable(model, x)
                   @objective(model, Max, x)
                   c1 = @constraint(model, x <= 1)
                   optimize!(model)
                   @test dual(c1)  -1.0 atol=1e-6
                   @info "Model 2"
                   @info " model.nl"
                   print(read("/tmp/model.nl", String))
                   @info " model.sol"
                   print(read("/tmp/model.sol", String))
               end
               @testset "Model 3" begin
                   model = Model(
                       () -> AmplNLWriter.Optimizer(args...; directory = "/tmp"),
                   )
                   @variable(model, x >= 1)
                   @objective(model, Min, x)
                   optimize!(model)
                   @test dual(LowerBoundRef(x))  1.0 atol=1e-6
                   @info "Model 3"
                   @info " model.nl"
                   print(read("/tmp/model.nl", String))
                   @info " model.sol"
                   print(read("/tmp/model.sol", String))
               end
               @testset "Model 4" begin
                   model = Model(
                       () -> AmplNLWriter.Optimizer(args...; directory = "/tmp"),
                   )
                   @variable(model, x <= 1)
                   @objective(model, Max, x)
                   optimize!(model)
                   @test dual(UpperBoundRef(x))  -1.0 atol=1e-6
                   @info "Model 4"
                   @info " model.nl"
                   print(read("/tmp/model.nl", String))
                   @info " model.sol"
                   print(read("/tmp/model.sol", String))
               end
           end
           return
       end
main (generic function with 1 method)

julia> main(Ipopt_jll.amplexe, ["print_level=0", "sb=yes"])
Ipopt 3.14.16: print_level=0
sb=yes

[ Info: Model 1
[ Info:  model.nl
g3 1 1 0
 1 1 1 0 0 0
 0 1
 0 0
 0 0 0
 0 0 0 1
 0 0 0 0 0
 1 1
 0 0
 0 0 0 0 0
C0
n0
O0 0
n0
x1
0 0
r
2 1
b
3
k0
J0 1
0 1
G0 1
0 1
[ Info:  model.sol
 
Ipopt 3.14.16: Optimal Solution Found

Options
3
1
1
0
1
1
1
1
1
0.9999999925059035
objno 0 0
suffix 4 0 13 0 0
ipopt_zU_out
suffix 4 0 13 0 0
ipopt_zL_out
Ipopt 3.14.16: print_level=0
sb=yes

[ Info: Model 2
[ Info:  model.nl
g3 1 1 0
 1 1 1 0 0 0
 0 1
 0 0
 0 0 0
 0 0 0 1
 0 0 0 0 0
 1 1
 0 0
 0 0 0 0 0
C0
n0
O0 1
n0
x1
0 0
r
1 1
b
3
k0
J0 1
0 1
G0 1
0 1
[ Info:  model.sol
 
Ipopt 3.14.16: Optimal Solution Found

Options
3
1
1
0
1
1
1
1
1
1.0000000074940965
objno 0 0
suffix 4 0 13 0 0
ipopt_zU_out
suffix 4 0 13 0 0
ipopt_zL_out
Ipopt 3.14.16: print_level=0
sb=yes

[ Info: Model 3
[ Info:  model.nl
g3 1 1 0
 1 0 1 0 0 0
 0 1
 0 0
 0 0 0
 0 0 0 1
 0 0 0 0 0
 0 1
 0 0
 0 0 0 0 0
O0 0
n0
x1
0 0
b
2 1
G0 1
0 1
[ Info:  model.sol
 
Ipopt 3.14.16: Optimal Solution Found

Options
3
1
1
0
0
0
1
1
0.9999999925059035
objno 0 0
suffix 4 0 13 0 0
ipopt_zU_out
suffix 4 1 13 0 0
ipopt_zL_out
0 1.000000000000025
Ipopt 3.14.16: print_level=0
sb=yes

[ Info: Model 4
[ Info:  model.nl
g3 1 1 0
 1 0 1 0 0 0
 0 1
 0 0
 0 0 0
 0 0 0 1
 0 0 0 0 0
 0 1
 0 0
 0 0 0 0 0
O0 1
n0
x1
0 0
b
1 1
G0 1
0 1
[ Info:  model.sol
 
Ipopt 3.14.16: Optimal Solution Found

Options
3
1
1
0
0
0
1
1
1.0000000074940965
objno 0 0
suffix 4 1 13 0 0
ipopt_zU_out
0 1.000000000000025
suffix 4 0 13 0 0
ipopt_zL_out
Test Summary: | Pass  Total  Time
main          |    4      4  0.6s

julia> main(Uno_jll.amplexe, ["logger=SILENT"])
[ Info: Model 1
[ Info:  model.nl
g3 1 1 0
 1 1 1 0 0 0
 0 1
 0 0
 0 0 0
 0 0 0 1
 0 0 0 0 0
 1 1
 0 0
 0 0 0 0 0
C0
n0
O0 0
n0
x1
0 0
r
2 1
b
3
k0
J0 1
0 1
G0 1
0 1
[ Info:  model.sol
Uno 1.1.0: Converged with feasible KKT point

Options
3
1
1
0
1
1
1
1
1
0.9999999925059035
objno 0 0
Model 2: Test Failed at REPL[61]:26
  Expression: (dual(c1), -1.0, atol = 1.0e-6)
   Evaluated: 1.0  -1.0 (atol=1.0e-6)

Stacktrace:
  [1] macro expansion
    @ ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
  [2] macro expansion
    @ ./REPL[61]:26 [inlined]
  [3] macro expansion
    @ ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
  [4] macro expansion
    @ ./REPL[61]:19 [inlined]
  [5] macro expansion
    @ ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
  [6] main(::Function, ::Vararg{Any})
    @ Main ./REPL[61]:3
  [7] top-level scope
    @ REPL[63]:1
  [8] eval
    @ ./boot.jl:385 [inlined]
  [9] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:150
 [10] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:246
 [11] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:231
 [12] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:389
 [13] run_repl(repl::REPL.AbstractREPL, consumer::Any)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:375
 [14] (::Base.var"#1013#1015"{Bool, Bool, Bool})(REPL::Module)
    @ Base ./client.jl:432
 [15] #invokelatest#2
    @ ./essentials.jl:892 [inlined]
 [16] invokelatest
    @ ./essentials.jl:889 [inlined]
 [17] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
    @ Base ./client.jl:416
 [18] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:333
 [19] _start()
    @ Base ./client.jl:552
[ Info: Model 2
[ Info:  model.nl
g3 1 1 0
 1 1 1 0 0 0
 0 1
 0 0
 0 0 0
 0 0 0 1
 0 0 0 0 0
 1 1
 0 0
 0 0 0 0 0
C0
n0
O0 1
n0
x1
0 0
r
1 1
b
3
k0
J0 1
0 1
G0 1
0 1
[ Info:  model.sol
Uno 1.1.0: Converged with feasible KKT point

Options
3
1
1
0
1
1
1
1
-1
1.0000000074940965
objno 0 0
Model 3: Test Failed at REPL[61]:40
  Expression: (dual(LowerBoundRef(x)), 1.0, atol = 1.0e-6)
   Evaluated: 0.0  1.0 (atol=1.0e-6)

Stacktrace:
  [1] macro expansion
    @ ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
  [2] macro expansion
    @ ./REPL[61]:40 [inlined]
  [3] macro expansion
    @ ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
  [4] macro expansion
    @ ./REPL[61]:34 [inlined]
  [5] macro expansion
    @ ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
  [6] main(::Function, ::Vararg{Any})
    @ Main ./REPL[61]:3
  [7] top-level scope
    @ REPL[63]:1
  [8] eval
    @ ./boot.jl:385 [inlined]
  [9] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:150
 [10] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:246
 [11] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:231
 [12] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:389
 [13] run_repl(repl::REPL.AbstractREPL, consumer::Any)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:375
 [14] (::Base.var"#1013#1015"{Bool, Bool, Bool})(REPL::Module)
    @ Base ./client.jl:432
 [15] #invokelatest#2
    @ ./essentials.jl:892 [inlined]
 [16] invokelatest
    @ ./essentials.jl:889 [inlined]
 [17] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
    @ Base ./client.jl:416
 [18] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:333
 [19] _start()
    @ Base ./client.jl:552
[ Info: Model 3
[ Info:  model.nl
g3 1 1 0
 1 0 1 0 0 0
 0 1
 0 0
 0 0 0
 0 0 0 1
 0 0 0 0 0
 0 1
 0 0
 0 0 0 0 0
O0 0
n0
x1
0 0
b
2 1
G0 1
0 1
[ Info:  model.sol
Uno 1.1.0: Converged with feasible KKT point

Options
3
1
1
0
0
0
1
1
0.9999999925059035
objno 0 0
Model 4: Test Failed at REPL[61]:54
  Expression: (dual(UpperBoundRef(x)), -1.0, atol = 1.0e-6)
   Evaluated: -0.0  -1.0 (atol=1.0e-6)

Stacktrace:
  [1] macro expansion
    @ ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
  [2] macro expansion
    @ ./REPL[61]:54 [inlined]
  [3] macro expansion
    @ ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
  [4] macro expansion
    @ ./REPL[61]:48 [inlined]
  [5] macro expansion
    @ ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
  [6] main(::Function, ::Vararg{Any})
    @ Main ./REPL[61]:3
  [7] top-level scope
    @ REPL[63]:1
  [8] eval
    @ ./boot.jl:385 [inlined]
  [9] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:150
 [10] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:246
 [11] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:231
 [12] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:389
 [13] run_repl(repl::REPL.AbstractREPL, consumer::Any)
    @ REPL ~/.julia/juliaup/julia-1.10.5+0.x64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:375
 [14] (::Base.var"#1013#1015"{Bool, Bool, Bool})(REPL::Module)
    @ Base ./client.jl:432
 [15] #invokelatest#2
    @ ./essentials.jl:892 [inlined]
 [16] invokelatest
    @ ./essentials.jl:889 [inlined]
 [17] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
    @ Base ./client.jl:416
 [18] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:333
 [19] _start()
    @ Base ./client.jl:552
[ Info: Model 4
[ Info:  model.nl
g3 1 1 0
 1 0 1 0 0 0
 0 1
 0 0
 0 0 0
 0 0 0 1
 0 0 0 0 0
 0 1
 0 0
 0 0 0 0 0
O0 1
n0
x1
0 0
b
1 1
G0 1
0 1
[ Info:  model.sol
Uno 1.1.0: Converged with feasible KKT point

Options
3
1
1
0
0
0
1
1
1.0000000074940965
objno 0 0
Test Summary: | Pass  Fail  Total  Time
main          |    1     3      4  0.3s
  Model 1     |    1            1  0.1s
  Model 2     |          1      1  0.1s
  Model 3     |          1      1  0.1s
  Model 4     |          1      1  0.1s
ERROR: Some tests did not pass: 1 passed, 3 failed, 0 errored, 0 broken.

@cvanaret
Copy link
Owner

The duals should now match IPOPT's for minimization and maximization (commit 117641e).
I will open a separate issue for the bound duals using suffixes (but I must admit I don't understand sh*t about that section of the documentation).

@odow
Copy link
Contributor Author

odow commented Oct 27, 2024

Just confirming that I think we have this correct now:

jump-dev/MathOptInterface.jl#2567 (comment)

@cvanaret
Copy link
Owner

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AMPL bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants