InfiniteOpt.jl icon indicating copy to clipboard operation
InfiniteOpt.jl copied to clipboard

Logical expressions not supported

Open blegat opened this issue 1 year ago • 1 comments

We would like to use InfiniteOpt as interface for https://github.com/dionysos-dev/Dionysos.jl. For this, we would need to use || constraints but we get into an error with InfiniteOpt:

using InfiniteOpt
model = InfiniteModel()
@infinite_parameter(model, t ∈ [0, 1])
@variable(model, x, Infinite(t))
@constraint(model, (x(0) <= 1.0 || x(0) >= 0.0) := true)

give the error:

ERROR: `_all_function_variables` not defined for expression of type GenericNonlinearExpr{GeneralVariableRef}.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] _all_function_variables(f::GenericNonlinearExpr{GeneralVariableRef})
   @ InfiniteOpt ~/.julia/packages/InfiniteOpt/2oc8E/src/expressions.jl:609
 [3] add_constraint(model::InfiniteModel, c::ScalarConstraint{…}, name::String; is_info_constr::Bool)
   @ InfiniteOpt ~/.julia/packages/InfiniteOpt/2oc8E/src/constraints.jl:292
 [4] add_constraint(model::InfiniteModel, c::ScalarConstraint{…}, name::String)
   @ InfiniteOpt ~/.julia/packages/InfiniteOpt/2oc8E/src/constraints.jl:285
 [5] macro expansion
   @ ~/.julia/packages/JuMP/V9nZm/src/macros/@constraint.jl:173 [inlined]
 [6] macro expansion
   @ ~/.julia/packages/JuMP/V9nZm/src/macros.jl:393 [inlined]
 [7] top-level scope
   @ ~/.julia/dev/Dionysos/dionysos-main/examples/planning_path_infiniteopt.jl:68
Some type information was truncated. Use `show(err)` to see complete types.

blegat avatar Oct 29 '24 19:10 blegat

Hi @blegat,

I believe this will not be a problem with the master branch this it has updates to the nonlinear expressions. Can you please confirm?

pulsipher avatar Oct 29 '24 23:10 pulsipher

This is fixed with v0.6, sorry for the delay in releasing it. We had a lot of updates in the pipeline.

pulsipher avatar Nov 05 '25 06:11 pulsipher