Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ function __constraint!(
codim_f::Union{Dimension,Nothing}=nothing,
)

# checkings: the constraint must not be set before
# checks: the constraint must not be set before
@ensure(
!(label ∈ keys(ocp_constraints)),
CTBase.UnauthorizedCall(
"the constraint named " * String(label) * " already exists."
),
)

# checkings: lb and ub cannot be both nothing
# checks: lb and ub cannot be both nothing
@ensure(
!(isnothing(lb) && isnothing(ub)),
CTBase.UnauthorizedCall(
Expand Down Expand Up @@ -217,7 +217,7 @@ function constraint!(
codim_f::Union{Dimension,Nothing}=nothing,
)

# checkings: times, state and control must be set before adding constraints
# checks: times, state and control must be set before adding constraints
@ensure __is_state_set(ocp) CTBase.UnauthorizedCall(
"the state must be set before adding constraints."
)
Expand All @@ -228,7 +228,7 @@ function constraint!(
"the times must be set before adding constraints."
)

# checkings: variable must be set if using type=:variable
# checks: variable must be set if using type=:variable
@ensure (type != :variable || __is_variable_set(ocp)) CTBase.UnauthorizedCall(
"the ocp has no variable, you cannot use constraint! function with type=:variable. If it is a mistake, please set the variable first.",
)
Expand Down
2 changes: 1 addition & 1 deletion src/control.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function control!(
components_names::Vector{T2}=__control_components(m, string(name)),
)::Nothing where {T1<:Union{String,Symbol},T2<:Union{String,Symbol}}

# checkings using @ensure
# checks using @ensure
@ensure !__is_control_set(ocp) CTBase.UnauthorizedCall(
"the control has already been set."
)
Expand Down
6 changes: 3 additions & 3 deletions src/objective.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function objective!(
lagrange::Union{Function,Nothing}=nothing,
)::Nothing

# checkings: times, state, and control must be set before the objective
# checks: times, state, and control must be set before the objective
@ensure __is_state_set(ocp) CTBase.UnauthorizedCall(
"the state must be set before the objective."
)
Expand All @@ -46,12 +46,12 @@ function objective!(
"the times must be set before the objective."
)

# checkings: the objective must not already be set
# checks: the objective must not already be set
@ensure !__is_objective_set(ocp) CTBase.UnauthorizedCall(
"the objective has already been set."
)

# checkings: at least one of the two functions must be given
# checks: at least one of the two functions must be given
@ensure !(isnothing(mayer) && isnothing(lagrange)) CTBase.IncorrectArgument(
"at least one of the two functions must be given. Please provide a Mayer or a Lagrange function.",
)
Expand Down
2 changes: 1 addition & 1 deletion src/state.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function state!(
components_names::Vector{T2}=__state_components(n, string(name)),
)::Nothing where {T1<:Union{String,Symbol},T2<:Union{String,Symbol}}

# checkings
# checks
@ensure !__is_state_set(ocp) CTBase.UnauthorizedCall("the state has already been set.")
@ensure n > 0 CTBase.IncorrectArgument("the state dimension must be greater than 0")
@ensure size(components_names, 1) == n CTBase.IncorrectArgument(
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CTDirect = "0.16"
CTParser = "0.6"
JLD2 = "0.6"
JSON3 = "1"
NLPModelsIpopt = "0.10"
NLPModelsIpopt = "0.11"
Plots = "1"
Test = "1"
julia = "1.10"
2 changes: 1 addition & 1 deletion test/test_control.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function test_control()
@test CTModels.name(control) == "u"
@test CTModels.components(control) == ["u₁", "u₂"]

# some checkings
# some checks
ocp = CTModels.PreModel()
@test isnothing(ocp.control)
@test !CTModels.__is_control_set(ocp)
Expand Down
2 changes: 1 addition & 1 deletion test/test_state.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function test_state()
@test CTModels.name(state) == "y"
@test CTModels.components(state) == ["u", "v"]

# some checkings
# some checks
ocp = CTModels.PreModel()
@test isnothing(ocp.state)
@test !CTModels.__is_state_set(ocp)
Expand Down
2 changes: 1 addition & 1 deletion test/test_times.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function test_times()
@test CTModels.name(time) == "s"
@test_throws CTBase.IncorrectArgument CTModels.time(time, Float64[])

# some checkings
# some checks
ocp = CTModels.PreModel()
@test isnothing(ocp.times)
@test !CTModels.__is_times_set(ocp)
Expand Down
2 changes: 1 addition & 1 deletion test/test_variable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function test_variable()
@test CTModels.name(variable) == "v"
@test CTModels.components(variable) == ["v₁", "v₂"]

# some checkings
# some checks
ocp = CTModels.PreModel()
@test ocp.variable isa CTModels.EmptyVariableModel
@test !CTModels.__is_variable_set(ocp)
Expand Down
Loading