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

Fail with colinearity between objective and constraint #59

Closed
odow opened this issue Nov 1, 2024 · 1 comment · Fixed by #61
Closed

Fail with colinearity between objective and constraint #59

odow opened this issue Nov 1, 2024 · 1 comment · Fixed by #61
Assignees
Labels
bug Something isn't working

Comments

@odow
Copy link
Contributor

odow commented Nov 1, 2024

This should be a trivial problem to solve, but it fails line search.

See #57

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, x[1:2])
2-element Vector{VariableRef}:
 x[1]
 x[2]

julia> @constraint(model, sum(x) >= 1)
x[1] + x[2]  1

julia> @objective(model, Min, sum(x))
x[1] + x[2]

julia> optimize!(model)
Original model /tmp/model.nl
2 variables, 1 constraints
Reformulated model /tmp/model.nl_scaled_equalityconstrained_boundrelaxed
3 variables, 1 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   │ primal feas.  │ stationarity │ complementarity │ status                 │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼───────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 0---           │ OPT   │ --01.0100.01            │ initial point          │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼───────────────┼──────────────┼─────────────────┼────────────────────────┤
│ 110.11           │ OPT   │ 09010.011.010.0901          │ accepted (h-type)      │

│ -21-9.53674e-07--3.57589e-072.77052.02505e-13--               │ rejected (restoration) │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼───────────────┼──────────────┼─────────────────┼────────────────────────┤
│ iter  │ LS iter │ barrier param. │ step length │ phase │ regularization │ step norm    │ objective   │ primal feas.  │ stationarity │ complementarity │ status                 │
├───────┼─────────┼────────────────┼─────────────┼───────┼────────────────┼──────────────┼─────────────┼───────────────┼──────────────┼─────────────────┼────────────────────────┤
│ -----------               │ LS failed              │
└───────┴─────────┴────────────────┴─────────────┴───────┴────────────────┴──────────────┴─────────────┴───────────────┴──────────────┴─────────────────┴────────────────────────┘

Uno 1.1.0 (LS feasibility_restoration waechter_filter_method primal_dual_interior_point)
Fri Nov  1 13:26:48 2024
────────────────────────────────────────
Status:					Failed with suboptimal point
Objective value:			2.770503
Primal feasibility:			1.412204e-13
┌ Stationarity residual:		1.624039
└ Complementarity residual:		5.085093
┌ Feasibility stationarity residual:	1.624039
└ Feasibility complementarity residual:	5.085093
┌ Infeasibility measure:		1.412204e-13
│ Objective measure:			2.770503
└ Auxiliary measure:			-8.592922e-05
Primal solution:			-2506.469 2509.24 2.770503 
┌ Constraint multipliers:		1.624039 
│ Lower bound multipliers:		0 0 2.872117 
└ Upper bound multipliers:		0 0 0 
┌ Constraint feasibility multipliers:	5.393307e-09 
│ Lower bound feasibility multipliers:	0 0 0.01292776 
└ Upper bound feasibility multipliers:	0 0 0 
Objective multiplier:			0
CPU time:				0.992318s
Iterations:				1362
Objective evaluations:			13369
Constraints evaluations:		13442
Objective gradient evaluations:		1671
Jacobian evaluations:			1671
Hessian evaluations:			1669
Number of subproblems solved:		1669

shell> cat /tmp/model.nl
g3 1 1 0
 2 1 1 0 0 0
 0 1
 0 0
 0 0 0
 0 0 0 1
 0 0 0 0 0
 2 2
 0 0
 0 0 0 0 0
C0
n0
O0 0
n0
x2
0 0
1 0
r
2 1
b
3
3
k1
1
J0 2
0 1
1 1
G0 2
0 1
1 1
@cvanaret cvanaret self-assigned this Nov 1, 2024
@cvanaret cvanaret added the bug Something isn't working label Nov 1, 2024
@cvanaret
Copy link
Owner

cvanaret commented Nov 1, 2024

This is due to the same problem as #58. The inertia correction with MUMPS_jll.jl fails.
My local uno_ampl with MUMPS 5.7.2 reports at the first iteration:

Original matrix
Dimension: 4, number of nonzeros: 10
m(0, 0) = 0
m(1, 1) = 0
m(2, 2) = 0
m(3, 3) = 0
m(0, 0) = 0
m(1, 1) = 0
m(2, 2) = 100
m(0, 3) = 1
m(1, 3) = 1
m(2, 3) = -1

Testing factorization with regularization factors (0, 0)
Expected inertia (3, 1, 0), got (2, 1, 1)
Number of attempts: 1

Matrix is singular
Testing factorization with regularization factors (0.0001, 5.62341e-09)
Dimension: 4, number of nonzeros: 10
m(0, 0) = 0.0001
m(1, 1) = 0.0001
m(2, 2) = 0.0001
m(3, 3) = -5.62341e-09
m(0, 0) = 0
m(1, 1) = 0
m(2, 2) = 100
m(0, 3) = 1
m(1, 3) = 1
m(2, 3) = -1

Factorization was a success

while Uno_jll.jl and MUMPS_jll.jl produce:

Original matrix
Dimension: 4, number of nonzeros: 10
m(0, 0) = 0
m(1, 1) = 0
m(2, 2) = 0
m(3, 3) = 0
m(0, 0) = 0
m(1, 1) = 0
m(2, 2) = 100
m(0, 3) = 1
m(1, 3) = 1
m(2, 3) = -1

Testing factorization with regularization factors (0, 0)
Inertia is good

which is wrong because the matrix is singular.

Again, I have no idea why that happens.
#61 should fix it.

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

Successfully merging a pull request may close this issue.

2 participants