Private API
This page lists non-exported (internal) symbols of CTModels.OCP.
From CTModels.OCP
__collect_used_names
CTModels.OCP.__collect_used_names — Function
__collect_used_names(ocp::PreModel)::Vector{String}Collect all names already used in the PreModel across all components.
Returns a vector containing:
- Time name (if set)
- State name and components (if set)
- Control name and components (if set)
- Variable name and components (if set and non-empty)
Example
julia> ocp = PreModel()
julia> state!(ocp, 2, "x", ["x₁", "x₂"])
julia> control!(ocp, 1, "u")
julia> __collect_used_names(ocp)
4-element Vector{String}:
"x"
"x₁"
"x₂"
"u"See also: __has_name_conflict, __validate_name_uniqueness
__constraint_label
CTModels.OCP.__constraint_label — Function
__constraint_label() -> Symbol
Used to set the default value of the label of a constraint. A unique value is given to each constraint using the gensym function and prefixing by :unnamed.
__constraints
CTModels.OCP.__constraints — Function
__constraints()
Used to set the default value for the constraints.
__control_components
CTModels.OCP.__control_components — Function
__control_components(
m::Int64,
name::String
) -> Vector{String}
Used to set the default value of the names of the controls. The default value is ["u"] for a one dimensional control, and ["u₁", "u₂", ...] for a multi dimensional control.
__control_name
CTModels.OCP.__control_name — Function
__control_name() -> String
Used to set the default value of the names of the control. The default value is "u".
__criterion_type
CTModels.OCP.__criterion_type — Function
__criterion_type() -> Symbol
Used to set the default value of the type of criterion. Either :min or :max. The default value is :min. The other possible criterion type is :max.
__filename_export_import
CTModels.OCP.__filename_export_import — Function
__filename_export_import() -> String
Return the default filename (without extension) for exporting and importing solutions.
The default value is "solution".
__format
CTModels.OCP.__format — Function
__format() -> Symbol
Used to set the default value of the format of the file to be used for export and import.
__has_name_conflict
CTModels.OCP.__has_name_conflict — Function
__has_name_conflict(ocp::PreModel, new_name::String, exclude_component::Symbol=:none)::BoolCheck if a name conflicts with existing names in the PreModel.
Arguments
ocp::PreModel: The model to check againstnew_name::String: The new name to checkexclude_component::Symbol: Component type to exclude from check (:state,:control,:variable,:time,:none)
The exclude_component parameter allows checking for conflicts while updating a component, excluding the component's own current names from the check.
Returns
Bool:trueif conflict exists,falseotherwise
Example
julia> ocp = PreModel()
julia> state!(ocp, 2, "x", ["x₁", "x₂"])
julia> __has_name_conflict(ocp, "x", :none)
true
julia> __has_name_conflict(ocp, "y", :none)
falseSee also: __collect_used_names, __validate_name_uniqueness
__state_components
CTModels.OCP.__state_components — Function
__state_components(n::Int64, name::String) -> Vector{String}
Used to set the default value of the names of the states. The default value is ["x"] for a one dimensional state, and ["x₁", "x₂", ...] for a multi dimensional state.
__state_name
CTModels.OCP.__state_name — Function
__state_name() -> String
Used to set the default value of the name of the state. The default value is "x".
__time_name
CTModels.OCP.__time_name — Function
__time_name() -> String
Used to set the default value of the name of the time. The default value is t.
__validate_name_uniqueness
CTModels.OCP.__validate_name_uniqueness — Function
__validate_name_uniqueness(ocp::PreModel, name::String, components::Vector{String},
component_type::Symbol)Validate that a name and its components don't conflict with existing names.
Performs comprehensive validation:
- Name is not empty
- Components are not empty
- Name not in components (internal conflict)
- No duplicates in components
- No conflicts with existing names in other components (global uniqueness)
Arguments
ocp::PreModel: The model to validate againstname::String: The component namecomponents::Vector{String}: The component namescomponent_type::Symbol: Type of component (:state,:control,:variable,:time)
Throws
Exceptions.IncorrectArgument: If any validation fails
Example
julia> ocp = PreModel()
julia> state!(ocp, 2, "x", ["x₁", "x₂"])
julia> __validate_name_uniqueness(ocp, "x", ["u"], :control) # Would throw if "x" conflictsSee also: __has_name_conflict, __collect_used_names
__variable_components
CTModels.OCP.__variable_components — Function
__variable_components(
q::Int64,
name::String
) -> Vector{String}
Used to set the default value of the names of the variables. The default value is ["v"] for a one dimensional variable, and ["v₁", "v₂", ...] for a multi dimensional variable.
__variable_name
CTModels.OCP.__variable_name — Function
__variable_name(q::Int64) -> String
Used to set the default value of the names of the variables. The default value is "v".