Private API

This page lists non-exported (internal) symbols of CTModels.OCP.


From CTModels.OCP

__collect_used_names

CTModels.OCP.__collect_used_namesFunction
__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_labelFunction
__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

__control_components

CTModels.OCP.__control_componentsFunction
__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_nameFunction
__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_typeFunction
__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_importFunction
__filename_export_import() -> String

Return the default filename (without extension) for exporting and importing solutions.

The default value is "solution".

__format

CTModels.OCP.__formatFunction
__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_conflictFunction
__has_name_conflict(ocp::PreModel, new_name::String, exclude_component::Symbol=:none)::Bool

Check if a name conflicts with existing names in the PreModel.

Arguments

  • ocp::PreModel: The model to check against
  • new_name::String: The new name to check
  • exclude_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: true if conflict exists, false otherwise

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)
false

See also: __collect_used_names, __validate_name_uniqueness

__state_components

CTModels.OCP.__state_componentsFunction
__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_nameFunction
__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_nameFunction
__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_uniquenessFunction
__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:

  1. Name is not empty
  2. Components are not empty
  3. Name not in components (internal conflict)
  4. No duplicates in components
  5. No conflicts with existing names in other components (global uniqueness)

Arguments

  • ocp::PreModel: The model to validate against
  • name::String: The component name
  • components::Vector{String}: The component names
  • component_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" conflicts

See also: __has_name_conflict, __collect_used_names

__variable_components

CTModels.OCP.__variable_componentsFunction
__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_nameFunction
__variable_name(q::Int64) -> String

Used to set the default value of the names of the variables. The default value is "v".