From c7b109357823377dbba53071dea703a1a601c802 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Caillau Date: Mon, 12 Aug 2024 16:41:59 +0200 Subject: [PATCH] removed explicit references to functional --- src/checking.jl | 8 ++++---- src/model.jl | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/checking.jl b/src/checking.jl index 99f248cf..6375904b 100644 --- a/src/checking.jl +++ b/src/checking.jl @@ -18,7 +18,7 @@ Throw ```UnauthorizedCall``` exception if the state of an ocp is not set. """ function __check_state_set(ocp::OptimalControlModel) - __is_state_not_set(ocp) && throw(UnauthorizedCall("the state dimension has to be set before. Use state!.")) + __is_state_not_set(ocp) && throw(UnauthorizedCall("the state dimension has to be set before.")) end """ @@ -28,7 +28,7 @@ Throw ```UnauthorizedCall``` exception if the control of an ocp is not set. """ function __check_control_set(ocp::OptimalControlModel) - __is_control_not_set(ocp) && throw(UnauthorizedCall("the control dimension has to be set before. Use control!.")) + __is_control_not_set(ocp) && throw(UnauthorizedCall("the control dimension has to be set before.")) end """ @@ -38,7 +38,7 @@ Throw ```UnauthorizedCall``` exception if the time of an ocp is not set. """ function __check_is_time_set(ocp::OptimalControlModel) - __is_time_not_set(ocp) && throw(UnauthorizedCall("the time dimension has to be set before. Use time!.")) + __is_time_not_set(ocp) && throw(UnauthorizedCall("the time dimension has to be set before.")) end """ @@ -48,7 +48,7 @@ Throw ```UnauthorizedCall``` exception if the variable of an ocp is not set. """ function __check_variable_set(ocp::OptimalControlModel{<:TimeDependence, NonFixed}) - __is_variable_not_set(ocp) && throw(UnauthorizedCall("the variable dimension has to be set before. Use variable!.")) + __is_variable_not_set(ocp) && throw(UnauthorizedCall("the variable dimension has to be set before.")) end """ diff --git a/src/model.jl b/src/model.jl index 93a6569d..d59bcedb 100644 --- a/src/model.jl +++ b/src/model.jl @@ -174,7 +174,7 @@ function variable!( # checkings is_fixed(ocp) && throw(UnauthorizedCall("the ocp has no variable, you cannot use variable! function.")) - __is_variable_set(ocp) && throw(UnauthorizedCall("the variable has already been set. Use variable! once.")) + __is_variable_set(ocp) && throw(UnauthorizedCall("the variable has already been set.")) (q > 1) && (size(components_names, 1) ≠ q) && throw(IncorrectArgument("the number of variable names must be equal to the variable dimension")) ocp.variable_dimension = q @@ -256,7 +256,7 @@ function state!( components_names::Vector{String}=__state_components_names(n, name)) # checkings - __is_state_set(ocp) && throw(UnauthorizedCall("the state has already been set. Use state! once.")) + __is_state_set(ocp) && throw(UnauthorizedCall("the state has already been set.")) (n > 1) && (size(components_names, 1) ≠ n) && throw(IncorrectArgument("the number of state names must be equal to the state dimension")) ocp.state_dimension = n @@ -342,7 +342,7 @@ function control!( components_names::Vector{String}=__control_components_names(m, name)) # checkings - __is_control_set(ocp) && throw(UnauthorizedCall("the control has already been set. Use control! once.")) + __is_control_set(ocp) && throw(UnauthorizedCall("the control has already been set.")) (m > 1) && (size(components_names, 1) ≠ m) && throw(IncorrectArgument("the number of control names must be equal to the control dimension")) ocp.control_dimension = m @@ -425,7 +425,7 @@ function time!( !isnothing(indf) && !(1 ≤ indf ≤ q) && throw(IncorrectArgument("the index of tf variable must be contained in 1:$q")) # check if the function has been already called - __is_time_set(ocp) && throw(UnauthorizedCall("the time has already been set. Use time! once.")) + __is_time_set(ocp) && throw(UnauthorizedCall("the time has already been set.")) # check consistency !isnothing(t0) && !isnothing(ind0) && throw(IncorrectArgument("Providing t0 and ind0 has no sense. The initial time cannot be fixed and free.")) @@ -673,7 +673,7 @@ function dynamics!(ocp::OptimalControlModel{T, V}, f::Function) where {T <: Time # we check if the dimensions and times have been set __check_all_set(ocp) - __is_dynamics_set(ocp) && throw(UnauthorizedCall("the dynamics has already been set. Use dynamics! once.")) + __is_dynamics_set(ocp) && throw(UnauthorizedCall("the dynamics has already been set.")) ocp.dynamics = Dynamics(f, T, V) @@ -710,7 +710,7 @@ function objective!(ocp::OptimalControlModel{T, V}, type::Symbol, f::Function, # we check if the dimensions and times have been set __check_all_set(ocp) - __is_objective_set(ocp) && throw(UnauthorizedCall("the objective has already been set. Use objective! once.")) + __is_objective_set(ocp) && throw(UnauthorizedCall("the objective has already been set.")) # check the validity of the criterion !__is_criterion_valid(criterion) && throw(IncorrectArgument("the following criterion is not valid: " * String(criterion) * @@ -755,7 +755,7 @@ function objective!(ocp::OptimalControlModel{T, V}, type::Symbol, g::Function, f # we check if the dimensions and times have been set __check_all_set(ocp) - __is_objective_set(ocp) && throw(UnauthorizedCall("the objective has already been set. Use objective! once.")) + __is_objective_set(ocp) && throw(UnauthorizedCall("the objective has already been set.")) # check the validity of the criterion !__is_criterion_valid(criterion) && throw(IncorrectArgument("the following criterion is not valid: " * String(criterion) *