Skip to content
Permalink
Browse files

docs for ocp nlp set opt vars, set constraints, set cost, set dynamics

  • Loading branch information...
jkoendev committed Apr 8, 2019
1 parent 9c8b527 commit 0f91249ceb0d47b437ac2796f37f768405bc14b6
Showing with 38 additions and 8 deletions.
  1. +34 −4 acados/ocp_nlp/ocp_nlp_common.h
  2. +4 −4 examples/c/engine_example.c
@@ -127,16 +127,46 @@ int ocp_nlp_dims_calculate_size(void *config);
ocp_nlp_dims *ocp_nlp_dims_assign_self(int N, void *raw_memory);
//
ocp_nlp_dims *ocp_nlp_dims_assign(void *config, void *raw_memory);
//

/// Sets the dimension of optimization variables
/// (states, constrols, algebraic variables, slack variables).
///
/// \param config_ The configuration object.
/// \param dims_ The dimensions object.
/// \param field The type of optimization variables, either nx, nu, nz, or ns.
/// \param value_array Number of variables for each stage.
void ocp_nlp_dims_set_opt_vars(void *config_, void *dims_,
const char *field, const void* value_array);
//

/// Sets the dimensions of constraints functions for a stage
/// (bounds on states, bounds on controls, equality constraints,
/// inequality constraints).
///
/// \param config_ The configuration object.
/// \param dims_ The dimensions object.
/// \param stage Stage number.
/// \param field The type of constraint/bound, either nbx, nbu, ng, or nh.
/// \param value_field Number of constraints/bounds for the given stage.
void ocp_nlp_dims_set_constraints(void *config_, void *dims_, int stage,
const char *field, const void* value_field);
//

/// Sets the dimensions of the cost terms for a stage.
///
/// \param config_ The configuration object.
/// \param dims_ The dimensions object.
/// \param stage Stage number.
/// \param field Type of cost term, can be eiter ny (or others TBC).
/// \param value_field Number of cost terms/residuals for the given stage.
void ocp_nlp_dims_set_cost(void *config_, void *dims_, int stage, const char *field,
const void* value_field);
//

/// Sets the dimensions of the dynamics for a stage.
///
/// \param config_ The configuration object.
/// \param dims_ The dimensions object.
/// \param stage Stage number.
/// \param field TBD
/// \param value TBD
void ocp_nlp_dims_set_dynamics(void *config_, void *dims_, int stage, const char *field,
const void* value);

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with acados; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* Author: Jonathan Frey, Robin Verschueren
*/

@@ -249,7 +249,7 @@ int main()

for (int i = 0; i < nb[0]; ++i)
constraints[0]->idxb[i] = idxb[i];

for (int i = 1; i < N; ++i)
{
ocp_nlp_constraints_model_set(config, dims, nlp_in, i, "lb", lb);
@@ -295,7 +295,7 @@ int main()
status = ocp_nlp_cost_model_set(config, dims, nlp_in, j, "y_ref", y_ref);

status = ocp_nlp_solve(solver, nlp_in, nlp_out);

blasfeo_print_to_file_dvec(out_file, nu[0]+nx[0], nlp_out->ux, 0);

blasfeo_unpack_dvec(nx[1], nlp_out->ux+1, nu[1], &lb_0[nu[1]]);
@@ -318,7 +318,7 @@ int main()
ocp_nlp_dims_destroy(dims);
ocp_nlp_config_destroy(config);
ocp_nlp_plan_destroy(plan);

/* free external function */
// implicit model
external_function_casadi_free(&impl_dae_fun);

0 comments on commit 0f91249

Please sign in to comment.
You can’t perform that action at this time.