alphaville / optimization-engine

Nonconvex embedded optimization: code generation for fast real-time optimization + ROS support
https://alphaville.github.io/optimization-engine/
Other
499 stars 53 forks source link

MATLAB code generation in absence of penalty function #87

Closed alphaville closed 4 years ago

alphaville commented 5 years ago

Describe the bug I'm posting this on behalf of another user. On Windows, using the MATLAB interface of OpEn, compilation fails when no penalty function is provided.

To Reproduce

If I am running the following code first:

builder = OpEnOptimizerBuilder()...
    .with_problem(u, z0, cost, constraints)...
    .with_build_name('matlab_test_1_new')...
    .with_build_mode('release')...
    .with_constraints_as_penalties(c)...
    .with_fpr_tolerance(1e-4)...
    .with_max_iterations(500);
optimizer = builder.build();

and then

builder = OpEnOptimizerBuilder()...
    .with_problem(u, z0, cost, constraints)...
    .with_build_name('matlab_test_1_new')...
    .with_build_mode('release')...
    .with_constraints_as_penalties([])...
    .with_fpr_tolerance(1e-4)...
    .with_max_iterations(500);
optimizer = builder.build();

it is working. If I am doing it in the reverse order (using a clean / empty folder), I am getting the following error message when using .with_constraints_as_penalties([]):

image002

Actually, the compiler is trying to find auto_casadi_constraints_type_penalty.c although it is not there (as we have chosen .with_constraints_as_penalties([])). If I am building the code with penalty constraints first, then the related file is actually there - in the reverse order this is not the case.

System information:

Windows OS. Note: Cannot reproduce on Linux.