@@ -129,8 +129,8 @@ function constraint!(
129129 type:: Symbol ;
130130 rg:: Union{OrdinalRange{<:Int},Nothing} = nothing ,
131131 f:: Union{Function,Nothing} = nothing ,
132- lb:: Union{ctVector,Nothing} = nothing ,
133- ub:: Union{ctVector,Nothing} = nothing ,
132+ lb:: Union{ctNumber, ctVector,Nothing} = nothing ,
133+ ub:: Union{ctNumber, ctVector,Nothing} = nothing ,
134134 label:: Symbol = __constraint_label (),
135135)
136136
@@ -156,13 +156,16 @@ function constraint!(
156156 n = dimension (ocp. state)
157157 m = dimension (ocp. control)
158158 q = dimension (ocp. variable)
159-
160159 # add the constraint
161160 return __constraint! (
162- ocp. constraints, type, n, m, q; rg= rg, f= f, lb= lb , ub= ub , label= label
161+ ocp. constraints, type, n, m, q; rg= rg, f= f, lb= as_vector (lb) , ub= as_vector (ub) , label= label
163162 )
164163end
165164
165+ as_vector (x:: Nothing ) = nothing
166+ as_vector (x:: T ) where {T <: ctNumber } = [x]
167+ as_vector (x:: Vector{T} ) where {T <: ctNumber } = x
168+
166169# ------------------------------------------------------------------------------ #
167170# GETTERS
168171# ------------------------------------------------------------------------------ #
0 commit comments