-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fail to handle fixed variable bounds #45
Comments
I can reproduce the issue. Note that generating the nl file with AMPL eliminates the fixed variable @odow are there plans for JuMP:
|
Nope. Note that this model has bound constraints for There are a few reasons for this:
|
For example, here's an even simpler model that Uno fails at: julia> using JuMP, AmplNLWriter, Uno_jll
julia> model = Model(
() -> AmplNLWriter.Optimizer(Uno_jll.amplexe; directory="/tmp"),
)
A JuMP Model
├ solver: AmplNLWriter
├ objective_sense: FEASIBILITY_SENSE
├ num_variables: 0
├ num_constraints: 0
└ Names registered in the model: none
julia> @variable(model, 1 <= x <= 1)
x
julia> @objective(model, Max, x)
x
julia> optimize!(model)
Variable x0 has identical bounds
Original model /tmp/model.nl
1 variables, 0 constraints
Reformulated model /tmp/model.nl_scaled_equalityconstrained_boundrelaxed
1 variables, 0 constraints
Used overwritten options:
- LS_backtracking_ratio = 0.5
- LS_min_step_length = 5e-7
- LS_scale_duals_with_step_length = yes
- armijo_decrease_fraction = 1e-8
- barrier_damping_factor = 1e-5
- barrier_tau_min = 0.99
- constraint_relaxation_strategy = feasibility_restoration
- filter_beta = 0.99999
- filter_fact = 1e4
- filter_gamma = 1e-8
- filter_type = standard
- filter_ubd = 1e4
- globalization_mechanism = LS
- globalization_strategy = waechter_filter_method
- l1_constraint_violation_coefficient = 1000.
- linear_solver = MUMPS
- loose_tolerance = 1e-6
- loose_tolerance_consecutive_iteration_threshold = 15
- progress_norm = L1
- protect_actual_reduction_against_roundoff = yes
- residual_norm = INF
- scale_functions = yes
- sparse_format = COO
- subproblem = primal_dual_interior_point
- switch_to_optimality_requires_linearized_feasibility = no
- switching_delta = 1
- tolerance = 1e-8
┌───────┬─────────┬────────────────┬─────────────┬───────┬────────────────┬──────────────┬─────────────┬──────────────┬─────────────────┬────────────────────────┐
│ iter │ LS iter │ barrier param. │ step length │ phase │ regularization │ step norm │ objective │ stationarity │ complementarity │ status │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 0 │ - │ - │ - │ OPT │ - │ - │ -1 │ 1 │ 0 │ initial point │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 1 │ 1 │ 0.02 │ 1 │ OPT │ 0 │ 0.977796 │ -1 │ 1 │ 0 │ accepted (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 2 │ 1 │ 0.02 │ 1 │ OPT │ 0 │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 2 │ - │ 0.5 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 3 │ - │ 0.25 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 4 │ - │ 0.125 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 5 │ - │ 0.0625 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 6 │ - │ 0.03125 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 7 │ - │ 0.015625 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 8 │ - │ 0.0078125 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 9 │ - │ 0.00390625 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 10 │ - │ 0.00195312 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 11 │ - │ 0.000976562 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 12 │ - │ 0.000488281 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 13 │ - │ 0.000244141 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ iter │ LS iter │ barrier param. │ step length │ phase │ regularization │ step norm │ objective │ stationarity │ complementarity │ status │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 14 │ - │ 0.00012207 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 15 │ - │ 6.10352e-05 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 16 │ - │ 3.05176e-05 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 17 │ - │ 1.52588e-05 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 18 │ - │ 7.62939e-06 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 19 │ - │ 3.8147e-06 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 20 │ - │ 1.90735e-06 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ 21 │ - │ 9.53674e-07 │ - │ - │ inf │ -1 │ - │ - │ rejected (f-type) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼──────────────┼─────────────────┼────────────────────────┤
│ - │ - │ - │ - │ - │ - │ - │ - │ - │ - │ LS failed │
└───────┴─────────┴────────────────┴─────────────┴───────┴────────────────┴──────────────┴─────────────┴──────────────┴─────────────────┴────────────────────────┘
Uno 1.1.0 (LS feasibility_restoration waechter_filter_method primal_dual_interior_point)
Mon Oct 28 12:51:20 2024
────────────────────────────────────────
Status: Failed with suboptimal point
Objective value: -1
Primal feasibility: 0
┌ Stationarity residual: 1
└ Complementarity residual: 0
┌ Feasibility stationarity residual: 1
└ Feasibility complementarity residual: 0
┌ Infeasibility measure: 0
│ Objective measure: -1
└ Auxiliary measure: 0
Primal solution: 1
┌ Constraint multipliers:
│ Lower bound multipliers: 0
└ Upper bound multipliers: 0
┌ Constraint feasibility multipliers:
│ Lower bound feasibility multipliers: 0
└ Upper bound feasibility multipliers: 0
Objective multiplier: 1
CPU time: 0.002595s
Iterations: 2
Objective evaluations: 24
Constraints evaluations: 0
Objective gradient evaluations: 4
Jacobian evaluations: 0
Hessian evaluations: 2
Number of subproblems solved: 2 |
Ipopt has the https://coin-or.github.io/Ipopt/OPTIONS.html#OPT_fixed_variable_treatment |
Fair enough. But the poor solver has to do the job :)
SQP methods have no problem dealing with fixed variables, but clearly barrier methods are having a hard time... Thanks for the link. I guess the Edit: OK, that's pretty easy: I just need to move the constraint |
This should be fixed with commit 3ca31fb. |
Can you write out the dual as the variable bound suffix? #49 is still failing because of this. |
Oops, I got carried away. The correct duals are set in commit 8d929e2. |
Nice nice nice: #55 p.s., now there are tests etc, you might consider starting to use PRs when fixing bugs like this so that we can confirm in CI that the tests are fixed before merging. |
Absolutely! CI will spare me/us a lot of trouble. |
Extracted from jump-dev/AmplNLWriter.jl#190
Here's a model that Ipopt solves but Uno fails on.
Ipopt projects out the fixed variable.
Uno has three variables for some reason?
The text was updated successfully, but these errors were encountered: