You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something strange happens when I try to set the value of the dual variable for the nonlinear constraint. I'm not sure if it is related to the nonlinear constraint itself; perhaps the example is not ideal, but it represents what is happening:
model =Model(Ipopt.Optimizer)
x =@variable(model, 0<= x[i =1:2] <=0.8)
c =@constraint(model, sin(x[1] - x[2]) ==0.5)
set_dual_start_value(c, 0.1)
@objective(model, Min, sum(x))
optimize!(model)
ERROR: BoundsError: attempt to access 0-element Vector{Union{Nothing, Float64}} at index [1]
Stacktrace:
[1] setindex!
@ .\array.jl:1021 [inlined]
[2] set
@ C:\Users\User\.julia\packages\Ipopt\YDBAD\src\utils.jl:465 [inlined]
[3] set
@ C:\Users\User\.julia\packages\Ipopt\YDBAD\src\MOI_wrapper.jl:430 [inlined]
[4] _set_substituted
@ C:\Users\User\.julia\packages\MathOptInterface\2rAFb\src\Bridges\bridge_optimizer.jl:1375 [inlined]
[5] set(b::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, attr::MathOptInterface.ConstraintDualStart, ci::MathOptInterface.ConstraintIndex{…}, value::Float64)
@ MathOptInterface.Bridges C:\Users\User\.julia\packages\MathOptInterface\2rAFb\src\Bridges\bridge_optimizer.jl:1603
[6] _pass_attribute(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…}, index_map::MathOptInterface.Utilities.IndexMap, cis_src::Vector{…}, attr::MathOptInterface.ConstraintDualStart)
@ MathOptInterface.Utilities C:\Users\User\.julia\packages\MathOptInterface\2rAFb\src\Utilities\copy.jl:146
[7] pass_attributes(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…}, index_map::MathOptInterface.Utilities.IndexMap, cis_src::Vector{…})
@ MathOptInterface.Utilities C:\Users\User\.julia\packages\MathOptInterface\2rAFb\src\Utilities\copy.jl:131
[8] _pass_constraints(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…}, index_map::MathOptInterface.Utilities.IndexMap, variable_constraints_not_added::Vector{…})
@ MathOptInterface.Utilities C:\Users\User\.julia\packages\MathOptInterface\2rAFb\src\Utilities\copy.jl:337
[9] default_copy_to(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…})
@ MathOptInterface.Utilities C:\Users\User\.julia\packages\MathOptInterface\2rAFb\src\Utilities\copy.jl:505
[10] copy_to
@ C:\Users\User\.julia\packages\MathOptInterface\2rAFb\src\Bridges\bridge_optimizer.jl:455 [inlined]
[11] optimize!
@ C:\Users\User\.julia\packages\MathOptInterface\2rAFb\src\MathOptInterface.jl:84 [inlined]
[12] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{…})
@ MathOptInterface.Utilities C:\Users\User\.julia\packages\MathOptInterface\2rAFb\src\Utilities\cachingoptimizer.jl:316
[13] optimize!(model::Model; ignore_optimize_hook::Bool, _differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::@Kwargs{})
@ JuMP C:\Users\User\.julia\packages\JuMP\Gwn88\src\optimizer_interface.jl:457
[14] optimize!(model::Model)
@ JuMP C:\Users\User\.julia\packages\JuMP\Gwn88\src\optimizer_interface.jl:409
[15] top-level scope
@ c:\Users\User\Desktop\aaa.jl:13
Some type information was truncated. Use `show(err)` to see complete types.
It's even stranger because if I remove the sine function, it works well. Additionally, if I add a new constraint, it also works well. For example:
model =Model(Ipopt.Optimizer)
x =@variable(model, 0<= x[i =1:2] <=0.8)
c =@constraint(model, sin(x[1] - x[2]) ==0.5)
n =@constraint(model, 0<= x[1] - x[2] <=1)
set_dual_start_value(c, 0.1)
@objective(model, Min, sum(x))
optimize!(model)
The text was updated successfully, but these errors were encountered:
Hello,
Something strange happens when I try to set the value of the dual variable for the nonlinear constraint. I'm not sure if it is related to the nonlinear constraint itself; perhaps the example is not ideal, but it represents what is happening:
It's even stranger because if I remove the sine function, it works well. Additionally, if I add a new constraint, it also works well. For example:
The text was updated successfully, but these errors were encountered: