wip
This commit is contained in:
96
selfdrive/controls/lib/longitudinal_mpc_lib/SConscript
Normal file
96
selfdrive/controls/lib/longitudinal_mpc_lib/SConscript
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
Import('env', 'envCython', 'arch', 'messaging_python', 'common_python', 'opendbc_python')
|
||||||
|
|
||||||
|
gen = "c_generated_code"
|
||||||
|
|
||||||
|
casadi_model = [
|
||||||
|
f'{gen}/long_model/long_expl_ode_fun.c',
|
||||||
|
f'{gen}/long_model/long_expl_vde_forw.c',
|
||||||
|
]
|
||||||
|
|
||||||
|
casadi_cost_y = [
|
||||||
|
f'{gen}/long_cost/long_cost_y_fun.c',
|
||||||
|
f'{gen}/long_cost/long_cost_y_fun_jac_ut_xt.c',
|
||||||
|
f'{gen}/long_cost/long_cost_y_hess.c',
|
||||||
|
]
|
||||||
|
|
||||||
|
casadi_cost_e = [
|
||||||
|
f'{gen}/long_cost/long_cost_y_e_fun.c',
|
||||||
|
f'{gen}/long_cost/long_cost_y_e_fun_jac_ut_xt.c',
|
||||||
|
f'{gen}/long_cost/long_cost_y_e_hess.c',
|
||||||
|
]
|
||||||
|
|
||||||
|
casadi_cost_0 = [
|
||||||
|
f'{gen}/long_cost/long_cost_y_0_fun.c',
|
||||||
|
f'{gen}/long_cost/long_cost_y_0_fun_jac_ut_xt.c',
|
||||||
|
f'{gen}/long_cost/long_cost_y_0_hess.c',
|
||||||
|
]
|
||||||
|
|
||||||
|
casadi_constraints = [
|
||||||
|
f'{gen}/long_constraints/long_constr_h_fun.c',
|
||||||
|
f'{gen}/long_constraints/long_constr_h_fun_jac_uxt_zt.c',
|
||||||
|
]
|
||||||
|
|
||||||
|
build_files = [f'{gen}/acados_solver_long.c'] + casadi_model + casadi_cost_y + casadi_cost_e + \
|
||||||
|
casadi_cost_0 + casadi_constraints
|
||||||
|
|
||||||
|
# extra generated files used to trigger a rebuild
|
||||||
|
generated_files = [
|
||||||
|
f'{gen}/Makefile',
|
||||||
|
|
||||||
|
f'{gen}/main_long.c',
|
||||||
|
f'{gen}/main_sim_long.c',
|
||||||
|
f'{gen}/acados_solver_long.h',
|
||||||
|
f'{gen}/acados_sim_solver_long.h',
|
||||||
|
f'{gen}/acados_sim_solver_long.c',
|
||||||
|
f'{gen}/acados_solver.pxd',
|
||||||
|
|
||||||
|
f'{gen}/long_model/long_expl_vde_adj.c',
|
||||||
|
|
||||||
|
f'{gen}/long_model/long_model.h',
|
||||||
|
f'{gen}/long_constraints/long_constraints.h',
|
||||||
|
f'{gen}/long_cost/long_cost.h',
|
||||||
|
] + build_files
|
||||||
|
|
||||||
|
acados_dir = '#third_party/acados'
|
||||||
|
acados_templates_dir = '#third_party/acados/acados_template/c_templates_tera'
|
||||||
|
|
||||||
|
source_list = ['long_mpc.py',
|
||||||
|
'#selfdrive/modeld/constants.py',
|
||||||
|
f'{acados_dir}/include/acados_c/ocp_nlp_interface.h',
|
||||||
|
f'{acados_templates_dir}/acados_solver.in.c',
|
||||||
|
]
|
||||||
|
|
||||||
|
lenv = env.Clone()
|
||||||
|
lenv.Clean(generated_files, Dir(gen))
|
||||||
|
|
||||||
|
generated_long = lenv.Command(generated_files,
|
||||||
|
source_list,
|
||||||
|
f"cd {Dir('.').abspath} && python3 long_mpc.py")
|
||||||
|
lenv.Depends(generated_long, [messaging_python, common_python, opendbc_python])
|
||||||
|
|
||||||
|
lenv["CFLAGS"].append("-DACADOS_WITH_QPOASES")
|
||||||
|
lenv["CXXFLAGS"].append("-DACADOS_WITH_QPOASES")
|
||||||
|
lenv["CCFLAGS"].append("-Wno-unused")
|
||||||
|
if arch != "Darwin":
|
||||||
|
lenv["LINKFLAGS"].append("-Wl,--disable-new-dtags")
|
||||||
|
lib_solver = lenv.SharedLibrary(f"{gen}/acados_ocp_solver_long",
|
||||||
|
build_files,
|
||||||
|
LIBS=['m', 'acados', 'hpipm', 'blasfeo', 'qpOASES_e'])
|
||||||
|
|
||||||
|
# generate cython stuff
|
||||||
|
acados_ocp_solver_pyx = File("#third_party/acados/acados_template/acados_ocp_solver_pyx.pyx")
|
||||||
|
acados_ocp_solver_common = File("#third_party/acados/acados_template/acados_solver_common.pxd")
|
||||||
|
libacados_ocp_solver_pxd = File(f'{gen}/acados_solver.pxd')
|
||||||
|
libacados_ocp_solver_c = File(f'{gen}/acados_ocp_solver_pyx.c')
|
||||||
|
|
||||||
|
lenv2 = envCython.Clone()
|
||||||
|
lenv2["LINKFLAGS"] += [lib_solver[0].get_labspath()]
|
||||||
|
lenv2.Command(libacados_ocp_solver_c,
|
||||||
|
[acados_ocp_solver_pyx, acados_ocp_solver_common, libacados_ocp_solver_pxd],
|
||||||
|
f'cython' + \
|
||||||
|
f' -o {libacados_ocp_solver_c.get_labspath()}' + \
|
||||||
|
f' -I {libacados_ocp_solver_pxd.get_dir().get_labspath()}' + \
|
||||||
|
f' -I {acados_ocp_solver_common.get_dir().get_labspath()}' + \
|
||||||
|
f' {acados_ocp_solver_pyx.get_labspath()}')
|
||||||
|
lib_cython = lenv2.Program(f'{gen}/acados_ocp_solver_pyx.so', [libacados_ocp_solver_c])
|
||||||
|
lenv2.Depends(lib_cython, lib_solver)
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) The acados authors.
|
|
||||||
#
|
|
||||||
# This file is part of acados.
|
|
||||||
#
|
|
||||||
# The 2-Clause BSD License
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
# this list of conditions and the following disclaimer.
|
|
||||||
#
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
# this list of conditions and the following disclaimer in the documentation
|
|
||||||
# and/or other materials provided with the distribution.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.;
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# define sources and use make's implicit rules to generate object files (*.o)
|
|
||||||
|
|
||||||
# model
|
|
||||||
MODEL_SRC=
|
|
||||||
MODEL_SRC+= long_model/long_expl_ode_fun.c
|
|
||||||
MODEL_SRC+= long_model/long_expl_vde_forw.c
|
|
||||||
MODEL_SRC+= long_model/long_expl_vde_adj.c
|
|
||||||
MODEL_OBJ := $(MODEL_SRC:.c=.o)
|
|
||||||
|
|
||||||
# optimal control problem - mostly CasADi exports
|
|
||||||
OCP_SRC=
|
|
||||||
OCP_SRC+= long_constraints/long_constr_h_fun_jac_uxt_zt.c
|
|
||||||
OCP_SRC+= long_constraints/long_constr_h_fun.c
|
|
||||||
OCP_SRC+= long_cost/long_cost_y_0_fun.c
|
|
||||||
OCP_SRC+= long_cost/long_cost_y_0_fun_jac_ut_xt.c
|
|
||||||
OCP_SRC+= long_cost/long_cost_y_0_hess.c
|
|
||||||
OCP_SRC+= long_cost/long_cost_y_fun.c
|
|
||||||
OCP_SRC+= long_cost/long_cost_y_fun_jac_ut_xt.c
|
|
||||||
OCP_SRC+= long_cost/long_cost_y_hess.c
|
|
||||||
OCP_SRC+= long_cost/long_cost_y_e_fun.c
|
|
||||||
OCP_SRC+= long_cost/long_cost_y_e_fun_jac_ut_xt.c
|
|
||||||
OCP_SRC+= long_cost/long_cost_y_e_hess.c
|
|
||||||
|
|
||||||
OCP_SRC+= acados_solver_long.c
|
|
||||||
OCP_OBJ := $(OCP_SRC:.c=.o)
|
|
||||||
|
|
||||||
# for sim solver
|
|
||||||
SIM_SRC= acados_sim_solver_long.c
|
|
||||||
SIM_OBJ := $(SIM_SRC:.c=.o)
|
|
||||||
|
|
||||||
# for target example
|
|
||||||
EX_SRC= main_long.c
|
|
||||||
EX_OBJ := $(EX_SRC:.c=.o)
|
|
||||||
EX_EXE := $(EX_SRC:.c=)
|
|
||||||
|
|
||||||
# for target example_sim
|
|
||||||
EX_SIM_SRC= main_sim_long.c
|
|
||||||
EX_SIM_OBJ := $(EX_SIM_SRC:.c=.o)
|
|
||||||
EX_SIM_EXE := $(EX_SIM_SRC:.c=)
|
|
||||||
|
|
||||||
# combine model, sim and ocp object files
|
|
||||||
OBJ=
|
|
||||||
OBJ+= $(MODEL_OBJ)
|
|
||||||
OBJ+= $(SIM_OBJ)
|
|
||||||
OBJ+= $(OCP_OBJ)
|
|
||||||
|
|
||||||
EXTERNAL_DIR=
|
|
||||||
EXTERNAL_LIB=
|
|
||||||
|
|
||||||
INCLUDE_PATH = /data/openpilot/third_party/acados/include
|
|
||||||
LIB_PATH = /data/openpilot/third_party/acados/lib
|
|
||||||
|
|
||||||
# preprocessor flags for make's implicit rules
|
|
||||||
CPPFLAGS+= -I$(INCLUDE_PATH)
|
|
||||||
CPPFLAGS+= -I$(INCLUDE_PATH)/acados
|
|
||||||
CPPFLAGS+= -I$(INCLUDE_PATH)/blasfeo/include
|
|
||||||
CPPFLAGS+= -I$(INCLUDE_PATH)/hpipm/include
|
|
||||||
|
|
||||||
|
|
||||||
# define the c-compiler flags for make's implicit rules
|
|
||||||
CFLAGS = -fPIC -std=c99 -O2#-fno-diagnostics-show-line-numbers -g
|
|
||||||
# # Debugging
|
|
||||||
# CFLAGS += -g3
|
|
||||||
|
|
||||||
# linker flags
|
|
||||||
LDFLAGS+= -L$(LIB_PATH)
|
|
||||||
|
|
||||||
# link to libraries
|
|
||||||
LDLIBS+= -lacados
|
|
||||||
LDLIBS+= -lhpipm
|
|
||||||
LDLIBS+= -lblasfeo
|
|
||||||
LDLIBS+= -lm
|
|
||||||
LDLIBS+=
|
|
||||||
|
|
||||||
# libraries
|
|
||||||
LIBACADOS_SOLVER=libacados_solver_long.so
|
|
||||||
LIBACADOS_OCP_SOLVER=libacados_ocp_solver_long.so
|
|
||||||
LIBACADOS_SIM_SOLVER=lib$(SIM_SRC:.c=.so)
|
|
||||||
|
|
||||||
# virtual targets
|
|
||||||
.PHONY : all clean
|
|
||||||
|
|
||||||
#all: clean example_sim example shared_lib
|
|
||||||
|
|
||||||
all: clean example_sim example
|
|
||||||
shared_lib: bundled_shared_lib ocp_shared_lib sim_shared_lib
|
|
||||||
|
|
||||||
# some linker targets
|
|
||||||
example: $(EX_OBJ) $(OBJ)
|
|
||||||
$(CC) $^ -o $(EX_EXE) $(LDFLAGS) $(LDLIBS)
|
|
||||||
|
|
||||||
example_sim: $(EX_SIM_OBJ) $(MODEL_OBJ) $(SIM_OBJ)
|
|
||||||
$(CC) $^ -o $(EX_SIM_EXE) $(LDFLAGS) $(LDLIBS)
|
|
||||||
|
|
||||||
bundled_shared_lib: $(OBJ)
|
|
||||||
$(CC) -shared $^ -o $(LIBACADOS_SOLVER) $(LDFLAGS) $(LDLIBS)
|
|
||||||
|
|
||||||
ocp_shared_lib: $(OCP_OBJ) $(MODEL_OBJ)
|
|
||||||
$(CC) -shared $^ -o $(LIBACADOS_OCP_SOLVER) $(LDFLAGS) $(LDLIBS) \
|
|
||||||
-L$(EXTERNAL_DIR) -l$(EXTERNAL_LIB)
|
|
||||||
|
|
||||||
sim_shared_lib: $(SIM_OBJ) $(MODEL_OBJ)
|
|
||||||
$(CC) -shared $^ -o $(LIBACADOS_SIM_SOLVER) $(LDFLAGS) $(LDLIBS)
|
|
||||||
|
|
||||||
|
|
||||||
# Cython targets
|
|
||||||
ocp_cython_c: ocp_shared_lib
|
|
||||||
cython \
|
|
||||||
-o acados_ocp_solver_pyx.c \
|
|
||||||
-I $(INCLUDE_PATH)/../interfaces/acados_template/acados_template \
|
|
||||||
$(INCLUDE_PATH)/../interfaces/acados_template/acados_template/acados_ocp_solver_pyx.pyx \
|
|
||||||
-I /data/openpilot/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code \
|
|
||||||
|
|
||||||
ocp_cython_o: ocp_cython_c
|
|
||||||
$(CC) $(ACADOS_FLAGS) -c -O2 \
|
|
||||||
-fPIC \
|
|
||||||
-o acados_ocp_solver_pyx.o \
|
|
||||||
-I $(INCLUDE_PATH)/blasfeo/include/ \
|
|
||||||
-I $(INCLUDE_PATH)/hpipm/include/ \
|
|
||||||
-I $(INCLUDE_PATH) \
|
|
||||||
-I /usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/core/include \
|
|
||||||
-I /usr/local/pyenv/versions/3.11.4/include/python3.11 \
|
|
||||||
acados_ocp_solver_pyx.c \
|
|
||||||
|
|
||||||
ocp_cython: ocp_cython_o
|
|
||||||
$(CC) $(ACADOS_FLAGS) -shared \
|
|
||||||
-o acados_ocp_solver_pyx.so \
|
|
||||||
-Wl,-rpath=$(LIB_PATH) \
|
|
||||||
acados_ocp_solver_pyx.o \
|
|
||||||
$(abspath .)/libacados_ocp_solver_long.so \
|
|
||||||
$(LDFLAGS) $(LDLIBS)
|
|
||||||
|
|
||||||
# Sim Cython targets
|
|
||||||
sim_cython_c: sim_shared_lib
|
|
||||||
cython \
|
|
||||||
-o acados_sim_solver_pyx.c \
|
|
||||||
-I $(INCLUDE_PATH)/../interfaces/acados_template/acados_template \
|
|
||||||
$(INCLUDE_PATH)/../interfaces/acados_template/acados_template/acados_sim_solver_pyx.pyx \
|
|
||||||
-I /data/openpilot/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code \
|
|
||||||
|
|
||||||
sim_cython_o: sim_cython_c
|
|
||||||
$(CC) $(ACADOS_FLAGS) -c -O2 \
|
|
||||||
-fPIC \
|
|
||||||
-o acados_sim_solver_pyx.o \
|
|
||||||
-I $(INCLUDE_PATH)/blasfeo/include/ \
|
|
||||||
-I $(INCLUDE_PATH)/hpipm/include/ \
|
|
||||||
-I $(INCLUDE_PATH) \
|
|
||||||
-I /usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/core/include \
|
|
||||||
-I /usr/local/pyenv/versions/3.11.4/include/python3.11 \
|
|
||||||
acados_sim_solver_pyx.c \
|
|
||||||
|
|
||||||
sim_cython: sim_cython_o
|
|
||||||
$(CC) $(ACADOS_FLAGS) -shared \
|
|
||||||
-o acados_sim_solver_pyx.so \
|
|
||||||
-Wl,-rpath=$(LIB_PATH) \
|
|
||||||
acados_sim_solver_pyx.o \
|
|
||||||
$(abspath .)/libacados_sim_solver_long.so \
|
|
||||||
$(LDFLAGS) $(LDLIBS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(RM) $(OBJ) $(EX_OBJ) $(EX_SIM_OBJ)
|
|
||||||
$(RM) $(LIBACADOS_SOLVER) $(LIBACADOS_OCP_SOLVER) $(LIBACADOS_SIM_SOLVER)
|
|
||||||
$(RM) $(EX_EXE) $(EX_SIM_EXE)
|
|
||||||
|
|
||||||
clean_ocp_shared_lib:
|
|
||||||
$(RM) $(LIBACADOS_OCP_SOLVER)
|
|
||||||
$(RM) $(OCP_OBJ)
|
|
||||||
|
|
||||||
clean_ocp_cython:
|
|
||||||
$(RM) libacados_ocp_solver_long.so
|
|
||||||
$(RM) acados_solver_long.o
|
|
||||||
$(RM) acados_ocp_solver_pyx.so
|
|
||||||
$(RM) acados_ocp_solver_pyx.o
|
|
||||||
|
|
||||||
clean_sim_cython:
|
|
||||||
$(RM) libacados_sim_solver_long.so
|
|
||||||
$(RM) acados_sim_solver_long.o
|
|
||||||
$(RM) acados_sim_solver_pyx.so
|
|
||||||
$(RM) acados_sim_solver_pyx.o
|
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,294 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) The acados authors.
|
|
||||||
*
|
|
||||||
* This file is part of acados.
|
|
||||||
*
|
|
||||||
* The 2-Clause BSD License
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.;
|
|
||||||
*/
|
|
||||||
// standard
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
// acados
|
|
||||||
#include "acados_c/external_function_interface.h"
|
|
||||||
#include "acados_c/sim_interface.h"
|
|
||||||
#include "acados_c/external_function_interface.h"
|
|
||||||
|
|
||||||
#include "acados/sim/sim_common.h"
|
|
||||||
#include "acados/utils/external_function_generic.h"
|
|
||||||
#include "acados/utils/print.h"
|
|
||||||
|
|
||||||
|
|
||||||
// example specific
|
|
||||||
#include "long_model/long_model.h"
|
|
||||||
#include "acados_sim_solver_long.h"
|
|
||||||
|
|
||||||
|
|
||||||
// ** solver data **
|
|
||||||
|
|
||||||
sim_solver_capsule * long_acados_sim_solver_create_capsule()
|
|
||||||
{
|
|
||||||
void* capsule_mem = malloc(sizeof(sim_solver_capsule));
|
|
||||||
sim_solver_capsule *capsule = (sim_solver_capsule *) capsule_mem;
|
|
||||||
|
|
||||||
return capsule;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int long_acados_sim_solver_free_capsule(sim_solver_capsule * capsule)
|
|
||||||
{
|
|
||||||
free(capsule);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int long_acados_sim_create(sim_solver_capsule * capsule)
|
|
||||||
{
|
|
||||||
// initialize
|
|
||||||
const int nx = LONG_NX;
|
|
||||||
const int nu = LONG_NU;
|
|
||||||
const int nz = LONG_NZ;
|
|
||||||
const int np = LONG_NP;
|
|
||||||
bool tmp_bool;
|
|
||||||
|
|
||||||
|
|
||||||
double Tsim = 0.06944444444444445;
|
|
||||||
|
|
||||||
|
|
||||||
// explicit ode
|
|
||||||
capsule->sim_forw_vde_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi));
|
|
||||||
capsule->sim_vde_adj_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi));
|
|
||||||
capsule->sim_expl_ode_fun_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi));
|
|
||||||
|
|
||||||
capsule->sim_forw_vde_casadi->casadi_fun = &long_expl_vde_forw;
|
|
||||||
capsule->sim_forw_vde_casadi->casadi_n_in = &long_expl_vde_forw_n_in;
|
|
||||||
capsule->sim_forw_vde_casadi->casadi_n_out = &long_expl_vde_forw_n_out;
|
|
||||||
capsule->sim_forw_vde_casadi->casadi_sparsity_in = &long_expl_vde_forw_sparsity_in;
|
|
||||||
capsule->sim_forw_vde_casadi->casadi_sparsity_out = &long_expl_vde_forw_sparsity_out;
|
|
||||||
capsule->sim_forw_vde_casadi->casadi_work = &long_expl_vde_forw_work;
|
|
||||||
external_function_param_casadi_create(capsule->sim_forw_vde_casadi, np);
|
|
||||||
|
|
||||||
capsule->sim_vde_adj_casadi->casadi_fun = &long_expl_vde_adj;
|
|
||||||
capsule->sim_vde_adj_casadi->casadi_n_in = &long_expl_vde_adj_n_in;
|
|
||||||
capsule->sim_vde_adj_casadi->casadi_n_out = &long_expl_vde_adj_n_out;
|
|
||||||
capsule->sim_vde_adj_casadi->casadi_sparsity_in = &long_expl_vde_adj_sparsity_in;
|
|
||||||
capsule->sim_vde_adj_casadi->casadi_sparsity_out = &long_expl_vde_adj_sparsity_out;
|
|
||||||
capsule->sim_vde_adj_casadi->casadi_work = &long_expl_vde_adj_work;
|
|
||||||
external_function_param_casadi_create(capsule->sim_vde_adj_casadi, np);
|
|
||||||
|
|
||||||
capsule->sim_expl_ode_fun_casadi->casadi_fun = &long_expl_ode_fun;
|
|
||||||
capsule->sim_expl_ode_fun_casadi->casadi_n_in = &long_expl_ode_fun_n_in;
|
|
||||||
capsule->sim_expl_ode_fun_casadi->casadi_n_out = &long_expl_ode_fun_n_out;
|
|
||||||
capsule->sim_expl_ode_fun_casadi->casadi_sparsity_in = &long_expl_ode_fun_sparsity_in;
|
|
||||||
capsule->sim_expl_ode_fun_casadi->casadi_sparsity_out = &long_expl_ode_fun_sparsity_out;
|
|
||||||
capsule->sim_expl_ode_fun_casadi->casadi_work = &long_expl_ode_fun_work;
|
|
||||||
external_function_param_casadi_create(capsule->sim_expl_ode_fun_casadi, np);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// sim plan & config
|
|
||||||
sim_solver_plan_t plan;
|
|
||||||
plan.sim_solver = ERK;
|
|
||||||
|
|
||||||
// create correct config based on plan
|
|
||||||
sim_config * long_sim_config = sim_config_create(plan);
|
|
||||||
capsule->acados_sim_config = long_sim_config;
|
|
||||||
|
|
||||||
// sim dims
|
|
||||||
void *long_sim_dims = sim_dims_create(long_sim_config);
|
|
||||||
capsule->acados_sim_dims = long_sim_dims;
|
|
||||||
sim_dims_set(long_sim_config, long_sim_dims, "nx", &nx);
|
|
||||||
sim_dims_set(long_sim_config, long_sim_dims, "nu", &nu);
|
|
||||||
sim_dims_set(long_sim_config, long_sim_dims, "nz", &nz);
|
|
||||||
|
|
||||||
|
|
||||||
// sim opts
|
|
||||||
sim_opts *long_sim_opts = sim_opts_create(long_sim_config, long_sim_dims);
|
|
||||||
capsule->acados_sim_opts = long_sim_opts;
|
|
||||||
int tmp_int = 3;
|
|
||||||
sim_opts_set(long_sim_config, long_sim_opts, "newton_iter", &tmp_int);
|
|
||||||
double tmp_double = 0.0;
|
|
||||||
sim_opts_set(long_sim_config, long_sim_opts, "newton_tol", &tmp_double);
|
|
||||||
sim_collocation_type collocation_type = GAUSS_LEGENDRE;
|
|
||||||
sim_opts_set(long_sim_config, long_sim_opts, "collocation_type", &collocation_type);
|
|
||||||
|
|
||||||
|
|
||||||
tmp_int = 4;
|
|
||||||
sim_opts_set(long_sim_config, long_sim_opts, "num_stages", &tmp_int);
|
|
||||||
tmp_int = 1;
|
|
||||||
sim_opts_set(long_sim_config, long_sim_opts, "num_steps", &tmp_int);
|
|
||||||
tmp_bool = 0;
|
|
||||||
sim_opts_set(long_sim_config, long_sim_opts, "jac_reuse", &tmp_bool);
|
|
||||||
|
|
||||||
|
|
||||||
// sim in / out
|
|
||||||
sim_in *long_sim_in = sim_in_create(long_sim_config, long_sim_dims);
|
|
||||||
capsule->acados_sim_in = long_sim_in;
|
|
||||||
sim_out *long_sim_out = sim_out_create(long_sim_config, long_sim_dims);
|
|
||||||
capsule->acados_sim_out = long_sim_out;
|
|
||||||
|
|
||||||
sim_in_set(long_sim_config, long_sim_dims,
|
|
||||||
long_sim_in, "T", &Tsim);
|
|
||||||
|
|
||||||
// model functions
|
|
||||||
long_sim_config->model_set(long_sim_in->model,
|
|
||||||
"expl_vde_forw", capsule->sim_forw_vde_casadi);
|
|
||||||
long_sim_config->model_set(long_sim_in->model,
|
|
||||||
"expl_vde_adj", capsule->sim_vde_adj_casadi);
|
|
||||||
long_sim_config->model_set(long_sim_in->model,
|
|
||||||
"expl_ode_fun", capsule->sim_expl_ode_fun_casadi);
|
|
||||||
|
|
||||||
// sim solver
|
|
||||||
sim_solver *long_sim_solver = sim_solver_create(long_sim_config,
|
|
||||||
long_sim_dims, long_sim_opts);
|
|
||||||
capsule->acados_sim_solver = long_sim_solver;
|
|
||||||
|
|
||||||
|
|
||||||
/* initialize parameter values */
|
|
||||||
double* p = calloc(np, sizeof(double));
|
|
||||||
|
|
||||||
p[0] = -1.2;
|
|
||||||
p[1] = 1.2;
|
|
||||||
p[4] = 1.45;
|
|
||||||
p[5] = 0.75;
|
|
||||||
|
|
||||||
long_acados_sim_update_params(capsule, p, np);
|
|
||||||
free(p);
|
|
||||||
|
|
||||||
|
|
||||||
/* initialize input */
|
|
||||||
// x
|
|
||||||
double x0[3];
|
|
||||||
for (int ii = 0; ii < 3; ii++)
|
|
||||||
x0[ii] = 0.0;
|
|
||||||
|
|
||||||
sim_in_set(long_sim_config, long_sim_dims,
|
|
||||||
long_sim_in, "x", x0);
|
|
||||||
|
|
||||||
|
|
||||||
// u
|
|
||||||
double u0[1];
|
|
||||||
for (int ii = 0; ii < 1; ii++)
|
|
||||||
u0[ii] = 0.0;
|
|
||||||
|
|
||||||
sim_in_set(long_sim_config, long_sim_dims,
|
|
||||||
long_sim_in, "u", u0);
|
|
||||||
|
|
||||||
// S_forw
|
|
||||||
double S_forw[12];
|
|
||||||
for (int ii = 0; ii < 12; ii++)
|
|
||||||
S_forw[ii] = 0.0;
|
|
||||||
for (int ii = 0; ii < 3; ii++)
|
|
||||||
S_forw[ii + ii * 3 ] = 1.0;
|
|
||||||
|
|
||||||
|
|
||||||
sim_in_set(long_sim_config, long_sim_dims,
|
|
||||||
long_sim_in, "S_forw", S_forw);
|
|
||||||
|
|
||||||
int status = sim_precompute(long_sim_solver, long_sim_in, long_sim_out);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int long_acados_sim_solve(sim_solver_capsule *capsule)
|
|
||||||
{
|
|
||||||
// integrate dynamics using acados sim_solver
|
|
||||||
int status = sim_solve(capsule->acados_sim_solver,
|
|
||||||
capsule->acados_sim_in, capsule->acados_sim_out);
|
|
||||||
if (status != 0)
|
|
||||||
printf("error in long_acados_sim_solve()! Exiting.\n");
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int long_acados_sim_free(sim_solver_capsule *capsule)
|
|
||||||
{
|
|
||||||
// free memory
|
|
||||||
sim_solver_destroy(capsule->acados_sim_solver);
|
|
||||||
sim_in_destroy(capsule->acados_sim_in);
|
|
||||||
sim_out_destroy(capsule->acados_sim_out);
|
|
||||||
sim_opts_destroy(capsule->acados_sim_opts);
|
|
||||||
sim_dims_destroy(capsule->acados_sim_dims);
|
|
||||||
sim_config_destroy(capsule->acados_sim_config);
|
|
||||||
|
|
||||||
// free external function
|
|
||||||
external_function_param_casadi_free(capsule->sim_forw_vde_casadi);
|
|
||||||
external_function_param_casadi_free(capsule->sim_vde_adj_casadi);
|
|
||||||
external_function_param_casadi_free(capsule->sim_expl_ode_fun_casadi);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int long_acados_sim_update_params(sim_solver_capsule *capsule, double *p, int np)
|
|
||||||
{
|
|
||||||
int status = 0;
|
|
||||||
int casadi_np = LONG_NP;
|
|
||||||
|
|
||||||
if (casadi_np != np) {
|
|
||||||
printf("long_acados_sim_update_params: trying to set %i parameters for external functions."
|
|
||||||
" External function has %i parameters. Exiting.\n", np, casadi_np);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
capsule->sim_forw_vde_casadi[0].set_param(capsule->sim_forw_vde_casadi, p);
|
|
||||||
capsule->sim_vde_adj_casadi[0].set_param(capsule->sim_vde_adj_casadi, p);
|
|
||||||
capsule->sim_expl_ode_fun_casadi[0].set_param(capsule->sim_expl_ode_fun_casadi, p);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* getters pointers to C objects*/
|
|
||||||
sim_config * long_acados_get_sim_config(sim_solver_capsule *capsule)
|
|
||||||
{
|
|
||||||
return capsule->acados_sim_config;
|
|
||||||
};
|
|
||||||
|
|
||||||
sim_in * long_acados_get_sim_in(sim_solver_capsule *capsule)
|
|
||||||
{
|
|
||||||
return capsule->acados_sim_in;
|
|
||||||
};
|
|
||||||
|
|
||||||
sim_out * long_acados_get_sim_out(sim_solver_capsule *capsule)
|
|
||||||
{
|
|
||||||
return capsule->acados_sim_out;
|
|
||||||
};
|
|
||||||
|
|
||||||
void * long_acados_get_sim_dims(sim_solver_capsule *capsule)
|
|
||||||
{
|
|
||||||
return capsule->acados_sim_dims;
|
|
||||||
};
|
|
||||||
|
|
||||||
sim_opts * long_acados_get_sim_opts(sim_solver_capsule *capsule)
|
|
||||||
{
|
|
||||||
return capsule->acados_sim_opts;
|
|
||||||
};
|
|
||||||
|
|
||||||
sim_solver * long_acados_get_sim_solver(sim_solver_capsule *capsule)
|
|
||||||
{
|
|
||||||
return capsule->acados_sim_solver;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) The acados authors.
|
|
||||||
#
|
|
||||||
# This file is part of acados.
|
|
||||||
#
|
|
||||||
# The 2-Clause BSD License
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
# this list of conditions and the following disclaimer.
|
|
||||||
#
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
# this list of conditions and the following disclaimer in the documentation
|
|
||||||
# and/or other materials provided with the distribution.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.;
|
|
||||||
#
|
|
||||||
|
|
||||||
cimport acados_solver_common
|
|
||||||
|
|
||||||
cdef extern from "acados_solver_long.h":
|
|
||||||
ctypedef struct nlp_solver_capsule "long_solver_capsule":
|
|
||||||
pass
|
|
||||||
|
|
||||||
nlp_solver_capsule * acados_create_capsule "long_acados_create_capsule"()
|
|
||||||
int acados_free_capsule "long_acados_free_capsule"(nlp_solver_capsule *capsule)
|
|
||||||
|
|
||||||
int acados_create "long_acados_create"(nlp_solver_capsule * capsule)
|
|
||||||
|
|
||||||
int acados_create_with_discretization "long_acados_create_with_discretization"(nlp_solver_capsule * capsule, int n_time_steps, double* new_time_steps)
|
|
||||||
int acados_update_time_steps "long_acados_update_time_steps"(nlp_solver_capsule * capsule, int N, double* new_time_steps)
|
|
||||||
int acados_update_qp_solver_cond_N "long_acados_update_qp_solver_cond_N"(nlp_solver_capsule * capsule, int qp_solver_cond_N)
|
|
||||||
|
|
||||||
int acados_update_params "long_acados_update_params"(nlp_solver_capsule * capsule, int stage, double *value, int np_)
|
|
||||||
int acados_update_params_sparse "long_acados_update_params_sparse"(nlp_solver_capsule * capsule, int stage, int *idx, double *p, int n_update)
|
|
||||||
int acados_solve "long_acados_solve"(nlp_solver_capsule * capsule)
|
|
||||||
int acados_reset "long_acados_reset"(nlp_solver_capsule * capsule, int reset_qp_solver_mem)
|
|
||||||
int acados_free "long_acados_free"(nlp_solver_capsule * capsule)
|
|
||||||
void acados_print_stats "long_acados_print_stats"(nlp_solver_capsule * capsule)
|
|
||||||
|
|
||||||
int acados_custom_update "long_acados_custom_update"(nlp_solver_capsule* capsule, double * data, int data_len)
|
|
||||||
|
|
||||||
acados_solver_common.ocp_nlp_in *acados_get_nlp_in "long_acados_get_nlp_in"(nlp_solver_capsule * capsule)
|
|
||||||
acados_solver_common.ocp_nlp_out *acados_get_nlp_out "long_acados_get_nlp_out"(nlp_solver_capsule * capsule)
|
|
||||||
acados_solver_common.ocp_nlp_out *acados_get_sens_out "long_acados_get_sens_out"(nlp_solver_capsule * capsule)
|
|
||||||
acados_solver_common.ocp_nlp_solver *acados_get_nlp_solver "long_acados_get_nlp_solver"(nlp_solver_capsule * capsule)
|
|
||||||
acados_solver_common.ocp_nlp_config *acados_get_nlp_config "long_acados_get_nlp_config"(nlp_solver_capsule * capsule)
|
|
||||||
void *acados_get_nlp_opts "long_acados_get_nlp_opts"(nlp_solver_capsule * capsule)
|
|
||||||
acados_solver_common.ocp_nlp_dims *acados_get_nlp_dims "long_acados_get_nlp_dims"(nlp_solver_capsule * capsule)
|
|
||||||
acados_solver_common.ocp_nlp_plan *acados_get_nlp_plan "long_acados_get_nlp_plan"(nlp_solver_capsule * capsule)
|
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,179 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_constr_h_fun_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
#define casadi_s4 CASADI_PREFIX(s4)
|
|
||||||
#define casadi_sq CASADI_PREFIX(sq)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
casadi_real casadi_sq(casadi_real x) { return x*x;}
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[5] = {1, 1, 0, 1, 0};
|
|
||||||
static const casadi_int casadi_s2[3] = {0, 0, 0};
|
|
||||||
static const casadi_int casadi_s3[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
static const casadi_int casadi_s4[8] = {4, 1, 0, 4, 0, 1, 2, 3};
|
|
||||||
|
|
||||||
/* long_constr_h_fun:(i0[3],i1,i2[],i3[6])->(o0[4]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1, a2, a3, a4;
|
|
||||||
a0=arg[0]? arg[0][1] : 0;
|
|
||||||
if (res[0]!=0) res[0][0]=a0;
|
|
||||||
a1=arg[0]? arg[0][2] : 0;
|
|
||||||
a2=arg[3]? arg[3][0] : 0;
|
|
||||||
a2=(a1-a2);
|
|
||||||
if (res[0]!=0) res[0][1]=a2;
|
|
||||||
a2=arg[3]? arg[3][1] : 0;
|
|
||||||
a2=(a2-a1);
|
|
||||||
if (res[0]!=0) res[0][2]=a2;
|
|
||||||
a2=arg[3]? arg[3][2] : 0;
|
|
||||||
a1=arg[0]? arg[0][0] : 0;
|
|
||||||
a2=(a2-a1);
|
|
||||||
a1=arg[3]? arg[3][5] : 0;
|
|
||||||
a3=casadi_sq(a0);
|
|
||||||
a4=5.;
|
|
||||||
a3=(a3/a4);
|
|
||||||
a4=arg[3]? arg[3][4] : 0;
|
|
||||||
a4=(a4*a0);
|
|
||||||
a3=(a3+a4);
|
|
||||||
a4=6.;
|
|
||||||
a3=(a3+a4);
|
|
||||||
a1=(a1*a3);
|
|
||||||
a2=(a2-a1);
|
|
||||||
a1=10.;
|
|
||||||
a0=(a0+a1);
|
|
||||||
a2=(a2/a0);
|
|
||||||
if (res[0]!=0) res[0][3]=a2;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_constr_h_fun(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_constr_h_fun_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_constr_h_fun_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_constr_h_fun_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_constr_h_fun_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_constr_h_fun_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_constr_h_fun_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_constr_h_fun_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_constr_h_fun_n_in(void) { return 4;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_constr_h_fun_n_out(void) { return 1;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_constr_h_fun_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_constr_h_fun_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_constr_h_fun_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_constr_h_fun_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s2;
|
|
||||||
case 3: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_constr_h_fun_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s4;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_constr_h_fun_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 4;
|
|
||||||
if (sz_res) *sz_res = 1;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_constr_h_fun_jac_uxt_zt_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
#define casadi_s4 CASADI_PREFIX(s4)
|
|
||||||
#define casadi_s5 CASADI_PREFIX(s5)
|
|
||||||
#define casadi_s6 CASADI_PREFIX(s6)
|
|
||||||
#define casadi_sq CASADI_PREFIX(sq)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
casadi_real casadi_sq(casadi_real x) { return x*x;}
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[5] = {1, 1, 0, 1, 0};
|
|
||||||
static const casadi_int casadi_s2[3] = {0, 0, 0};
|
|
||||||
static const casadi_int casadi_s3[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
static const casadi_int casadi_s4[8] = {4, 1, 0, 4, 0, 1, 2, 3};
|
|
||||||
static const casadi_int casadi_s5[12] = {4, 4, 0, 1, 2, 3, 5, 2, 3, 3, 1, 2};
|
|
||||||
static const casadi_int casadi_s6[3] = {4, 0, 0};
|
|
||||||
|
|
||||||
/* long_constr_h_fun_jac_uxt_zt:(i0[3],i1,i2[],i3[6])->(o0[4],o1[4x4,5nz],o2[4x0]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1, a2, a3, a4, a5;
|
|
||||||
a0=arg[0]? arg[0][1] : 0;
|
|
||||||
if (res[0]!=0) res[0][0]=a0;
|
|
||||||
a1=arg[0]? arg[0][2] : 0;
|
|
||||||
a2=arg[3]? arg[3][0] : 0;
|
|
||||||
a2=(a1-a2);
|
|
||||||
if (res[0]!=0) res[0][1]=a2;
|
|
||||||
a2=arg[3]? arg[3][1] : 0;
|
|
||||||
a2=(a2-a1);
|
|
||||||
if (res[0]!=0) res[0][2]=a2;
|
|
||||||
a2=arg[3]? arg[3][2] : 0;
|
|
||||||
a1=arg[0]? arg[0][0] : 0;
|
|
||||||
a2=(a2-a1);
|
|
||||||
a1=arg[3]? arg[3][5] : 0;
|
|
||||||
a3=casadi_sq(a0);
|
|
||||||
a4=5.;
|
|
||||||
a3=(a3/a4);
|
|
||||||
a4=arg[3]? arg[3][4] : 0;
|
|
||||||
a5=(a4*a0);
|
|
||||||
a3=(a3+a5);
|
|
||||||
a5=6.;
|
|
||||||
a3=(a3+a5);
|
|
||||||
a3=(a1*a3);
|
|
||||||
a2=(a2-a3);
|
|
||||||
a3=10.;
|
|
||||||
a3=(a0+a3);
|
|
||||||
a2=(a2/a3);
|
|
||||||
if (res[0]!=0) res[0][3]=a2;
|
|
||||||
a5=1.;
|
|
||||||
if (res[1]!=0) res[1][0]=a5;
|
|
||||||
if (res[1]!=0) res[1][1]=a5;
|
|
||||||
a5=-1.;
|
|
||||||
if (res[1]!=0) res[1][2]=a5;
|
|
||||||
a5=(1./a3);
|
|
||||||
a5=(-a5);
|
|
||||||
if (res[1]!=0) res[1][3]=a5;
|
|
||||||
a5=2.0000000000000001e-01;
|
|
||||||
a0=(a0+a0);
|
|
||||||
a5=(a5*a0);
|
|
||||||
a5=(a5+a4);
|
|
||||||
a1=(a1*a5);
|
|
||||||
a1=(a1/a3);
|
|
||||||
a2=(a2/a3);
|
|
||||||
a1=(a1+a2);
|
|
||||||
a1=(-a1);
|
|
||||||
if (res[1]!=0) res[1][4]=a1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_constr_h_fun_jac_uxt_zt(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_constr_h_fun_jac_uxt_zt_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_constr_h_fun_jac_uxt_zt_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_constr_h_fun_jac_uxt_zt_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_constr_h_fun_jac_uxt_zt_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_constr_h_fun_jac_uxt_zt_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_constr_h_fun_jac_uxt_zt_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_constr_h_fun_jac_uxt_zt_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_constr_h_fun_jac_uxt_zt_n_in(void) { return 4;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_constr_h_fun_jac_uxt_zt_n_out(void) { return 3;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_constr_h_fun_jac_uxt_zt_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_constr_h_fun_jac_uxt_zt_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_constr_h_fun_jac_uxt_zt_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
case 1: return "o1";
|
|
||||||
case 2: return "o2";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_constr_h_fun_jac_uxt_zt_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s2;
|
|
||||||
case 3: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_constr_h_fun_jac_uxt_zt_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s4;
|
|
||||||
case 1: return casadi_s5;
|
|
||||||
case 2: return casadi_s6;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_constr_h_fun_jac_uxt_zt_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 4;
|
|
||||||
if (sz_res) *sz_res = 3;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,176 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_cost_y_0_fun_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
#define casadi_sq CASADI_PREFIX(sq)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
casadi_real casadi_sq(casadi_real x) { return x*x;}
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[5] = {1, 1, 0, 1, 0};
|
|
||||||
static const casadi_int casadi_s2[3] = {0, 0, 0};
|
|
||||||
static const casadi_int casadi_s3[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
|
|
||||||
/* long_cost_y_0_fun:(i0[3],i1,i2[],i3[6])->(o0[6]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1, a2, a3, a4;
|
|
||||||
a0=arg[3]? arg[3][2] : 0;
|
|
||||||
a1=arg[0]? arg[0][0] : 0;
|
|
||||||
a0=(a0-a1);
|
|
||||||
a2=arg[0]? arg[0][1] : 0;
|
|
||||||
a3=casadi_sq(a2);
|
|
||||||
a4=5.;
|
|
||||||
a3=(a3/a4);
|
|
||||||
a4=arg[3]? arg[3][4] : 0;
|
|
||||||
a4=(a4*a2);
|
|
||||||
a3=(a3+a4);
|
|
||||||
a4=6.;
|
|
||||||
a3=(a3+a4);
|
|
||||||
a0=(a0-a3);
|
|
||||||
a3=10.;
|
|
||||||
a3=(a2+a3);
|
|
||||||
a0=(a0/a3);
|
|
||||||
if (res[0]!=0) res[0][0]=a0;
|
|
||||||
if (res[0]!=0) res[0][1]=a1;
|
|
||||||
if (res[0]!=0) res[0][2]=a2;
|
|
||||||
a2=arg[0]? arg[0][2] : 0;
|
|
||||||
if (res[0]!=0) res[0][3]=a2;
|
|
||||||
a1=arg[3]? arg[3][3] : 0;
|
|
||||||
a2=(a2-a1);
|
|
||||||
if (res[0]!=0) res[0][4]=a2;
|
|
||||||
a2=arg[1]? arg[1][0] : 0;
|
|
||||||
if (res[0]!=0) res[0][5]=a2;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_fun(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_fun_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_fun_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_fun_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_fun_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_fun_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_fun_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_fun_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_0_fun_n_in(void) { return 4;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_0_fun_n_out(void) { return 1;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_cost_y_0_fun_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_0_fun_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_0_fun_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_0_fun_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s2;
|
|
||||||
case 3: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_0_fun_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_fun_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 4;
|
|
||||||
if (sz_res) *sz_res = 1;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,202 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_cost_y_0_fun_jac_ut_xt_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
#define casadi_s4 CASADI_PREFIX(s4)
|
|
||||||
#define casadi_s5 CASADI_PREFIX(s5)
|
|
||||||
#define casadi_sq CASADI_PREFIX(sq)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
casadi_real casadi_sq(casadi_real x) { return x*x;}
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[5] = {1, 1, 0, 1, 0};
|
|
||||||
static const casadi_int casadi_s2[3] = {0, 0, 0};
|
|
||||||
static const casadi_int casadi_s3[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
static const casadi_int casadi_s4[16] = {4, 6, 0, 2, 3, 4, 5, 6, 7, 1, 2, 1, 2, 3, 3, 0};
|
|
||||||
static const casadi_int casadi_s5[3] = {6, 0, 0};
|
|
||||||
|
|
||||||
/* long_cost_y_0_fun_jac_ut_xt:(i0[3],i1,i2[],i3[6])->(o0[6],o1[4x6,7nz],o2[6x0]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1, a2, a3, a4, a5;
|
|
||||||
a0=arg[3]? arg[3][2] : 0;
|
|
||||||
a1=arg[0]? arg[0][0] : 0;
|
|
||||||
a0=(a0-a1);
|
|
||||||
a2=arg[0]? arg[0][1] : 0;
|
|
||||||
a3=casadi_sq(a2);
|
|
||||||
a4=5.;
|
|
||||||
a3=(a3/a4);
|
|
||||||
a4=arg[3]? arg[3][4] : 0;
|
|
||||||
a5=(a4*a2);
|
|
||||||
a3=(a3+a5);
|
|
||||||
a5=6.;
|
|
||||||
a3=(a3+a5);
|
|
||||||
a0=(a0-a3);
|
|
||||||
a3=10.;
|
|
||||||
a3=(a2+a3);
|
|
||||||
a0=(a0/a3);
|
|
||||||
if (res[0]!=0) res[0][0]=a0;
|
|
||||||
if (res[0]!=0) res[0][1]=a1;
|
|
||||||
if (res[0]!=0) res[0][2]=a2;
|
|
||||||
a1=arg[0]? arg[0][2] : 0;
|
|
||||||
if (res[0]!=0) res[0][3]=a1;
|
|
||||||
a5=arg[3]? arg[3][3] : 0;
|
|
||||||
a1=(a1-a5);
|
|
||||||
if (res[0]!=0) res[0][4]=a1;
|
|
||||||
a1=arg[1]? arg[1][0] : 0;
|
|
||||||
if (res[0]!=0) res[0][5]=a1;
|
|
||||||
a1=(1./a3);
|
|
||||||
a1=(-a1);
|
|
||||||
if (res[1]!=0) res[1][0]=a1;
|
|
||||||
a1=2.0000000000000001e-01;
|
|
||||||
a2=(a2+a2);
|
|
||||||
a1=(a1*a2);
|
|
||||||
a1=(a1+a4);
|
|
||||||
a1=(a1/a3);
|
|
||||||
a0=(a0/a3);
|
|
||||||
a1=(a1+a0);
|
|
||||||
a1=(-a1);
|
|
||||||
if (res[1]!=0) res[1][1]=a1;
|
|
||||||
a1=1.;
|
|
||||||
if (res[1]!=0) res[1][2]=a1;
|
|
||||||
if (res[1]!=0) res[1][3]=a1;
|
|
||||||
if (res[1]!=0) res[1][4]=a1;
|
|
||||||
if (res[1]!=0) res[1][5]=a1;
|
|
||||||
if (res[1]!=0) res[1][6]=a1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_fun_jac_ut_xt(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_fun_jac_ut_xt_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_fun_jac_ut_xt_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_fun_jac_ut_xt_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_fun_jac_ut_xt_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_fun_jac_ut_xt_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_fun_jac_ut_xt_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_fun_jac_ut_xt_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_0_fun_jac_ut_xt_n_in(void) { return 4;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_0_fun_jac_ut_xt_n_out(void) { return 3;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_cost_y_0_fun_jac_ut_xt_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_0_fun_jac_ut_xt_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_0_fun_jac_ut_xt_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
case 1: return "o1";
|
|
||||||
case 2: return "o2";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_0_fun_jac_ut_xt_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s2;
|
|
||||||
case 3: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_0_fun_jac_ut_xt_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s3;
|
|
||||||
case 1: return casadi_s4;
|
|
||||||
case 2: return casadi_s5;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_fun_jac_ut_xt_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 4;
|
|
||||||
if (sz_res) *sz_res = 3;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,201 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_cost_y_0_hess_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
#define casadi_s4 CASADI_PREFIX(s4)
|
|
||||||
#define casadi_sq CASADI_PREFIX(sq)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
casadi_real casadi_sq(casadi_real x) { return x*x;}
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[5] = {1, 1, 0, 1, 0};
|
|
||||||
static const casadi_int casadi_s2[3] = {0, 0, 0};
|
|
||||||
static const casadi_int casadi_s3[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
static const casadi_int casadi_s4[10] = {4, 4, 0, 0, 1, 3, 3, 2, 1, 2};
|
|
||||||
|
|
||||||
/* long_cost_y_0_hess:(i0[3],i1,i2[],i3[6],i4[6])->(o0[4x4,3nz]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1, a10, a2, a3, a4, a5, a6, a7, a8, a9;
|
|
||||||
a0=arg[3]? arg[3][0] : 0;
|
|
||||||
a1=arg[0]? arg[0][1] : 0;
|
|
||||||
a2=10.;
|
|
||||||
a2=(a1+a2);
|
|
||||||
a3=(1./a2);
|
|
||||||
a3=(a3/a2);
|
|
||||||
a3=(a0*a3);
|
|
||||||
if (res[0]!=0) res[0][0]=a3;
|
|
||||||
a3=(a0/a2);
|
|
||||||
a4=(a3/a2);
|
|
||||||
if (res[0]!=0) res[0][1]=a4;
|
|
||||||
a5=2.0000000000000001e-01;
|
|
||||||
a6=(a1+a1);
|
|
||||||
a6=(a5*a6);
|
|
||||||
a7=arg[4]? arg[4][4] : 0;
|
|
||||||
a6=(a6+a7);
|
|
||||||
a6=(a6/a2);
|
|
||||||
a8=arg[4]? arg[4][2] : 0;
|
|
||||||
a9=arg[0]? arg[0][0] : 0;
|
|
||||||
a8=(a8-a9);
|
|
||||||
a9=casadi_sq(a1);
|
|
||||||
a10=5.;
|
|
||||||
a9=(a9/a10);
|
|
||||||
a10=(a7*a1);
|
|
||||||
a9=(a9+a10);
|
|
||||||
a10=6.;
|
|
||||||
a9=(a9+a10);
|
|
||||||
a8=(a8-a9);
|
|
||||||
a8=(a8/a2);
|
|
||||||
a9=(a8/a2);
|
|
||||||
a6=(a6+a9);
|
|
||||||
a6=(a6/a2);
|
|
||||||
a8=(a8/a2);
|
|
||||||
a8=(a8/a2);
|
|
||||||
a6=(a6+a8);
|
|
||||||
a0=(a0*a6);
|
|
||||||
a7=(a7*a4);
|
|
||||||
a0=(a0+a7);
|
|
||||||
a7=2.;
|
|
||||||
a3=(a5*a3);
|
|
||||||
a7=(a7*a3);
|
|
||||||
a1=(a1+a1);
|
|
||||||
a5=(a5*a4);
|
|
||||||
a1=(a1*a5);
|
|
||||||
a7=(a7-a1);
|
|
||||||
a0=(a0-a7);
|
|
||||||
if (res[0]!=0) res[0][2]=a0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_hess(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_hess_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_hess_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_hess_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_hess_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_hess_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_hess_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_0_hess_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_0_hess_n_in(void) { return 5;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_0_hess_n_out(void) { return 1;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_cost_y_0_hess_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_0_hess_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
case 4: return "i4";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_0_hess_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_0_hess_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s2;
|
|
||||||
case 3: return casadi_s3;
|
|
||||||
case 4: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_0_hess_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s4;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_0_hess_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 5;
|
|
||||||
if (sz_res) *sz_res = 1;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_cost_y_e_fun_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
#define casadi_sq CASADI_PREFIX(sq)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
casadi_real casadi_sq(casadi_real x) { return x*x;}
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[3] = {0, 0, 0};
|
|
||||||
static const casadi_int casadi_s2[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
static const casadi_int casadi_s3[9] = {5, 1, 0, 5, 0, 1, 2, 3, 4};
|
|
||||||
|
|
||||||
/* long_cost_y_e_fun:(i0[3],i1[],i2[],i3[6])->(o0[5]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1, a2, a3, a4;
|
|
||||||
a0=arg[3]? arg[3][2] : 0;
|
|
||||||
a1=arg[0]? arg[0][0] : 0;
|
|
||||||
a0=(a0-a1);
|
|
||||||
a2=arg[0]? arg[0][1] : 0;
|
|
||||||
a3=casadi_sq(a2);
|
|
||||||
a4=5.;
|
|
||||||
a3=(a3/a4);
|
|
||||||
a4=arg[3]? arg[3][4] : 0;
|
|
||||||
a4=(a4*a2);
|
|
||||||
a3=(a3+a4);
|
|
||||||
a4=6.;
|
|
||||||
a3=(a3+a4);
|
|
||||||
a0=(a0-a3);
|
|
||||||
a3=10.;
|
|
||||||
a3=(a2+a3);
|
|
||||||
a0=(a0/a3);
|
|
||||||
if (res[0]!=0) res[0][0]=a0;
|
|
||||||
if (res[0]!=0) res[0][1]=a1;
|
|
||||||
if (res[0]!=0) res[0][2]=a2;
|
|
||||||
a2=arg[0]? arg[0][2] : 0;
|
|
||||||
if (res[0]!=0) res[0][3]=a2;
|
|
||||||
a1=arg[3]? arg[3][3] : 0;
|
|
||||||
a2=(a2-a1);
|
|
||||||
if (res[0]!=0) res[0][4]=a2;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_fun(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_fun_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_fun_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_fun_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_fun_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_fun_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_fun_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_fun_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_e_fun_n_in(void) { return 4;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_e_fun_n_out(void) { return 1;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_cost_y_e_fun_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_e_fun_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_e_fun_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_e_fun_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s1;
|
|
||||||
case 3: return casadi_s2;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_e_fun_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_fun_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 4;
|
|
||||||
if (sz_res) *sz_res = 1;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,199 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_cost_y_e_fun_jac_ut_xt_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
#define casadi_s4 CASADI_PREFIX(s4)
|
|
||||||
#define casadi_s5 CASADI_PREFIX(s5)
|
|
||||||
#define casadi_sq CASADI_PREFIX(sq)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
casadi_real casadi_sq(casadi_real x) { return x*x;}
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[3] = {0, 0, 0};
|
|
||||||
static const casadi_int casadi_s2[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
static const casadi_int casadi_s3[9] = {5, 1, 0, 5, 0, 1, 2, 3, 4};
|
|
||||||
static const casadi_int casadi_s4[14] = {3, 5, 0, 2, 3, 4, 5, 6, 0, 1, 0, 1, 2, 2};
|
|
||||||
static const casadi_int casadi_s5[3] = {5, 0, 0};
|
|
||||||
|
|
||||||
/* long_cost_y_e_fun_jac_ut_xt:(i0[3],i1[],i2[],i3[6])->(o0[5],o1[3x5,6nz],o2[5x0]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1, a2, a3, a4, a5;
|
|
||||||
a0=arg[3]? arg[3][2] : 0;
|
|
||||||
a1=arg[0]? arg[0][0] : 0;
|
|
||||||
a0=(a0-a1);
|
|
||||||
a2=arg[0]? arg[0][1] : 0;
|
|
||||||
a3=casadi_sq(a2);
|
|
||||||
a4=5.;
|
|
||||||
a3=(a3/a4);
|
|
||||||
a4=arg[3]? arg[3][4] : 0;
|
|
||||||
a5=(a4*a2);
|
|
||||||
a3=(a3+a5);
|
|
||||||
a5=6.;
|
|
||||||
a3=(a3+a5);
|
|
||||||
a0=(a0-a3);
|
|
||||||
a3=10.;
|
|
||||||
a3=(a2+a3);
|
|
||||||
a0=(a0/a3);
|
|
||||||
if (res[0]!=0) res[0][0]=a0;
|
|
||||||
if (res[0]!=0) res[0][1]=a1;
|
|
||||||
if (res[0]!=0) res[0][2]=a2;
|
|
||||||
a1=arg[0]? arg[0][2] : 0;
|
|
||||||
if (res[0]!=0) res[0][3]=a1;
|
|
||||||
a5=arg[3]? arg[3][3] : 0;
|
|
||||||
a1=(a1-a5);
|
|
||||||
if (res[0]!=0) res[0][4]=a1;
|
|
||||||
a1=(1./a3);
|
|
||||||
a1=(-a1);
|
|
||||||
if (res[1]!=0) res[1][0]=a1;
|
|
||||||
a1=2.0000000000000001e-01;
|
|
||||||
a2=(a2+a2);
|
|
||||||
a1=(a1*a2);
|
|
||||||
a1=(a1+a4);
|
|
||||||
a1=(a1/a3);
|
|
||||||
a0=(a0/a3);
|
|
||||||
a1=(a1+a0);
|
|
||||||
a1=(-a1);
|
|
||||||
if (res[1]!=0) res[1][1]=a1;
|
|
||||||
a1=1.;
|
|
||||||
if (res[1]!=0) res[1][2]=a1;
|
|
||||||
if (res[1]!=0) res[1][3]=a1;
|
|
||||||
if (res[1]!=0) res[1][4]=a1;
|
|
||||||
if (res[1]!=0) res[1][5]=a1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_fun_jac_ut_xt(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_fun_jac_ut_xt_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_fun_jac_ut_xt_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_fun_jac_ut_xt_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_fun_jac_ut_xt_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_fun_jac_ut_xt_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_fun_jac_ut_xt_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_fun_jac_ut_xt_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_e_fun_jac_ut_xt_n_in(void) { return 4;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_e_fun_jac_ut_xt_n_out(void) { return 3;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_cost_y_e_fun_jac_ut_xt_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_e_fun_jac_ut_xt_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_e_fun_jac_ut_xt_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
case 1: return "o1";
|
|
||||||
case 2: return "o2";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_e_fun_jac_ut_xt_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s1;
|
|
||||||
case 3: return casadi_s2;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_e_fun_jac_ut_xt_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s3;
|
|
||||||
case 1: return casadi_s4;
|
|
||||||
case 2: return casadi_s5;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_fun_jac_ut_xt_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 4;
|
|
||||||
if (sz_res) *sz_res = 3;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,201 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_cost_y_e_hess_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
#define casadi_s4 CASADI_PREFIX(s4)
|
|
||||||
#define casadi_sq CASADI_PREFIX(sq)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
casadi_real casadi_sq(casadi_real x) { return x*x;}
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[3] = {0, 0, 0};
|
|
||||||
static const casadi_int casadi_s2[9] = {5, 1, 0, 5, 0, 1, 2, 3, 4};
|
|
||||||
static const casadi_int casadi_s3[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
static const casadi_int casadi_s4[9] = {3, 3, 0, 1, 3, 3, 1, 0, 1};
|
|
||||||
|
|
||||||
/* long_cost_y_e_hess:(i0[3],i1[],i2[],i3[5],i4[6])->(o0[3x3,3nz]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1, a10, a2, a3, a4, a5, a6, a7, a8, a9;
|
|
||||||
a0=arg[3]? arg[3][0] : 0;
|
|
||||||
a1=arg[0]? arg[0][1] : 0;
|
|
||||||
a2=10.;
|
|
||||||
a2=(a1+a2);
|
|
||||||
a3=(1./a2);
|
|
||||||
a3=(a3/a2);
|
|
||||||
a3=(a0*a3);
|
|
||||||
if (res[0]!=0) res[0][0]=a3;
|
|
||||||
a3=(a0/a2);
|
|
||||||
a4=(a3/a2);
|
|
||||||
if (res[0]!=0) res[0][1]=a4;
|
|
||||||
a5=2.0000000000000001e-01;
|
|
||||||
a6=(a1+a1);
|
|
||||||
a6=(a5*a6);
|
|
||||||
a7=arg[4]? arg[4][4] : 0;
|
|
||||||
a6=(a6+a7);
|
|
||||||
a6=(a6/a2);
|
|
||||||
a8=arg[4]? arg[4][2] : 0;
|
|
||||||
a9=arg[0]? arg[0][0] : 0;
|
|
||||||
a8=(a8-a9);
|
|
||||||
a9=casadi_sq(a1);
|
|
||||||
a10=5.;
|
|
||||||
a9=(a9/a10);
|
|
||||||
a10=(a7*a1);
|
|
||||||
a9=(a9+a10);
|
|
||||||
a10=6.;
|
|
||||||
a9=(a9+a10);
|
|
||||||
a8=(a8-a9);
|
|
||||||
a8=(a8/a2);
|
|
||||||
a9=(a8/a2);
|
|
||||||
a6=(a6+a9);
|
|
||||||
a6=(a6/a2);
|
|
||||||
a8=(a8/a2);
|
|
||||||
a8=(a8/a2);
|
|
||||||
a6=(a6+a8);
|
|
||||||
a0=(a0*a6);
|
|
||||||
a7=(a7*a4);
|
|
||||||
a0=(a0+a7);
|
|
||||||
a7=2.;
|
|
||||||
a3=(a5*a3);
|
|
||||||
a7=(a7*a3);
|
|
||||||
a1=(a1+a1);
|
|
||||||
a5=(a5*a4);
|
|
||||||
a1=(a1*a5);
|
|
||||||
a7=(a7-a1);
|
|
||||||
a0=(a0-a7);
|
|
||||||
if (res[0]!=0) res[0][2]=a0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_hess(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_hess_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_hess_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_hess_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_hess_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_hess_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_hess_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_e_hess_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_e_hess_n_in(void) { return 5;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_e_hess_n_out(void) { return 1;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_cost_y_e_hess_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_e_hess_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
case 4: return "i4";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_e_hess_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_e_hess_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s1;
|
|
||||||
case 3: return casadi_s2;
|
|
||||||
case 4: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_e_hess_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s4;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_e_hess_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 5;
|
|
||||||
if (sz_res) *sz_res = 1;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,176 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_cost_y_fun_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
#define casadi_sq CASADI_PREFIX(sq)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
casadi_real casadi_sq(casadi_real x) { return x*x;}
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[5] = {1, 1, 0, 1, 0};
|
|
||||||
static const casadi_int casadi_s2[3] = {0, 0, 0};
|
|
||||||
static const casadi_int casadi_s3[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
|
|
||||||
/* long_cost_y_fun:(i0[3],i1,i2[],i3[6])->(o0[6]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1, a2, a3, a4;
|
|
||||||
a0=arg[3]? arg[3][2] : 0;
|
|
||||||
a1=arg[0]? arg[0][0] : 0;
|
|
||||||
a0=(a0-a1);
|
|
||||||
a2=arg[0]? arg[0][1] : 0;
|
|
||||||
a3=casadi_sq(a2);
|
|
||||||
a4=5.;
|
|
||||||
a3=(a3/a4);
|
|
||||||
a4=arg[3]? arg[3][4] : 0;
|
|
||||||
a4=(a4*a2);
|
|
||||||
a3=(a3+a4);
|
|
||||||
a4=6.;
|
|
||||||
a3=(a3+a4);
|
|
||||||
a0=(a0-a3);
|
|
||||||
a3=10.;
|
|
||||||
a3=(a2+a3);
|
|
||||||
a0=(a0/a3);
|
|
||||||
if (res[0]!=0) res[0][0]=a0;
|
|
||||||
if (res[0]!=0) res[0][1]=a1;
|
|
||||||
if (res[0]!=0) res[0][2]=a2;
|
|
||||||
a2=arg[0]? arg[0][2] : 0;
|
|
||||||
if (res[0]!=0) res[0][3]=a2;
|
|
||||||
a1=arg[3]? arg[3][3] : 0;
|
|
||||||
a2=(a2-a1);
|
|
||||||
if (res[0]!=0) res[0][4]=a2;
|
|
||||||
a2=arg[1]? arg[1][0] : 0;
|
|
||||||
if (res[0]!=0) res[0][5]=a2;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_fun(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_fun_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_fun_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_fun_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_fun_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_fun_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_fun_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_fun_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_fun_n_in(void) { return 4;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_fun_n_out(void) { return 1;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_cost_y_fun_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_fun_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_fun_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_fun_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s2;
|
|
||||||
case 3: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_fun_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_fun_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 4;
|
|
||||||
if (sz_res) *sz_res = 1;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,202 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_cost_y_fun_jac_ut_xt_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
#define casadi_s4 CASADI_PREFIX(s4)
|
|
||||||
#define casadi_s5 CASADI_PREFIX(s5)
|
|
||||||
#define casadi_sq CASADI_PREFIX(sq)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
casadi_real casadi_sq(casadi_real x) { return x*x;}
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[5] = {1, 1, 0, 1, 0};
|
|
||||||
static const casadi_int casadi_s2[3] = {0, 0, 0};
|
|
||||||
static const casadi_int casadi_s3[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
static const casadi_int casadi_s4[16] = {4, 6, 0, 2, 3, 4, 5, 6, 7, 1, 2, 1, 2, 3, 3, 0};
|
|
||||||
static const casadi_int casadi_s5[3] = {6, 0, 0};
|
|
||||||
|
|
||||||
/* long_cost_y_fun_jac_ut_xt:(i0[3],i1,i2[],i3[6])->(o0[6],o1[4x6,7nz],o2[6x0]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1, a2, a3, a4, a5;
|
|
||||||
a0=arg[3]? arg[3][2] : 0;
|
|
||||||
a1=arg[0]? arg[0][0] : 0;
|
|
||||||
a0=(a0-a1);
|
|
||||||
a2=arg[0]? arg[0][1] : 0;
|
|
||||||
a3=casadi_sq(a2);
|
|
||||||
a4=5.;
|
|
||||||
a3=(a3/a4);
|
|
||||||
a4=arg[3]? arg[3][4] : 0;
|
|
||||||
a5=(a4*a2);
|
|
||||||
a3=(a3+a5);
|
|
||||||
a5=6.;
|
|
||||||
a3=(a3+a5);
|
|
||||||
a0=(a0-a3);
|
|
||||||
a3=10.;
|
|
||||||
a3=(a2+a3);
|
|
||||||
a0=(a0/a3);
|
|
||||||
if (res[0]!=0) res[0][0]=a0;
|
|
||||||
if (res[0]!=0) res[0][1]=a1;
|
|
||||||
if (res[0]!=0) res[0][2]=a2;
|
|
||||||
a1=arg[0]? arg[0][2] : 0;
|
|
||||||
if (res[0]!=0) res[0][3]=a1;
|
|
||||||
a5=arg[3]? arg[3][3] : 0;
|
|
||||||
a1=(a1-a5);
|
|
||||||
if (res[0]!=0) res[0][4]=a1;
|
|
||||||
a1=arg[1]? arg[1][0] : 0;
|
|
||||||
if (res[0]!=0) res[0][5]=a1;
|
|
||||||
a1=(1./a3);
|
|
||||||
a1=(-a1);
|
|
||||||
if (res[1]!=0) res[1][0]=a1;
|
|
||||||
a1=2.0000000000000001e-01;
|
|
||||||
a2=(a2+a2);
|
|
||||||
a1=(a1*a2);
|
|
||||||
a1=(a1+a4);
|
|
||||||
a1=(a1/a3);
|
|
||||||
a0=(a0/a3);
|
|
||||||
a1=(a1+a0);
|
|
||||||
a1=(-a1);
|
|
||||||
if (res[1]!=0) res[1][1]=a1;
|
|
||||||
a1=1.;
|
|
||||||
if (res[1]!=0) res[1][2]=a1;
|
|
||||||
if (res[1]!=0) res[1][3]=a1;
|
|
||||||
if (res[1]!=0) res[1][4]=a1;
|
|
||||||
if (res[1]!=0) res[1][5]=a1;
|
|
||||||
if (res[1]!=0) res[1][6]=a1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_fun_jac_ut_xt(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_fun_jac_ut_xt_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_fun_jac_ut_xt_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_fun_jac_ut_xt_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_fun_jac_ut_xt_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_fun_jac_ut_xt_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_fun_jac_ut_xt_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_fun_jac_ut_xt_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_fun_jac_ut_xt_n_in(void) { return 4;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_fun_jac_ut_xt_n_out(void) { return 3;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_cost_y_fun_jac_ut_xt_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_fun_jac_ut_xt_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_fun_jac_ut_xt_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
case 1: return "o1";
|
|
||||||
case 2: return "o2";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_fun_jac_ut_xt_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s2;
|
|
||||||
case 3: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_fun_jac_ut_xt_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s3;
|
|
||||||
case 1: return casadi_s4;
|
|
||||||
case 2: return casadi_s5;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_fun_jac_ut_xt_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 4;
|
|
||||||
if (sz_res) *sz_res = 3;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,201 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_cost_y_hess_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
#define casadi_s4 CASADI_PREFIX(s4)
|
|
||||||
#define casadi_sq CASADI_PREFIX(sq)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
casadi_real casadi_sq(casadi_real x) { return x*x;}
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[5] = {1, 1, 0, 1, 0};
|
|
||||||
static const casadi_int casadi_s2[3] = {0, 0, 0};
|
|
||||||
static const casadi_int casadi_s3[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
static const casadi_int casadi_s4[10] = {4, 4, 0, 0, 1, 3, 3, 2, 1, 2};
|
|
||||||
|
|
||||||
/* long_cost_y_hess:(i0[3],i1,i2[],i3[6],i4[6])->(o0[4x4,3nz]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1, a10, a2, a3, a4, a5, a6, a7, a8, a9;
|
|
||||||
a0=arg[3]? arg[3][0] : 0;
|
|
||||||
a1=arg[0]? arg[0][1] : 0;
|
|
||||||
a2=10.;
|
|
||||||
a2=(a1+a2);
|
|
||||||
a3=(1./a2);
|
|
||||||
a3=(a3/a2);
|
|
||||||
a3=(a0*a3);
|
|
||||||
if (res[0]!=0) res[0][0]=a3;
|
|
||||||
a3=(a0/a2);
|
|
||||||
a4=(a3/a2);
|
|
||||||
if (res[0]!=0) res[0][1]=a4;
|
|
||||||
a5=2.0000000000000001e-01;
|
|
||||||
a6=(a1+a1);
|
|
||||||
a6=(a5*a6);
|
|
||||||
a7=arg[4]? arg[4][4] : 0;
|
|
||||||
a6=(a6+a7);
|
|
||||||
a6=(a6/a2);
|
|
||||||
a8=arg[4]? arg[4][2] : 0;
|
|
||||||
a9=arg[0]? arg[0][0] : 0;
|
|
||||||
a8=(a8-a9);
|
|
||||||
a9=casadi_sq(a1);
|
|
||||||
a10=5.;
|
|
||||||
a9=(a9/a10);
|
|
||||||
a10=(a7*a1);
|
|
||||||
a9=(a9+a10);
|
|
||||||
a10=6.;
|
|
||||||
a9=(a9+a10);
|
|
||||||
a8=(a8-a9);
|
|
||||||
a8=(a8/a2);
|
|
||||||
a9=(a8/a2);
|
|
||||||
a6=(a6+a9);
|
|
||||||
a6=(a6/a2);
|
|
||||||
a8=(a8/a2);
|
|
||||||
a8=(a8/a2);
|
|
||||||
a6=(a6+a8);
|
|
||||||
a0=(a0*a6);
|
|
||||||
a7=(a7*a4);
|
|
||||||
a0=(a0+a7);
|
|
||||||
a7=2.;
|
|
||||||
a3=(a5*a3);
|
|
||||||
a7=(a7*a3);
|
|
||||||
a1=(a1+a1);
|
|
||||||
a5=(a5*a4);
|
|
||||||
a1=(a1*a5);
|
|
||||||
a7=(a7-a1);
|
|
||||||
a0=(a0-a7);
|
|
||||||
if (res[0]!=0) res[0][2]=a0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_hess(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_hess_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_hess_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_hess_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_hess_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_hess_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_hess_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_cost_y_hess_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_hess_n_in(void) { return 5;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_cost_y_hess_n_out(void) { return 1;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_cost_y_hess_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_hess_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
case 4: return "i4";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_cost_y_hess_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_hess_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s2;
|
|
||||||
case 3: return casadi_s3;
|
|
||||||
case 4: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_cost_y_hess_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s4;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_cost_y_hess_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 5;
|
|
||||||
if (sz_res) *sz_res = 1;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_expl_ode_fun_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[5] = {1, 1, 0, 1, 0};
|
|
||||||
static const casadi_int casadi_s2[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
|
|
||||||
/* long_expl_ode_fun:(i0[3],i1,i2[6])->(o0[3]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0;
|
|
||||||
a0=arg[0]? arg[0][1] : 0;
|
|
||||||
if (res[0]!=0) res[0][0]=a0;
|
|
||||||
a0=arg[0]? arg[0][2] : 0;
|
|
||||||
if (res[0]!=0) res[0][1]=a0;
|
|
||||||
a0=arg[1]? arg[1][0] : 0;
|
|
||||||
if (res[0]!=0) res[0][2]=a0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_ode_fun(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_ode_fun_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_ode_fun_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_ode_fun_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_ode_fun_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_ode_fun_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_ode_fun_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_ode_fun_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_expl_ode_fun_n_in(void) { return 3;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_expl_ode_fun_n_out(void) { return 1;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_expl_ode_fun_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_expl_ode_fun_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_expl_ode_fun_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_expl_ode_fun_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s2;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_expl_ode_fun_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_ode_fun_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 3;
|
|
||||||
if (sz_res) *sz_res = 1;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_expl_vde_adj_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[5] = {1, 1, 0, 1, 0};
|
|
||||||
static const casadi_int casadi_s2[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
static const casadi_int casadi_s3[8] = {4, 1, 0, 4, 0, 1, 2, 3};
|
|
||||||
|
|
||||||
/* long_expl_vde_adj:(i0[3],i1[3],i2,i3[6])->(o0[4]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0;
|
|
||||||
a0=0.;
|
|
||||||
if (res[0]!=0) res[0][0]=a0;
|
|
||||||
a0=arg[1]? arg[1][0] : 0;
|
|
||||||
if (res[0]!=0) res[0][1]=a0;
|
|
||||||
a0=arg[1]? arg[1][1] : 0;
|
|
||||||
if (res[0]!=0) res[0][2]=a0;
|
|
||||||
a0=arg[1]? arg[1][2] : 0;
|
|
||||||
if (res[0]!=0) res[0][3]=a0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_vde_adj(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_vde_adj_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_vde_adj_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_vde_adj_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_vde_adj_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_vde_adj_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_vde_adj_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_vde_adj_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_expl_vde_adj_n_in(void) { return 4;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_expl_vde_adj_n_out(void) { return 1;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_expl_vde_adj_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_expl_vde_adj_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_expl_vde_adj_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_expl_vde_adj_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s0;
|
|
||||||
case 2: return casadi_s1;
|
|
||||||
case 3: return casadi_s2;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_expl_vde_adj_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_vde_adj_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 4;
|
|
||||||
if (sz_res) *sz_res = 1;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
/* This file was automatically generated by CasADi 3.6.4.
|
|
||||||
* It consists of:
|
|
||||||
* 1) content generated by CasADi runtime: not copyrighted
|
|
||||||
* 2) template code copied from CasADi source: permissively licensed (MIT-0)
|
|
||||||
* 3) user code: owned by the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How to prefix internal symbols */
|
|
||||||
#ifdef CASADI_CODEGEN_PREFIX
|
|
||||||
#define CASADI_NAMESPACE_CONCAT(NS, ID) _CASADI_NAMESPACE_CONCAT(NS, ID)
|
|
||||||
#define _CASADI_NAMESPACE_CONCAT(NS, ID) NS ## ID
|
|
||||||
#define CASADI_PREFIX(ID) CASADI_NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
|
|
||||||
#else
|
|
||||||
#define CASADI_PREFIX(ID) long_expl_vde_forw_ ## ID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifndef casadi_real
|
|
||||||
#define casadi_real double
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef casadi_int
|
|
||||||
#define casadi_int int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add prefix to internal symbols */
|
|
||||||
#define casadi_f0 CASADI_PREFIX(f0)
|
|
||||||
#define casadi_s0 CASADI_PREFIX(s0)
|
|
||||||
#define casadi_s1 CASADI_PREFIX(s1)
|
|
||||||
#define casadi_s2 CASADI_PREFIX(s2)
|
|
||||||
#define casadi_s3 CASADI_PREFIX(s3)
|
|
||||||
|
|
||||||
/* Symbol visibility in DLLs */
|
|
||||||
#ifndef CASADI_SYMBOL_EXPORT
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
#if defined(STATIC_LINKED)
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
||||||
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
|
|
||||||
#else
|
|
||||||
#define CASADI_SYMBOL_EXPORT
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const casadi_int casadi_s0[7] = {3, 1, 0, 3, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s1[15] = {3, 3, 0, 3, 6, 9, 0, 1, 2, 0, 1, 2, 0, 1, 2};
|
|
||||||
static const casadi_int casadi_s2[5] = {1, 1, 0, 1, 0};
|
|
||||||
static const casadi_int casadi_s3[10] = {6, 1, 0, 6, 0, 1, 2, 3, 4, 5};
|
|
||||||
|
|
||||||
/* long_expl_vde_forw:(i0[3],i1[3x3],i2[3],i3,i4[6])->(o0[3],o1[3x3],o2[3]) */
|
|
||||||
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem) {
|
|
||||||
casadi_real a0, a1;
|
|
||||||
a0=arg[0]? arg[0][1] : 0;
|
|
||||||
if (res[0]!=0) res[0][0]=a0;
|
|
||||||
a0=arg[0]? arg[0][2] : 0;
|
|
||||||
if (res[0]!=0) res[0][1]=a0;
|
|
||||||
a0=arg[3]? arg[3][0] : 0;
|
|
||||||
if (res[0]!=0) res[0][2]=a0;
|
|
||||||
a0=arg[1]? arg[1][1] : 0;
|
|
||||||
if (res[1]!=0) res[1][0]=a0;
|
|
||||||
a0=arg[1]? arg[1][2] : 0;
|
|
||||||
if (res[1]!=0) res[1][1]=a0;
|
|
||||||
a0=0.;
|
|
||||||
if (res[1]!=0) res[1][2]=a0;
|
|
||||||
a1=arg[1]? arg[1][4] : 0;
|
|
||||||
if (res[1]!=0) res[1][3]=a1;
|
|
||||||
a1=arg[1]? arg[1][5] : 0;
|
|
||||||
if (res[1]!=0) res[1][4]=a1;
|
|
||||||
if (res[1]!=0) res[1][5]=a0;
|
|
||||||
a1=arg[1]? arg[1][7] : 0;
|
|
||||||
if (res[1]!=0) res[1][6]=a1;
|
|
||||||
a1=arg[1]? arg[1][8] : 0;
|
|
||||||
if (res[1]!=0) res[1][7]=a1;
|
|
||||||
if (res[1]!=0) res[1][8]=a0;
|
|
||||||
a0=arg[2]? arg[2][1] : 0;
|
|
||||||
if (res[2]!=0) res[2][0]=a0;
|
|
||||||
a0=arg[2]? arg[2][2] : 0;
|
|
||||||
if (res[2]!=0) res[2][1]=a0;
|
|
||||||
a0=1.;
|
|
||||||
if (res[2]!=0) res[2][2]=a0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_vde_forw(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
|
|
||||||
return casadi_f0(arg, res, iw, w, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_vde_forw_alloc_mem(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_vde_forw_init_mem(int mem) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_vde_forw_free_mem(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_vde_forw_checkout(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_vde_forw_release(int mem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_vde_forw_incref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT void long_expl_vde_forw_decref(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_expl_vde_forw_n_in(void) { return 5;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_int long_expl_vde_forw_n_out(void) { return 3;}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT casadi_real long_expl_vde_forw_default_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_expl_vde_forw_name_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "i0";
|
|
||||||
case 1: return "i1";
|
|
||||||
case 2: return "i2";
|
|
||||||
case 3: return "i3";
|
|
||||||
case 4: return "i4";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const char* long_expl_vde_forw_name_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return "o0";
|
|
||||||
case 1: return "o1";
|
|
||||||
case 2: return "o2";
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_expl_vde_forw_sparsity_in(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s0;
|
|
||||||
case 3: return casadi_s2;
|
|
||||||
case 4: return casadi_s3;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT const casadi_int* long_expl_vde_forw_sparsity_out(casadi_int i) {
|
|
||||||
switch (i) {
|
|
||||||
case 0: return casadi_s0;
|
|
||||||
case 1: return casadi_s1;
|
|
||||||
case 2: return casadi_s0;
|
|
||||||
default: return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CASADI_SYMBOL_EXPORT int long_expl_vde_forw_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
|
|
||||||
if (sz_arg) *sz_arg = 5;
|
|
||||||
if (sz_res) *sz_res = 3;
|
|
||||||
if (sz_iw) *sz_iw = 0;
|
|
||||||
if (sz_w) *sz_w = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
@@ -1,216 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) The acados authors.
|
|
||||||
*
|
|
||||||
* This file is part of acados.
|
|
||||||
*
|
|
||||||
* The 2-Clause BSD License
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.;
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// standard
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
// acados
|
|
||||||
#include "acados/utils/print.h"
|
|
||||||
#include "acados/utils/math.h"
|
|
||||||
#include "acados_c/ocp_nlp_interface.h"
|
|
||||||
#include "acados_c/external_function_interface.h"
|
|
||||||
#include "acados_solver_long.h"
|
|
||||||
|
|
||||||
// blasfeo
|
|
||||||
#include "blasfeo/include/blasfeo_d_aux_ext_dep.h"
|
|
||||||
|
|
||||||
#define NX LONG_NX
|
|
||||||
#define NZ LONG_NZ
|
|
||||||
#define NU LONG_NU
|
|
||||||
#define NP LONG_NP
|
|
||||||
#define NBX LONG_NBX
|
|
||||||
#define NBX0 LONG_NBX0
|
|
||||||
#define NBU LONG_NBU
|
|
||||||
#define NSBX LONG_NSBX
|
|
||||||
#define NSBU LONG_NSBU
|
|
||||||
#define NSH LONG_NSH
|
|
||||||
#define NSG LONG_NSG
|
|
||||||
#define NSPHI LONG_NSPHI
|
|
||||||
#define NSHN LONG_NSHN
|
|
||||||
#define NSGN LONG_NSGN
|
|
||||||
#define NSPHIN LONG_NSPHIN
|
|
||||||
#define NSBXN LONG_NSBXN
|
|
||||||
#define NS LONG_NS
|
|
||||||
#define NSN LONG_NSN
|
|
||||||
#define NG LONG_NG
|
|
||||||
#define NBXN LONG_NBXN
|
|
||||||
#define NGN LONG_NGN
|
|
||||||
#define NY0 LONG_NY0
|
|
||||||
#define NY LONG_NY
|
|
||||||
#define NYN LONG_NYN
|
|
||||||
#define NH LONG_NH
|
|
||||||
#define NPHI LONG_NPHI
|
|
||||||
#define NHN LONG_NHN
|
|
||||||
#define NPHIN LONG_NPHIN
|
|
||||||
#define NR LONG_NR
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
|
|
||||||
long_solver_capsule *acados_ocp_capsule = long_acados_create_capsule();
|
|
||||||
// there is an opportunity to change the number of shooting intervals in C without new code generation
|
|
||||||
int N = LONG_N;
|
|
||||||
// allocate the array and fill it accordingly
|
|
||||||
double* new_time_steps = NULL;
|
|
||||||
int status = long_acados_create_with_discretization(acados_ocp_capsule, N, new_time_steps);
|
|
||||||
|
|
||||||
if (status)
|
|
||||||
{
|
|
||||||
printf("long_acados_create() returned status %d. Exiting.\n", status);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ocp_nlp_config *nlp_config = long_acados_get_nlp_config(acados_ocp_capsule);
|
|
||||||
ocp_nlp_dims *nlp_dims = long_acados_get_nlp_dims(acados_ocp_capsule);
|
|
||||||
ocp_nlp_in *nlp_in = long_acados_get_nlp_in(acados_ocp_capsule);
|
|
||||||
ocp_nlp_out *nlp_out = long_acados_get_nlp_out(acados_ocp_capsule);
|
|
||||||
ocp_nlp_solver *nlp_solver = long_acados_get_nlp_solver(acados_ocp_capsule);
|
|
||||||
void *nlp_opts = long_acados_get_nlp_opts(acados_ocp_capsule);
|
|
||||||
|
|
||||||
// initial condition
|
|
||||||
int idxbx0[NBX0];
|
|
||||||
idxbx0[0] = 0;
|
|
||||||
idxbx0[1] = 1;
|
|
||||||
idxbx0[2] = 2;
|
|
||||||
|
|
||||||
double lbx0[NBX0];
|
|
||||||
double ubx0[NBX0];
|
|
||||||
lbx0[0] = 0.0;
|
|
||||||
ubx0[0] = 0.0;
|
|
||||||
lbx0[1] = 0.0;
|
|
||||||
ubx0[1] = 0.0;
|
|
||||||
lbx0[2] = 0.0;
|
|
||||||
ubx0[2] = 0.0;
|
|
||||||
|
|
||||||
ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "idxbx", idxbx0);
|
|
||||||
ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "lbx", lbx0);
|
|
||||||
ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "ubx", ubx0);
|
|
||||||
|
|
||||||
// initialization for state values
|
|
||||||
double x_init[NX];
|
|
||||||
x_init[0] = 0.0;
|
|
||||||
x_init[1] = 0.0;
|
|
||||||
x_init[2] = 0.0;
|
|
||||||
|
|
||||||
// initial value for control input
|
|
||||||
double u0[NU];
|
|
||||||
u0[0] = 0.0;
|
|
||||||
// set parameters
|
|
||||||
double p[NP];
|
|
||||||
p[0] = -1.2;
|
|
||||||
p[1] = 1.2;
|
|
||||||
p[2] = 0.0;
|
|
||||||
p[3] = 0.0;
|
|
||||||
p[4] = 1.45;
|
|
||||||
p[5] = 0.75;
|
|
||||||
|
|
||||||
for (int ii = 0; ii <= N; ii++)
|
|
||||||
{
|
|
||||||
long_acados_update_params(acados_ocp_capsule, ii, p, NP);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// prepare evaluation
|
|
||||||
int NTIMINGS = 1;
|
|
||||||
double min_time = 1e12;
|
|
||||||
double kkt_norm_inf;
|
|
||||||
double elapsed_time;
|
|
||||||
int sqp_iter;
|
|
||||||
|
|
||||||
double xtraj[NX * (N+1)];
|
|
||||||
double utraj[NU * N];
|
|
||||||
|
|
||||||
|
|
||||||
// solve ocp in loop
|
|
||||||
int rti_phase = 0;
|
|
||||||
|
|
||||||
for (int ii = 0; ii < NTIMINGS; ii++)
|
|
||||||
{
|
|
||||||
// initialize solution
|
|
||||||
for (int i = 0; i < N; i++)
|
|
||||||
{
|
|
||||||
ocp_nlp_out_set(nlp_config, nlp_dims, nlp_out, i, "x", x_init);
|
|
||||||
ocp_nlp_out_set(nlp_config, nlp_dims, nlp_out, i, "u", u0);
|
|
||||||
}
|
|
||||||
ocp_nlp_out_set(nlp_config, nlp_dims, nlp_out, N, "x", x_init);
|
|
||||||
ocp_nlp_solver_opts_set(nlp_config, nlp_opts, "rti_phase", &rti_phase);
|
|
||||||
status = long_acados_solve(acados_ocp_capsule);
|
|
||||||
ocp_nlp_get(nlp_config, nlp_solver, "time_tot", &elapsed_time);
|
|
||||||
min_time = MIN(elapsed_time, min_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* print solution and statistics */
|
|
||||||
for (int ii = 0; ii <= nlp_dims->N; ii++)
|
|
||||||
ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, ii, "x", &xtraj[ii*NX]);
|
|
||||||
for (int ii = 0; ii < nlp_dims->N; ii++)
|
|
||||||
ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, ii, "u", &utraj[ii*NU]);
|
|
||||||
|
|
||||||
printf("\n--- xtraj ---\n");
|
|
||||||
d_print_exp_tran_mat( NX, N+1, xtraj, NX);
|
|
||||||
printf("\n--- utraj ---\n");
|
|
||||||
d_print_exp_tran_mat( NU, N, utraj, NU );
|
|
||||||
// ocp_nlp_out_print(nlp_solver->dims, nlp_out);
|
|
||||||
|
|
||||||
printf("\nsolved ocp %d times, solution printed above\n\n", NTIMINGS);
|
|
||||||
|
|
||||||
if (status == ACADOS_SUCCESS)
|
|
||||||
{
|
|
||||||
printf("long_acados_solve(): SUCCESS!\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("long_acados_solve() failed with status %d.\n", status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get solution
|
|
||||||
ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, 0, "kkt_norm_inf", &kkt_norm_inf);
|
|
||||||
ocp_nlp_get(nlp_config, nlp_solver, "sqp_iter", &sqp_iter);
|
|
||||||
|
|
||||||
long_acados_print_stats(acados_ocp_capsule);
|
|
||||||
|
|
||||||
printf("\nSolver info:\n");
|
|
||||||
printf(" SQP iterations %2d\n minimum time for %d solve %f [ms]\n KKT %e\n",
|
|
||||||
sqp_iter, NTIMINGS, min_time*1000, kkt_norm_inf);
|
|
||||||
|
|
||||||
// free solver
|
|
||||||
status = long_acados_free(acados_ocp_capsule);
|
|
||||||
if (status) {
|
|
||||||
printf("long_acados_free() returned status %d. \n", status);
|
|
||||||
}
|
|
||||||
// free solver capsule
|
|
||||||
status = long_acados_free_capsule(acados_ocp_capsule);
|
|
||||||
if (status) {
|
|
||||||
printf("long_acados_free_capsule() returned status %d. \n", status);
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) The acados authors.
|
|
||||||
*
|
|
||||||
* This file is part of acados.
|
|
||||||
*
|
|
||||||
* The 2-Clause BSD License
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.;
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// standard
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
// acados
|
|
||||||
#include "acados/utils/print.h"
|
|
||||||
#include "acados/utils/math.h"
|
|
||||||
#include "acados_c/sim_interface.h"
|
|
||||||
#include "acados_sim_solver_long.h"
|
|
||||||
|
|
||||||
#define NX LONG_NX
|
|
||||||
#define NZ LONG_NZ
|
|
||||||
#define NU LONG_NU
|
|
||||||
#define NP LONG_NP
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
int status = 0;
|
|
||||||
sim_solver_capsule *capsule = long_acados_sim_solver_create_capsule();
|
|
||||||
status = long_acados_sim_create(capsule);
|
|
||||||
|
|
||||||
if (status)
|
|
||||||
{
|
|
||||||
printf("acados_create() returned status %d. Exiting.\n", status);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
sim_config *acados_sim_config = long_acados_get_sim_config(capsule);
|
|
||||||
sim_in *acados_sim_in = long_acados_get_sim_in(capsule);
|
|
||||||
sim_out *acados_sim_out = long_acados_get_sim_out(capsule);
|
|
||||||
void *acados_sim_dims = long_acados_get_sim_dims(capsule);
|
|
||||||
|
|
||||||
// initial condition
|
|
||||||
double x_current[NX];
|
|
||||||
x_current[0] = 0.0;
|
|
||||||
x_current[1] = 0.0;
|
|
||||||
x_current[2] = 0.0;
|
|
||||||
|
|
||||||
|
|
||||||
x_current[0] = 0.0;
|
|
||||||
x_current[1] = 0.0;
|
|
||||||
x_current[2] = 0.0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// initial value for control input
|
|
||||||
double u0[NU];
|
|
||||||
u0[0] = 0.0;
|
|
||||||
// set parameters
|
|
||||||
double p[NP];
|
|
||||||
p[0] = -1.2;
|
|
||||||
p[1] = 1.2;
|
|
||||||
p[2] = 0.0;
|
|
||||||
p[3] = 0.0;
|
|
||||||
p[4] = 1.45;
|
|
||||||
p[5] = 0.75;
|
|
||||||
|
|
||||||
long_acados_sim_update_params(capsule, p, NP);
|
|
||||||
|
|
||||||
|
|
||||||
int n_sim_steps = 3;
|
|
||||||
// solve ocp in loop
|
|
||||||
for (int ii = 0; ii < n_sim_steps; ii++)
|
|
||||||
{
|
|
||||||
sim_in_set(acados_sim_config, acados_sim_dims,
|
|
||||||
acados_sim_in, "x", x_current);
|
|
||||||
status = long_acados_sim_solve(capsule);
|
|
||||||
|
|
||||||
if (status != ACADOS_SUCCESS)
|
|
||||||
{
|
|
||||||
printf("acados_solve() failed with status %d.\n", status);
|
|
||||||
}
|
|
||||||
|
|
||||||
sim_out_get(acados_sim_config, acados_sim_dims,
|
|
||||||
acados_sim_out, "x", x_current);
|
|
||||||
|
|
||||||
printf("\nx_current, %d\n", ii);
|
|
||||||
for (int jj = 0; jj < NX; jj++)
|
|
||||||
{
|
|
||||||
printf("%e\n", x_current[jj]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\nPerformed %d simulation steps with acados integrator successfully.\n\n", n_sim_steps);
|
|
||||||
|
|
||||||
// free solver
|
|
||||||
status = long_acados_sim_free(capsule);
|
|
||||||
if (status) {
|
|
||||||
printf("long_acados_sim_free() returned status %d. \n", status);
|
|
||||||
}
|
|
||||||
|
|
||||||
long_acados_sim_solver_free_capsule(capsule);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
79
selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py
Executable file → Normal file
79
selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py
Executable file → Normal file
@@ -3,12 +3,13 @@ import os
|
|||||||
import time
|
import time
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from cereal import log
|
from cereal import log
|
||||||
|
from openpilot.common.conversions import Conversions as CV
|
||||||
from openpilot.common.numpy_fast import clip
|
from openpilot.common.numpy_fast import clip
|
||||||
|
from openpilot.common.params import Params
|
||||||
from openpilot.common.swaglog import cloudlog
|
from openpilot.common.swaglog import cloudlog
|
||||||
# WARNING: imports outside of constants will not trigger a rebuild
|
# WARNING: imports outside of constants will not trigger a rebuild
|
||||||
from openpilot.selfdrive.modeld.constants import index_function
|
from openpilot.selfdrive.modeld.constants import index_function
|
||||||
from openpilot.selfdrive.car.interfaces import ACCEL_MIN
|
from openpilot.selfdrive.car.interfaces import ACCEL_MIN
|
||||||
from openpilot.selfdrive.controls.radard import _LEAD_ACCEL_TAU
|
|
||||||
|
|
||||||
if __name__ == '__main__': # generating code
|
if __name__ == '__main__': # generating code
|
||||||
from openpilot.third_party.acados.acados_template import AcadosModel, AcadosOcp, AcadosOcpSolver
|
from openpilot.third_party.acados.acados_template import AcadosModel, AcadosOcp, AcadosOcpSolver
|
||||||
@@ -42,7 +43,8 @@ CRASH_DISTANCE = .25
|
|||||||
LEAD_DANGER_FACTOR = 0.75
|
LEAD_DANGER_FACTOR = 0.75
|
||||||
LIMIT_COST = 1e6
|
LIMIT_COST = 1e6
|
||||||
ACADOS_SOLVER_TYPE = 'SQP_RTI'
|
ACADOS_SOLVER_TYPE = 'SQP_RTI'
|
||||||
|
# Default lead acceleration decay set to 50% at 1s
|
||||||
|
LEAD_ACCEL_TAU = 1.5
|
||||||
|
|
||||||
# Fewer timestamps don't hurt performance and lead to
|
# Fewer timestamps don't hurt performance and lead to
|
||||||
# much better convergence of the MPC with low iterations
|
# much better convergence of the MPC with low iterations
|
||||||
@@ -242,8 +244,9 @@ def gen_long_ocp():
|
|||||||
class LongitudinalMpc:
|
class LongitudinalMpc:
|
||||||
def __init__(self, mode='acc'):
|
def __init__(self, mode='acc'):
|
||||||
# FrogPilot variables
|
# FrogPilot variables
|
||||||
self.acceleration_offset = 1
|
self.params_memory = Params("/dev/shm/params")
|
||||||
self.braking_offset = 1
|
|
||||||
|
self.update_frogpilot_params()
|
||||||
|
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.solver = AcadosOcpSolverCython(MODEL_NAME, ACADOS_SOLVER_TYPE, N)
|
self.solver = AcadosOcpSolverCython(MODEL_NAME, ACADOS_SOLVER_TYPE, N)
|
||||||
@@ -295,10 +298,7 @@ class LongitudinalMpc:
|
|||||||
for i in range(N):
|
for i in range(N):
|
||||||
self.solver.cost_set(i, 'Zl', Zl)
|
self.solver.cost_set(i, 'Zl', Zl)
|
||||||
|
|
||||||
def set_weights(self, prev_accel_constraint=True, custom_personalities=False, aggressive_jerk=0.5, standard_jerk=1.0, relaxed_jerk=1.0, personality=log.LongitudinalPersonality.standard):
|
def set_weights(self, jerk_factor=1.0, prev_accel_constraint=True, personality=log.LongitudinalPersonality.standard):
|
||||||
jerk_factor = get_jerk_factor(custom_personalities, aggressive_jerk, standard_jerk, relaxed_jerk, personality)
|
|
||||||
jerk_factor /= np.mean(self.acceleration_offset + self.braking_offset)
|
|
||||||
|
|
||||||
if self.mode == 'acc':
|
if self.mode == 'acc':
|
||||||
a_change_cost = A_CHANGE_COST if prev_accel_constraint else 0
|
a_change_cost = A_CHANGE_COST if prev_accel_constraint else 0
|
||||||
cost_weights = [X_EGO_OBSTACLE_COST, X_EGO_COST, V_EGO_COST, A_EGO_COST, jerk_factor * a_change_cost, jerk_factor * J_EGO_COST]
|
cost_weights = [X_EGO_OBSTACLE_COST, X_EGO_COST, V_EGO_COST, A_EGO_COST, jerk_factor * a_change_cost, jerk_factor * J_EGO_COST]
|
||||||
@@ -327,10 +327,12 @@ class LongitudinalMpc:
|
|||||||
lead_xv = np.column_stack((x_lead_traj, v_lead_traj))
|
lead_xv = np.column_stack((x_lead_traj, v_lead_traj))
|
||||||
return lead_xv
|
return lead_xv
|
||||||
|
|
||||||
def process_lead(self, lead, frogpilot_planner):
|
def process_lead(self, lead, increased_stopping_distance=0):
|
||||||
v_ego = self.x0[1]
|
v_ego = self.x0[1]
|
||||||
|
increased_stopping_distance = max(increased_stopping_distance - v_ego, 0)
|
||||||
|
|
||||||
if lead is not None and lead.status:
|
if lead is not None and lead.status:
|
||||||
x_lead = lead.dRel - (frogpilot_planner.increased_stopping_distance if not frogpilot_planner.traffic_mode_active else 0)
|
x_lead = lead.dRel - increased_stopping_distance
|
||||||
v_lead = lead.vLead
|
v_lead = lead.vLead
|
||||||
a_lead = lead.aLeadK
|
a_lead = lead.aLeadK
|
||||||
a_lead_tau = lead.aLeadTau
|
a_lead_tau = lead.aLeadTau
|
||||||
@@ -339,7 +341,7 @@ class LongitudinalMpc:
|
|||||||
x_lead = 50.0
|
x_lead = 50.0
|
||||||
v_lead = v_ego + 10.0
|
v_lead = v_ego + 10.0
|
||||||
a_lead = 0.0
|
a_lead = 0.0
|
||||||
a_lead_tau = _LEAD_ACCEL_TAU
|
a_lead_tau = LEAD_ACCEL_TAU
|
||||||
|
|
||||||
# MPC will not converge if immediate crash is expected
|
# MPC will not converge if immediate crash is expected
|
||||||
# Clip lead distance to what is still possible to brake for
|
# Clip lead distance to what is still possible to brake for
|
||||||
@@ -356,45 +358,12 @@ class LongitudinalMpc:
|
|||||||
self.cruise_min_a = min_a
|
self.cruise_min_a = min_a
|
||||||
self.max_a = max_a
|
self.max_a = max_a
|
||||||
|
|
||||||
def update(self, radarstate, v_cruise, x, v, a, j, frogpilot_planner, personality=log.LongitudinalPersonality.standard):
|
def update(self, lead_one, lead_two, v_cruise, x, v, a, j, radarless_model, t_follow, trafficModeActive, personality=log.LongitudinalPersonality.standard):
|
||||||
if frogpilot_planner.traffic_mode_active:
|
|
||||||
t_follow = frogpilot_planner.traffic_mode_t_follow
|
|
||||||
else:
|
|
||||||
t_follow = get_T_FOLLOW(frogpilot_planner.custom_personalities, frogpilot_planner.aggressive_follow, frogpilot_planner.standard_follow, frogpilot_planner.relaxed_follow, personality)
|
|
||||||
|
|
||||||
self.t_follow = t_follow
|
|
||||||
v_ego = self.x0[1]
|
v_ego = self.x0[1]
|
||||||
self.status = radarstate.leadOne.status or radarstate.leadTwo.status
|
self.status = lead_one.status or lead_two.status
|
||||||
|
|
||||||
lead_xv_0 = self.process_lead(radarstate.leadOne, frogpilot_planner)
|
lead_xv_0 = self.process_lead(lead_one, self.increased_stopping_distance if not trafficModeActive else 0)
|
||||||
lead_xv_1 = self.process_lead(radarstate.leadTwo, frogpilot_planner)
|
lead_xv_1 = self.process_lead(lead_two)
|
||||||
|
|
||||||
# Offset by FrogAi for FrogPilot for a more natural takeoff with a lead
|
|
||||||
if frogpilot_planner.aggressive_acceleration:
|
|
||||||
distance_factor = np.maximum(1, lead_xv_0[:,0] - (lead_xv_0[:,1] * t_follow))
|
|
||||||
standstill_offset = max(STOP_DISTANCE - (v_ego**COMFORT_BRAKE), 0)
|
|
||||||
self.acceleration_offset = np.clip((lead_xv_0[:,1] - v_ego) + standstill_offset - COMFORT_BRAKE, 1, distance_factor)
|
|
||||||
t_follow = t_follow / self.acceleration_offset
|
|
||||||
else:
|
|
||||||
self.acceleration_offset = 1
|
|
||||||
|
|
||||||
# Offset by FrogAi for FrogPilot for a more natural approach to a slower lead
|
|
||||||
if frogpilot_planner.smoother_braking:
|
|
||||||
distance_factor = np.maximum(1, lead_xv_0[:,0] - (lead_xv_0[:,1] * t_follow))
|
|
||||||
self.braking_offset = np.clip((v_ego - lead_xv_0[:,1]) - COMFORT_BRAKE, 1, distance_factor)
|
|
||||||
t_follow = t_follow / self.braking_offset
|
|
||||||
else:
|
|
||||||
self.braking_offset = 1
|
|
||||||
|
|
||||||
# LongitudinalPlan variables for onroad driving insights
|
|
||||||
if self.status:
|
|
||||||
self.safe_obstacle_distance = int(np.mean(get_safe_obstacle_distance(v_ego, t_follow)))
|
|
||||||
self.safe_obstacle_distance_stock = int(np.mean(get_safe_obstacle_distance(v_ego, self.t_follow)))
|
|
||||||
self.stopped_equivalence_factor = int(np.mean(get_stopped_equivalence_factor(lead_xv_0[:,1])))
|
|
||||||
else:
|
|
||||||
self.safe_obstacle_distance = 0
|
|
||||||
self.safe_obstacle_distance_stock = 0
|
|
||||||
self.stopped_equivalence_factor = 0
|
|
||||||
|
|
||||||
# To estimate a safe distance from a moving lead, we calculate how much stopping
|
# To estimate a safe distance from a moving lead, we calculate how much stopping
|
||||||
# distance that lead needs as a minimum. We can add that to the current distance
|
# distance that lead needs as a minimum. We can add that to the current distance
|
||||||
@@ -453,8 +422,8 @@ class LongitudinalMpc:
|
|||||||
self.params[:,4] = t_follow
|
self.params[:,4] = t_follow
|
||||||
|
|
||||||
self.run()
|
self.run()
|
||||||
if (np.any(lead_xv_0[FCW_IDXS,0] - self.x_sol[FCW_IDXS,0] < CRASH_DISTANCE) and
|
lead_probability = lead_one.prob if radarless_model else lead_one.modelProb
|
||||||
radarstate.leadOne.modelProb > 0.9):
|
if (np.any(lead_xv_0[FCW_IDXS,0] - self.x_sol[FCW_IDXS,0] < CRASH_DISTANCE) and lead_probability > 0.9):
|
||||||
self.crash_cnt += 1
|
self.crash_cnt += 1
|
||||||
else:
|
else:
|
||||||
self.crash_cnt = 0
|
self.crash_cnt = 0
|
||||||
@@ -468,6 +437,9 @@ class LongitudinalMpc:
|
|||||||
(lead_1_obstacle[0] - lead_0_obstacle[0]):
|
(lead_1_obstacle[0] - lead_0_obstacle[0]):
|
||||||
self.source = 'lead1'
|
self.source = 'lead1'
|
||||||
|
|
||||||
|
if self.params_memory.get_bool("FrogPilotTogglesUpdated"):
|
||||||
|
self.update_frogpilot_params()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# t0 = time.monotonic()
|
# t0 = time.monotonic()
|
||||||
# reset = 0
|
# reset = 0
|
||||||
@@ -510,6 +482,13 @@ class LongitudinalMpc:
|
|||||||
# print(f"long_mpc timings: total internal {self.solve_time:.2e}, external: {(time.monotonic() - t0):.2e} qp {self.time_qp_solution:.2e}, \
|
# print(f"long_mpc timings: total internal {self.solve_time:.2e}, external: {(time.monotonic() - t0):.2e} qp {self.time_qp_solution:.2e}, \
|
||||||
# lin {self.time_linearization:.2e} qp_iter {qp_iter}, reset {reset}")
|
# lin {self.time_linearization:.2e} qp_iter {qp_iter}, reset {reset}")
|
||||||
|
|
||||||
|
def update_frogpilot_params(self):
|
||||||
|
params = Params()
|
||||||
|
|
||||||
|
is_metric = params.get_bool("IsMetric")
|
||||||
|
|
||||||
|
longitudinal_tune = params.get_bool("LongitudinalTune")
|
||||||
|
self.increased_stopping_distance = params.get_int("StoppingDistance") * (1 if is_metric else CV.FOOT_TO_METER) if longitudinal_tune else 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
ocp = gen_long_ocp()
|
ocp = gen_long_ocp()
|
||||||
|
|||||||
Reference in New Issue
Block a user