Closed alphaville closed 4 years ago
Corrected versions of F1
and F2
in interface.c
:
/* ------MAPPING F1------------------------------------------------------------- */
int mapping_f1_function(const casadi_real** arg, casadi_real** res) {
const casadi_real* args__[F1_SZ_ARG] = {uxip_space, uxip_space + NU + NXI};
copy_args_into_up_space(arg);
result_space_f1[0] = res[0];
return {{build_config.alm_mapping_f1_function_name}}(
args__,
result_space_f1,
allocated_i_workspace_f1,
allocated_r_workspace_f1,
(void*) 0);
}
/* ------MAPPING F2------------------------------------------------------------- */
int mapping_f2_function(const casadi_real** arg, casadi_real** res) {
const casadi_real* args__[F2_SZ_ARG] = {uxip_space, uxip_space + NU + NXI};
copy_args_into_up_space(arg);
result_space_f2[0] = res[0];
return {{build_config.constraint_penalty_function_name}}(
args__,
result_space_f2,
allocated_i_workspace_f2,
allocated_r_workspace_f2,
(void*) 0);
}
Describe the bug
I noticed that when
F1
andF2
depend onp
, although the algorithm converges, there are issues with termination. After digging a little deeper, I realised that parameterp
is actually not passed toF1
andF2
properly. I was able to locate the issue ininterface.c
- see below for details.To Reproduce
Minimum working example:
Expected behavior
In the above MWE, we obtain a solution with
u[0]
being very close to0.5
, however, the value ofF2
at the solution is0.49999
. It turns out that the reason is how we copyp
ininterface.c
(lines 261 and 276).Additional context
I'll fix it in a new branch.