@@ -152,7 +152,7 @@ julia> constraint!(ocp, :final, 1, 0)
152
152
```
153
153
"""
154
154
function constraint! (ocp:: OptimalControlModel , type:: Symbol , rg:: Union{Integer, UnitRange{<:Integer}} , val, label:: Symbol = gensym (:anonymous ))
155
- if type ∈ [ :initial , :final ] # not allowed for :control or :state
155
+ if type ∈ [ :initial , :final ] # not allowed for :control or :state (does not make sense)
156
156
ocp. constraints[label] = (type, :eq , x -> x[rg], val, val)
157
157
else
158
158
throw (IncorrectArgument (" the following type of constraint is not valid: " * String (type) *
@@ -175,11 +175,11 @@ julia> constraint!(ocp, :state, [ 0, 0, 0 ], [ 1, 2, 1 ])
175
175
"""
176
176
function constraint! (ocp:: OptimalControlModel , type:: Symbol , lb, ub, label:: Symbol = gensym (:anonymous ))
177
177
if type ∈ [ :initial , :final ]
178
- ocp. constraints[label] = (type, :ineq , x -> x, ub, lb )
178
+ ocp. constraints[label] = (type, :ineq , x -> x, lb, ub )
179
179
elseif type == :control
180
- ocp. constraints[label] = (type, :ineq , lb isa MyNumber ? 1 : 1 : control_dimension (ocp), ub, lb ) # debug
180
+ ocp. constraints[label] = (type, :ineq , lb isa MyNumber ? 1 : 1 : control_dimension (ocp), lb, ub ) # debug
181
181
elseif type == :state
182
- ocp. constraints[label] = (type, :ineq , lb isa MyNumber ? 1 : 1 : state_dimension (ocp), ub, lb ) # debug
182
+ ocp. constraints[label] = (type, :ineq , lb isa MyNumber ? 1 : 1 : state_dimension (ocp), lb, ub ) # debug
183
183
else
184
184
throw (IncorrectArgument (" the following type of constraint is not valid: " * String (type) *
185
185
" . Please choose in [ :initial, :final, :control, :state ] or check the arguments of the constraint! method." ))
@@ -199,11 +199,11 @@ julia> constraint!(ocp, :control, 1, 0, 2)
199
199
julia> constraint!(ocp, :state, 2:3, [ 0, 0 ], [1, 2])
200
200
```
201
201
"""
202
- function constraint! (ocp:: OptimalControlModel , type:: Symbol , rg, lb, ub, label:: Symbol = gensym (:anonymous ))
202
+ function constraint! (ocp:: OptimalControlModel , type:: Symbol , rg:: Union{Integer, UnitRange{<:Integer}} , lb, ub, label:: Symbol = gensym (:anonymous ))
203
203
if type ∈ [ :initial , :final ]
204
- ocp. constraints[label] = (type, :ineq , x -> x[rg], ub, lb )
204
+ ocp. constraints[label] = (type, :ineq , x -> x[rg], lb, ub )
205
205
elseif type ∈ [ :control , :state ]
206
- ocp. constraints[label] = (type, :ineq , rg, ub, lb )
206
+ ocp. constraints[label] = (type, :ineq , rg, lb, ub )
207
207
else
208
208
throw (IncorrectArgument (" the following type of constraint is not valid: " * String (type) *
209
209
" . Please choose in [ :initial, :final, :contol, :state ] or check the arguments of the constraint! method." ))
319
319
320
320
#
321
321
"""
322
- nlp_constraint (ocp)
322
+ nlp_constraints (ocp)
323
323
324
324
Return a 6-tuple of tuples:
325
325
- `(ξl, ξ, ξu)` are control constraints
@@ -331,7 +331,7 @@ Return a 6-tuple of tuples:
331
331
332
332
# Examples
333
333
```jldoctest
334
- julia> (ξl, ξ, ξu), (ηl, η, ηu), (ψl, ψ, ψu), (ϕl, ϕ, ϕu), (ulb, uind, uub), (xlb, xind, xub) = nlp_constraint (ocp)
334
+ julia> (ξl, ξ, ξu), (ηl, η, ηu), (ψl, ψ, ψu), (ϕl, ϕ, ϕu), (ulb, uind, uub), (xlb, xind, xub) = nlp_constraints (ocp)
335
335
```
336
336
"""
337
337
function nlp_constraints (ocp:: OptimalControlModel{time_dependence, dimension_usage} ) where {time_dependence, dimension_usage}
0 commit comments