Skip to content

[Dev] Default options #552

@ocots

Description

@ocots
function build_adnlp_model(
        initial_guess::CTModels.AbstractOptimalControlInitialGuess;
        backend,
        kwargs...
    )::ADNLPModels.ADNLPModel

    .....

        # build NLP
        nlp = ADNLPModel!(
            f,
            init,
            docp.bounds.var_l,
            docp.bounds.var_u,
            c!,
            docp.bounds.con_l,
            docp.bounds.con_u;
            minimize=(!docp.flags.max),
            backend_options...,
            unused_backends...,
            kwargs...,
        )

        return nlp
    end

    # NLP builder for ExaModels
    # +++ recheck kwargs passing / default with Olivier
    function build_exa_model(
        ::Type{BaseType}, 
        initial_guess::CTModels.AbstractOptimalControlInitialGuess; 
        backend
    )::ExaModels.ExaModel where {BaseType<:AbstractFloat}

        # recover discretization scheme and size
        scheme = Strategies.options(discretizer)[:scheme]
        grid_size = Strategies.options(discretizer)[:grid_size]

        # build initial guess
        init = get_docp_initial_guess(:exa, docp, initial_guess)

        # build Exa model and getters
        # +++ later try to call Exa constructor here if possible, reusing existing functions...
        build_exa = CTModels.get_build_examodel(ocp)
        nlp, exa_getter = build_exa(;
            grid_size=grid_size,
            backend=backend,
            scheme=scheme,
            init=init,
            base_type=BaseType,
        )

        return nlp
    end

Metadata

Metadata

Labels

internal devModification to the code is requested and should not affect user experiment

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions