diff --git a/CMakeLists.txt b/CMakeLists.txt index decf4e1..bda6307 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,10 @@ find_package(catkin REQUIRED COMPONENTS as_msgs ) +find_package(Eigen3 REQUIRED) + find_package(OpenMP REQUIRED) + if(OPENMP_FOUND) message(STATUS "OPENMP FOUND") set(OpenMP_FLAGS ${OpenMP_CXX_FLAGS}) diff --git a/README.md b/README.md index e56e25d..f222946 100644 --- a/README.md +++ b/README.md @@ -3,27 +3,17 @@
Logo

Tailored MPC

-

- This pkg is thought to be the main AS controller for CAT15x. Within this repo you will find 3 different controllers (time-variant, spatial-variant and lateral (also time-variant)). The one used for the 2022-2023 season is the lateral approach, leaving the others for a future implementation. -
-

+Here you can find the main Autonomous Systems controller for CAT15x, the [BCN eMotorsport](https://bcnemotorsport.upc.edu) 2022-23 car. Within this repo you will find 3 different MPC controllers: time-variant, spatial-variant and lateral (also time-variant). The one used for the 2022-2023 season is the lateral approach, leaving the others for a future implementation as they demand much more testing time. +
Table of Contents
  1. - Getting Started - + Disclaimer
  2. -
  3. Prerequisites - +
  4. Dependencies
  5. Approach @@ -34,18 +24,23 @@
-# Getting Started +# Disclaimer +This is a tailored control solution made for the CAT15x Formula Student vehicle. In order to make a propper use of this algorithm, it's the user duty to make sure the [dynamic model](docs/tfg.pdf) actually approximates the behaviour of the car. + +If you use this control algorithm in a Formula Student competition the **only** thing I ask for is to **ALWAYS REFERENCE** the team ___BCN eMotorsport___. -## Usage -In order to execute this pkg a [ForcesPro](https://forces.embotech.com/Documentation/index.html) software/hardware license is needed. If you don't have any license available read the __Solvers__ section in [AS README.md](https://bcnemotorsport.upc.edu:81/autonomous-systems-group/autonomous_systems). +# Dependencies +* [Ubuntu](https://ubuntu.com/) 20.04 +* [ROS](https://www.ros.org/) Noetic +* [Embotech](https://www.embotech.com/products/forcespro/overview/) FORCESPRO solver. A Hardware or Software Embotech license is mandatory. +* [Eigen3](https://eigen.tuxfamily.org) +* ___as_msgs___: self-defined ROS msgs pkg. You may change it for yours, adapting the [necessary callbacks](include/mpc.hh). -This pkg has a launch file for each dynamic event (or should have) because of the specific parametres used depending on the event. +# Approach -An example for executing the autocross controller: +For specific information on how the lateral controller work read [Tailored MPC](docs/tfg.pdf)'s paper. -```sh -roslaunch tailored_mpc autoX.launch -``` +For the sake of simplicity the different controllers are named after their more important characteristic. However, all the specified MPC controllers are curvature-based and follow a simplified non linear bicycle model. ## Branches Here's a quick explanation of this project branches: @@ -76,23 +71,11 @@ Here's a quick explanation of this project branches: __NOTE:__ The other branches are still in an early development process. They're not ready for deployment! -# Prerequisites - -## Msg dependencies -This pkg depends on the self-defined [as_msgs](https://bcnemotorsport.upc.edu:81/autonomous-systems-group/autonomous_systems). Make sure to have this msgs on your current workspace. - -## Solver dependecies -As said before, this pkg depends on [Embotech](https://www.embotech.com/products/forcespro/overview/) ForcesPro solver so a Hardware/Software license is needed. See the __Solvers__ section from [AS README.md](https://bcnemotorsport.upc.edu:81/autonomous-systems-group/autonomous_systems) for more information. - -# Approach - -For specific information on how these controllers work read [TRO](docs/TRO.pdf), [Lateral MPC](docs/KIT_lateral_MPC.pdf) and [Curvature MPC](docs/curvature_MPC.pdf) papers. - -For the sake of simplicity the different controllers are named after their more important characteristic. However, all the specified MPC controllers are curvature-based and follow a simplified non linear bicycle model. - # Workflow -In order to solve the Non Linear Optimization Problem (NLOP) stated in [solver declaration](solver/FORCES_problem.m) the following procedure must be followed (in this order): +Here's a quick summary of the steps taken by the algorithm in each iteration. + +In order to solve the Non Linear Optimization Problem (NLOP) defined with the [solver declaration API](solver/FORCES_problem.m) the following procedure is followed (in this order): * __Initial conditions__: the initial conditions for all the state/control variables must be computed. Usually the only unkown initial conditions are the path tracking variables `n` & `mu` so they must be calculated using the actual car state and the planned trajectory. diff --git a/solver/codeGen/TailoredSolver.m b/solver/codeGen/TailoredSolver.m index fa2808c..0703b2c 100644 --- a/solver/codeGen/TailoredSolver.m +++ b/solver/codeGen/TailoredSolver.m @@ -1,4 +1,4 @@ -% TailoredSolver - a fast solver generated by FORCESPRO v6.1.0 +% TailoredSolver - a fast solver generated by FORCESPRO v6.3.0 % % OUTPUT = TailoredSolver(PARAMS) solves a multistage problem % subject to the parameters supplied in the following struct: diff --git a/solver/codeGen/TailoredSolver.mexa64 b/solver/codeGen/TailoredSolver.mexa64 index b716b74..a389b2b 100755 Binary files a/solver/codeGen/TailoredSolver.mexa64 and b/solver/codeGen/TailoredSolver.mexa64 differ diff --git a/solver/codeGen/TailoredSolver/TailoredSolver.m b/solver/codeGen/TailoredSolver/TailoredSolver.m index fa2808c..0703b2c 100644 --- a/solver/codeGen/TailoredSolver/TailoredSolver.m +++ b/solver/codeGen/TailoredSolver/TailoredSolver.m @@ -1,4 +1,4 @@ -% TailoredSolver - a fast solver generated by FORCESPRO v6.1.0 +% TailoredSolver - a fast solver generated by FORCESPRO v6.3.0 % % OUTPUT = TailoredSolver(PARAMS) solves a multistage problem % subject to the parameters supplied in the following struct: diff --git a/solver/codeGen/TailoredSolver/include/TailoredSolver.h b/solver/codeGen/TailoredSolver/include/TailoredSolver.h index cb41b4a..95c5649 100644 --- a/solver/codeGen/TailoredSolver/include/TailoredSolver.h +++ b/solver/codeGen/TailoredSolver/include/TailoredSolver.h @@ -19,7 +19,7 @@ jurisdiction in case of any dispute. */ -/* Generated by FORCESPRO v6.1.0 on Monday, May 15, 2023 at 4:52:58 PM */ +/* Generated by FORCESPRO v6.3.0 on Tuesday, December 19, 2023 at 2:31:19 PM */ #ifndef TailoredSolver_H #define TailoredSolver_H @@ -94,21 +94,6 @@ typedef double TailoredSolverinterface_float; /* maximum number of supported elements in the filter */ #define MAX_FILTER_SIZE_TailoredSolver (150) -/* maximum number of supported elements in the filter */ -#define MAX_SOC_IT_TailoredSolver (4) - -/* desired relative duality gap */ -#define SET_ACC_RDGAP_TailoredSolver (TailoredSolver_float)(0.0001) - -/* desired maximum residual on equality constraints */ -#define SET_ACC_RESEQ_TailoredSolver (TailoredSolver_float)(1E-06) - -/* desired maximum residual on inequality constraints */ -#define SET_ACC_RESINEQ_TailoredSolver (TailoredSolver_float)(1E-06) - -/* desired maximum violation of complementarity */ -#define SET_ACC_KKTCOMPL_TailoredSolver (TailoredSolver_float)(1E-06) - /* whether callback return values should be checked */ #define EXTFUNC_RETURN_TailoredSolver (0) @@ -308,10 +293,12 @@ typedef struct /* SOLVER FUNCTION DEFINITION -------------------------------------------*/ -/* Time of Solver Generation: (UTC) Monday, May 15, 2023 4:53:02 PM */ -/* User License expires on: (UTC) Monday, September 25, 2023 10:00:00 PM (approx.) (at the time of code generation) */ -/* Solver Static License expires on: (UTC) Monday, September 25, 2023 10:00:00 PM (approx.) */ -/* Solver Id: 5ed8da90-0e85-42f3-a965-89843d08c984 */ +/* Time of Solver Generation: (UTC) Tuesday, December 19, 2023 2:31:26 PM */ +/* User License expires on: (UTC) Sunday, September 8, 2024 10:00:00 PM (approx.) (at the time of code generation) */ +/* Solver Static License expires on: (UTC) Sunday, September 8, 2024 10:00:00 PM (approx.) */ +/* Solver Id: d9462ecc-09c0-4c1a-841c-e467c14e3df8 */ +/* Host Compiler Version: d76500f0 */ +/* Target Compiler Version: d76500f0 */ /* examine exitflag before using the result! */ #ifdef __cplusplus extern "C" { diff --git a/solver/codeGen/TailoredSolver/include/TailoredSolver_memory.h b/solver/codeGen/TailoredSolver/include/TailoredSolver_memory.h index 4a3f7fa..c346805 100644 --- a/solver/codeGen/TailoredSolver/include/TailoredSolver_memory.h +++ b/solver/codeGen/TailoredSolver/include/TailoredSolver_memory.h @@ -19,7 +19,7 @@ jurisdiction in case of any dispute. */ -/* Generated by FORCESPRO v6.1.0 on Monday, May 15, 2023 at 4:52:58 PM */ +/* Generated by FORCESPRO v6.3.0 on Tuesday, December 19, 2023 at 2:31:19 PM */ #ifndef TailoredSolver_MEMORY_H #define TailoredSolver_MEMORY_H diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolver.m b/solver/codeGen/TailoredSolver/interface/TailoredSolver.m index fa2808c..0703b2c 100644 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolver.m +++ b/solver/codeGen/TailoredSolver/interface/TailoredSolver.m @@ -1,4 +1,4 @@ -% TailoredSolver - a fast solver generated by FORCESPRO v6.1.0 +% TailoredSolver - a fast solver generated by FORCESPRO v6.3.0 % % OUTPUT = TailoredSolver(PARAMS) solves a multistage problem % subject to the parameters supplied in the following struct: diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolverBuildable.m b/solver/codeGen/TailoredSolver/interface/TailoredSolverBuildable.m index 5c0c959..ad9da31 100644 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolverBuildable.m +++ b/solver/codeGen/TailoredSolver/interface/TailoredSolverBuildable.m @@ -50,7 +50,7 @@ function updateBuildInfo(buildInfo, cfg) end end - function [output,exitflag,info] = forcesInitOutputsMatlab() + function [output, exitflag, info] = forcesInitOutputsMatlab() infos_it = coder.nullcopy(zeros(1, 1)); infos_it2opt = coder.nullcopy(zeros(1, 1)); infos_res_eq = coder.nullcopy(zeros(1, 1)); @@ -104,7 +104,7 @@ function updateBuildInfo(buildInfo, cfg) [output,exitflag,info] = TailoredSolverBuildable.forcesCall(params.lb, params.ub, params.hu, params.xinit, params.x0, params.all_parameters, params.num_of_threads); end - function [output,exitflag,info] = forcesCall(lb, ub, hu, xinit, x0, all_parameters, num_of_threads) + function [output, exitflag, info] = forcesCall(lb, ub, hu, xinit, x0, all_parameters, num_of_threads) solvername = 'TailoredSolver'; @@ -116,14 +116,14 @@ function updateBuildInfo(buildInfo, cfg) 'all_parameters', double(all_parameters),... 'num_of_threads', uint32(num_of_threads)); - [output_c, exitflag_c, info_c] = TailoredSolverBuildable.forcesInitOutputsC(); + [output_c, exitflag_c, info_c] = TailoredSolverBuildable.forcesInitOutputsC(); %#ok headerName = [solvername '.h']; coder.cinclude(headerName); coder.cinclude([solvername '_memory.h']); coder.cinclude([solvername '_adtool2forces.h']); % define memory pointer - memptr = coder.opaque([solvername '_mem *'], 'HeaderFile', headerName); + memptr = coder.opaque([solvername '_mem *'], 'HeaderFile', headerName); %#ok memptr = coder.ceval([solvername '_internal_mem'], uint32(0)); % define solver input information (params, file and casadi) coder.cstructname(params, [solvername '_params'], 'extern', 'HeaderFile', headerName); @@ -168,7 +168,7 @@ function updateBuildInfo(buildInfo, cfg) end methods (Static, Access = private) - function [output,exitflag,info] = forcesInitOutputsC() + function [output, exitflag, info] = forcesInitOutputsC() infos_it = coder.nullcopy(int32(zeros(1, 1))); infos_it2opt = coder.nullcopy(int32(zeros(1, 1))); infos_res_eq = coder.nullcopy(double(zeros(1, 1))); diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolver_build.py b/solver/codeGen/TailoredSolver/interface/TailoredSolver_build.py index 508d238..05d26ca 100644 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolver_build.py +++ b/solver/codeGen/TailoredSolver/interface/TailoredSolver_build.py @@ -17,6 +17,7 @@ #jurisdiction in case of any dispute. # from distutils.ccompiler import new_compiler +from distutils import unixccompiler c = new_compiler() #from numpy.distutils.intelccompiler import IntelCCompiler #c = IntelCCompiler() @@ -43,7 +44,7 @@ # compile into object file objdir = os.path.join(os.getcwd(),"TailoredSolver","obj") -if isinstance(c,distutils.unixccompiler.UnixCCompiler): +if isinstance(c,unixccompiler.UnixCCompiler): #objects = c.compile([sourcefile], output_dir=objdir, extra_preargs=['-O3','-fPIC','-fopenmp','-mavx']) objects = c.compile([sourcefile], output_dir=objdir, extra_preargs=['-O3','-fPIC','-mavx']) if sys.platform.startswith('linux'): diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolver_dynamics_mex.c b/solver/codeGen/TailoredSolver/interface/TailoredSolver_dynamics_mex.c deleted file mode 100644 index f069621..0000000 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolver_dynamics_mex.c +++ /dev/null @@ -1,238 +0,0 @@ -/* -TailoredSolver : A fast customized optimization solver. - -Copyright (C) 2013-2023 EMBOTECH AG [info@embotech.com]. All rights reserved. - - -This program is distributed in the hope that it will be useful. -EMBOTECH makes NO WARRANTIES with respect to the use of the software -without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. - -EMBOTECH shall not have any liability for any damage arising from the use -of the software. - -This Agreement shall exclusively be governed by and interpreted in -accordance with the laws of Switzerland, excluding its principles -of conflict of laws. The Courts of Zurich-City shall have exclusive -jurisdiction in case of any dispute. - -*/ - -#include "mex.h" -#include "math.h" -#include -#include "../include/TailoredSolver.h" -#ifndef SOLVER_STDIO_H -#define SOLVER_STDIO_H -#include -#endif - -typedef TailoredSolver_float solver_float; -typedef solver_int32_default solver_int; -#define NSTAGES ( 40 ) -#define MAX(X, Y) ((X) < (Y) ? (Y) : (X)) - -/* For compatibility with Microsoft Visual Studio 2015 */ -#if _MSC_VER >= 1900 -FILE _iob[3]; -FILE * __cdecl __iob_func(void) -{ - _iob[0] = *stdin; - _iob[1] = *stdout; - _iob[2] = *stderr; - return _iob; -} -#endif - -/* copy functions */ - -void copyCArrayToM_TailoredSolver(TailoredSolver_float *src, double *dest, solver_int32_default dim) -{ - solver_int32_default i; - for( i = 0; i < dim; i++ ) - { - *dest++ = (double)*src++; - } -} - -void copyCValueToM_TailoredSolver(TailoredSolver_float* src, double* dest) -{ - *dest = (double)*src; -} - -void copyMArrayToC_TailoredSolver(double *src, TailoredSolver_float *dest, solver_int32_default dim) -{ - solver_int32_default i; - for( i = 0; i < dim; i++ ) - { - *dest++ = (TailoredSolver_float) (*src++) ; - } -} - -void copyMValueToC_TailoredSolver(double * src, TailoredSolver_float * dest) -{ - *dest = (TailoredSolver_float) *src; -} - - - -extern solver_int32_default TailoredSolver_adtool2forces(TailoredSolver_float *x, TailoredSolver_float *y, TailoredSolver_float *l, TailoredSolver_float *p, TailoredSolver_float *f, TailoredSolver_float *nabla_f, TailoredSolver_float *c, TailoredSolver_float *nabla_c, TailoredSolver_float *h, TailoredSolver_float *nabla_h, TailoredSolver_float *hess, solver_int32_default stage, solver_int32_default iteration, solver_int32_default threadID); -TailoredSolver_extfunc pt2function_TailoredSolver = &TailoredSolver_adtool2forces; - - -static void getDims(const solver_int stage, solver_int* nvar, solver_int* neq, solver_int* dimh, - solver_int* dimp, solver_int* diml, solver_int* dimu, solver_int* dimhl, solver_int* dimhu) -{ - const solver_int nvarArr[NSTAGES] = {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; - const solver_int neqArr[NSTAGES] = {7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}; - const solver_int dimhArr[NSTAGES] = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - const solver_int dimpArr[NSTAGES] = {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25}; - const solver_int dimlArr[NSTAGES] = {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; - const solver_int dimuArr[NSTAGES] = {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; - const solver_int dimhlArr[NSTAGES] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const solver_int dimhuArr[NSTAGES] = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - - *nvar = nvarArr[stage]; - *neq = neqArr[stage]; - *dimh = dimhArr[stage]; - *dimp = dimpArr[stage]; - *diml = dimlArr[stage]; - *dimu = dimuArr[stage]; - *dimhl = dimhlArr[stage]; - *dimhu = dimhuArr[stage]; -} - -/* Checks all inputs and returns stage number (1-indexed) */ -static void assignData(solver_int nrhs, const mxArray *prhs[], solver_int * const stage, solver_int * const nvar, solver_int * const neq, - solver_int * const dimh, solver_int * const dimp, solver_int * const diml, solver_int * const dimu, solver_int * const dimhl, solver_int * const dimhu) -{ - mxArray *arr; - - if (nrhs > 3 || nrhs < 1) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "This function takes at least one input: z. And at most 3 inputs: z, p, stage."); - } - - // get stage - *stage = (solver_int) 1; - if (nrhs == 3) - { - arr = prhs[2]; - if ( !mxIsDouble(arr) ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The third input (stage number) must be an integer."); - } - *stage = (solver_int) *mxGetPr(arr); - } - if ( *stage < 1 || (NSTAGES-1) < *stage ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "Stage must be between %d and %d.", 1, (NSTAGES-1)); - } - - /* Get other dimensions */ - *stage -= 1; /* 0-indexed stages */ - getDims(*stage, nvar, neq, dimh, dimp, diml, dimu, dimhl, dimhu); - - /* Check that passed z and p have correct dims */ - arr = prhs[0]; - if ( !mxIsDouble(arr) ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The first input (z) must be a column vector."); - } - if ( mxGetM(arr) != *nvar || mxGetN(arr) != 1 ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The first input (z) must be a column vector of length %d.", *nvar); - } - if (nrhs > 1) - { - arr = prhs[1]; - if ( *dimp > 0 && mxIsEmpty(arr)) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The second input (p) must be a column vector of length %d.", *dimp); - } - if ( !mxIsEmpty(arr) ) - { - if ( !mxIsDouble(arr) ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The second input (p) must be a column vector."); - } - if ( mxGetM(arr) != *dimp || mxGetN(arr) != 1 ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The second input (p) must be a column vector of length %d.", *dimp); - } - } - } - else - { - if ( *dimp > 0 ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "Run time parameters are required as a second input for evaluating this fcn."); - } - } -} - -/* THE mex-function */ -void mexFunction( solver_int nlhs, mxArray *plhs[], solver_int nrhs, const mxArray *prhs[] ) -{ - mxArray *arr; - solver_int nvar, neq, dimh, dimp, diml, dimu, dimhl, dimhu, stage, dimmul; - - // Allocate memory - solver_float *z, *p, *y, *l, *obj, *jacobj, *c, *jacc, *h, *jach, *hess; - - mxArray* c_mex; - mxArray* jacc_mex; - - - // get data - assignData(nrhs, prhs, &stage, &nvar, &neq, &dimh, &dimp, &diml, &dimu, &dimhl, &dimhu); - dimmul = diml+dimu+dimhl+dimhu; - - // Allocate memory - z = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar,1)); - p = (solver_float *) malloc(sizeof(solver_float)*MAX(dimp,1)); - y = (solver_float *) malloc(sizeof(solver_float)*MAX(neq,1)); - l = (solver_float *) malloc(sizeof(solver_float)*MAX(dimmul,1)); - obj = (solver_float *) malloc(sizeof(solver_float)); - jacobj = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar,1)); - c = (solver_float *) malloc(sizeof(solver_float)*MAX(neq,1)); - jacc = (solver_float *) malloc(sizeof(solver_float)*MAX(neq*nvar,1)); - h = (solver_float *) malloc(sizeof(solver_float)*MAX(dimh,1)); - jach = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar*dimh,1)); - hess = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar*nvar,1)); - - /* Initialize all inputs */ - arr = prhs[0]; - copyMArrayToC_TailoredSolver(mxGetPr(arr), z, nvar); - if (nrhs > 1) - { - arr = prhs[1]; - if ( !mxIsEmpty(arr) ) - { - copyMArrayToC_TailoredSolver(mxGetPr(arr), p, dimp); - } - } - memset(y, 0, sizeof(solver_float)*neq); - memset(l, 0, sizeof(solver_float)*dimmul); - memset(obj, 0, sizeof(solver_float)); - memset(jacobj, 0, sizeof(solver_float)*nvar); - memset(c, 0, sizeof(solver_float)*neq); - memset(jacc, 0, sizeof(solver_float)*neq*nvar); - memset(h, 0, sizeof(solver_float)*dimh); - memset(jach, 0, sizeof(solver_float)*dimh*nvar); - memset(hess, 0, sizeof(solver_float)*nvar*nvar); - - // Evaluate fcns and read output into mex format - TailoredSolver_adtool2forces(z, y, l, p, obj, jacobj, c, jacc, h, jach, hess, stage, 0, 0); - c_mex = mxCreateDoubleMatrix(neq, 1, mxREAL); - jacc_mex = mxCreateDoubleMatrix(neq, nvar, mxREAL); - copyCArrayToM_TailoredSolver(c, mxGetPr(c_mex), neq); - copyCArrayToM_TailoredSolver(jacc, mxGetPr(jacc_mex), neq*nvar); - plhs[0] = c_mex; - plhs[1] = jacc_mex; - - - // Free memory - free(z); free(p); free(y); free(l); free(obj); free(jacobj); free(c); free(jacc); free(h); free(jach); free(hess); -} \ No newline at end of file diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolver_inequalities_mex.c b/solver/codeGen/TailoredSolver/interface/TailoredSolver_inequalities_mex.c deleted file mode 100644 index 82c409d..0000000 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolver_inequalities_mex.c +++ /dev/null @@ -1,238 +0,0 @@ -/* -TailoredSolver : A fast customized optimization solver. - -Copyright (C) 2013-2023 EMBOTECH AG [info@embotech.com]. All rights reserved. - - -This program is distributed in the hope that it will be useful. -EMBOTECH makes NO WARRANTIES with respect to the use of the software -without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. - -EMBOTECH shall not have any liability for any damage arising from the use -of the software. - -This Agreement shall exclusively be governed by and interpreted in -accordance with the laws of Switzerland, excluding its principles -of conflict of laws. The Courts of Zurich-City shall have exclusive -jurisdiction in case of any dispute. - -*/ - -#include "mex.h" -#include "math.h" -#include -#include "../include/TailoredSolver.h" -#ifndef SOLVER_STDIO_H -#define SOLVER_STDIO_H -#include -#endif - -typedef TailoredSolver_float solver_float; -typedef solver_int32_default solver_int; -#define NSTAGES ( 40 ) -#define MAX(X, Y) ((X) < (Y) ? (Y) : (X)) - -/* For compatibility with Microsoft Visual Studio 2015 */ -#if _MSC_VER >= 1900 -FILE _iob[3]; -FILE * __cdecl __iob_func(void) -{ - _iob[0] = *stdin; - _iob[1] = *stdout; - _iob[2] = *stderr; - return _iob; -} -#endif - -/* copy functions */ - -void copyCArrayToM_TailoredSolver(TailoredSolver_float *src, double *dest, solver_int32_default dim) -{ - solver_int32_default i; - for( i = 0; i < dim; i++ ) - { - *dest++ = (double)*src++; - } -} - -void copyCValueToM_TailoredSolver(TailoredSolver_float* src, double* dest) -{ - *dest = (double)*src; -} - -void copyMArrayToC_TailoredSolver(double *src, TailoredSolver_float *dest, solver_int32_default dim) -{ - solver_int32_default i; - for( i = 0; i < dim; i++ ) - { - *dest++ = (TailoredSolver_float) (*src++) ; - } -} - -void copyMValueToC_TailoredSolver(double * src, TailoredSolver_float * dest) -{ - *dest = (TailoredSolver_float) *src; -} - - - -extern solver_int32_default TailoredSolver_adtool2forces(TailoredSolver_float *x, TailoredSolver_float *y, TailoredSolver_float *l, TailoredSolver_float *p, TailoredSolver_float *f, TailoredSolver_float *nabla_f, TailoredSolver_float *c, TailoredSolver_float *nabla_c, TailoredSolver_float *h, TailoredSolver_float *nabla_h, TailoredSolver_float *hess, solver_int32_default stage, solver_int32_default iteration, solver_int32_default threadID); -TailoredSolver_extfunc pt2function_TailoredSolver = &TailoredSolver_adtool2forces; - - -static void getDims(const solver_int stage, solver_int* nvar, solver_int* neq, solver_int* dimh, - solver_int* dimp, solver_int* diml, solver_int* dimu, solver_int* dimhl, solver_int* dimhu) -{ - const solver_int nvarArr[NSTAGES] = {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; - const solver_int neqArr[NSTAGES] = {7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}; - const solver_int dimhArr[NSTAGES] = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - const solver_int dimpArr[NSTAGES] = {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25}; - const solver_int dimlArr[NSTAGES] = {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; - const solver_int dimuArr[NSTAGES] = {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; - const solver_int dimhlArr[NSTAGES] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const solver_int dimhuArr[NSTAGES] = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - - *nvar = nvarArr[stage]; - *neq = neqArr[stage]; - *dimh = dimhArr[stage]; - *dimp = dimpArr[stage]; - *diml = dimlArr[stage]; - *dimu = dimuArr[stage]; - *dimhl = dimhlArr[stage]; - *dimhu = dimhuArr[stage]; -} - -/* Checks all inputs and returns stage number (1-indexed) */ -static void assignData(solver_int nrhs, const mxArray *prhs[], solver_int * const stage, solver_int * const nvar, solver_int * const neq, - solver_int * const dimh, solver_int * const dimp, solver_int * const diml, solver_int * const dimu, solver_int * const dimhl, solver_int * const dimhu) -{ - mxArray *arr; - - if (nrhs > 3 || nrhs < 1) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "This function takes at least one input: z. And at most 3 inputs: z, p, stage."); - } - - // get stage - *stage = (solver_int) 1; - if (nrhs == 3) - { - arr = prhs[2]; - if ( !mxIsDouble(arr) ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The third input (stage number) must be an integer."); - } - *stage = (solver_int) *mxGetPr(arr); - } - if ( *stage < 1 || (NSTAGES) < *stage ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "Stage must be between %d and %d.", 1, (NSTAGES)); - } - - /* Get other dimensions */ - *stage -= 1; /* 0-indexed stages */ - getDims(*stage, nvar, neq, dimh, dimp, diml, dimu, dimhl, dimhu); - - /* Check that passed z and p have correct dims */ - arr = prhs[0]; - if ( !mxIsDouble(arr) ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The first input (z) must be a column vector."); - } - if ( mxGetM(arr) != *nvar || mxGetN(arr) != 1 ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The first input (z) must be a column vector of length %d.", *nvar); - } - if (nrhs > 1) - { - arr = prhs[1]; - if ( *dimp > 0 && mxIsEmpty(arr)) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The second input (p) must be a column vector of length %d.", *dimp); - } - if ( !mxIsEmpty(arr) ) - { - if ( !mxIsDouble(arr) ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The second input (p) must be a column vector."); - } - if ( mxGetM(arr) != *dimp || mxGetN(arr) != 1 ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The second input (p) must be a column vector of length %d.", *dimp); - } - } - } - else - { - if ( *dimp > 0 ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "Run time parameters are required as a second input for evaluating this fcn."); - } - } -} - -/* THE mex-function */ -void mexFunction( solver_int nlhs, mxArray *plhs[], solver_int nrhs, const mxArray *prhs[] ) -{ - mxArray *arr; - solver_int nvar, neq, dimh, dimp, diml, dimu, dimhl, dimhu, stage, dimmul; - - // Allocate memory - solver_float *z, *p, *y, *l, *obj, *jacobj, *c, *jacc, *h, *jach, *hess; - - mxArray* h_mex; - mxArray* jach_mex; - - - // get data - assignData(nrhs, prhs, &stage, &nvar, &neq, &dimh, &dimp, &diml, &dimu, &dimhl, &dimhu); - dimmul = diml+dimu+dimhl+dimhu; - - // Allocate memory - z = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar,1)); - p = (solver_float *) malloc(sizeof(solver_float)*MAX(dimp,1)); - y = (solver_float *) malloc(sizeof(solver_float)*MAX(neq,1)); - l = (solver_float *) malloc(sizeof(solver_float)*MAX(dimmul,1)); - obj = (solver_float *) malloc(sizeof(solver_float)); - jacobj = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar,1)); - c = (solver_float *) malloc(sizeof(solver_float)*MAX(neq,1)); - jacc = (solver_float *) malloc(sizeof(solver_float)*MAX(neq*nvar,1)); - h = (solver_float *) malloc(sizeof(solver_float)*MAX(dimh,1)); - jach = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar*dimh,1)); - hess = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar*nvar,1)); - - /* Initialize all inputs */ - arr = prhs[0]; - copyMArrayToC_TailoredSolver(mxGetPr(arr), z, nvar); - if (nrhs > 1) - { - arr = prhs[1]; - if ( !mxIsEmpty(arr) ) - { - copyMArrayToC_TailoredSolver(mxGetPr(arr), p, dimp); - } - } - memset(y, 0, sizeof(solver_float)*neq); - memset(l, 0, sizeof(solver_float)*dimmul); - memset(obj, 0, sizeof(solver_float)); - memset(jacobj, 0, sizeof(solver_float)*nvar); - memset(c, 0, sizeof(solver_float)*neq); - memset(jacc, 0, sizeof(solver_float)*neq*nvar); - memset(h, 0, sizeof(solver_float)*dimh); - memset(jach, 0, sizeof(solver_float)*dimh*nvar); - memset(hess, 0, sizeof(solver_float)*nvar*nvar); - - // Evaluate fcns and read output into mex format - TailoredSolver_adtool2forces(z, y, l, p, obj, jacobj, c, jacc, h, jach, hess, stage, 0, 0); - h_mex = mxCreateDoubleMatrix(dimh, 1, mxREAL); - jach_mex = mxCreateDoubleMatrix(dimh, nvar, mxREAL); - copyCArrayToM_TailoredSolver(h, mxGetPr(h_mex), dimh); - copyCArrayToM_TailoredSolver(jach, mxGetPr(jach_mex), dimh*nvar); - plhs[0] = h_mex; - plhs[1] = jach_mex; - - - // Free memory - free(z); free(p); free(y); free(l); free(obj); free(jacobj); free(c); free(jacc); free(h); free(jach); free(hess); -} \ No newline at end of file diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolver_lib.mdl b/solver/codeGen/TailoredSolver/interface/TailoredSolver_lib.mdl index 3902a8b..3162de2 100644 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolver_lib.mdl +++ b/solver/codeGen/TailoredSolver/interface/TailoredSolver_lib.mdl @@ -60,13 +60,13 @@ Model { } } } - Created "5/15/2023 4:53:02 PM" + Created "12/19/2023 2:31:27 PM" Creator "embotech AG" UpdateHistory "UpdateHistoryNever" ModifiedByFormat "%" LastModifiedBy "embotech AG" ModifiedDateFormat "%" - LastModifiedDate "5/15/2023 4:53:02 PM" + LastModifiedDate "12/19/2023 2:31:27 PM" RTWModifiedTimeStamp 315310195 ModelVersionFormat "1.%" ConfigurationManager "None" diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolver_mex.c b/solver/codeGen/TailoredSolver/interface/TailoredSolver_mex.c index 9f3a581..ee97a99 100644 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolver_mex.c +++ b/solver/codeGen/TailoredSolver/interface/TailoredSolver_mex.c @@ -136,13 +136,13 @@ extern solver_int32_default TailoredSolver_adtool2forces(TailoredSolver_float *x TailoredSolver_extfunc pt2function_TailoredSolver = &TailoredSolver_adtool2forces; -/* Some memory for mex-function */ +/* Some memory for MEX function */ static TailoredSolver_params params; static TailoredSolver_output output; static TailoredSolver_info info; static TailoredSolver_mem * mem; -/* THE mex-function */ +/* Main MEX function */ void mexFunction( solver_int32_default nlhs, mxArray *plhs[], solver_int32_default nrhs, const mxArray *prhs[] ) { /* file pointer for printing */ diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolver_objective_mex.c b/solver/codeGen/TailoredSolver/interface/TailoredSolver_objective_mex.c deleted file mode 100644 index 318c9aa..0000000 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolver_objective_mex.c +++ /dev/null @@ -1,238 +0,0 @@ -/* -TailoredSolver : A fast customized optimization solver. - -Copyright (C) 2013-2023 EMBOTECH AG [info@embotech.com]. All rights reserved. - - -This program is distributed in the hope that it will be useful. -EMBOTECH makes NO WARRANTIES with respect to the use of the software -without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. - -EMBOTECH shall not have any liability for any damage arising from the use -of the software. - -This Agreement shall exclusively be governed by and interpreted in -accordance with the laws of Switzerland, excluding its principles -of conflict of laws. The Courts of Zurich-City shall have exclusive -jurisdiction in case of any dispute. - -*/ - -#include "mex.h" -#include "math.h" -#include -#include "../include/TailoredSolver.h" -#ifndef SOLVER_STDIO_H -#define SOLVER_STDIO_H -#include -#endif - -typedef TailoredSolver_float solver_float; -typedef solver_int32_default solver_int; -#define NSTAGES ( 40 ) -#define MAX(X, Y) ((X) < (Y) ? (Y) : (X)) - -/* For compatibility with Microsoft Visual Studio 2015 */ -#if _MSC_VER >= 1900 -FILE _iob[3]; -FILE * __cdecl __iob_func(void) -{ - _iob[0] = *stdin; - _iob[1] = *stdout; - _iob[2] = *stderr; - return _iob; -} -#endif - -/* copy functions */ - -void copyCArrayToM_TailoredSolver(TailoredSolver_float *src, double *dest, solver_int32_default dim) -{ - solver_int32_default i; - for( i = 0; i < dim; i++ ) - { - *dest++ = (double)*src++; - } -} - -void copyCValueToM_TailoredSolver(TailoredSolver_float* src, double* dest) -{ - *dest = (double)*src; -} - -void copyMArrayToC_TailoredSolver(double *src, TailoredSolver_float *dest, solver_int32_default dim) -{ - solver_int32_default i; - for( i = 0; i < dim; i++ ) - { - *dest++ = (TailoredSolver_float) (*src++) ; - } -} - -void copyMValueToC_TailoredSolver(double * src, TailoredSolver_float * dest) -{ - *dest = (TailoredSolver_float) *src; -} - - - -extern solver_int32_default TailoredSolver_adtool2forces(TailoredSolver_float *x, TailoredSolver_float *y, TailoredSolver_float *l, TailoredSolver_float *p, TailoredSolver_float *f, TailoredSolver_float *nabla_f, TailoredSolver_float *c, TailoredSolver_float *nabla_c, TailoredSolver_float *h, TailoredSolver_float *nabla_h, TailoredSolver_float *hess, solver_int32_default stage, solver_int32_default iteration, solver_int32_default threadID); -TailoredSolver_extfunc pt2function_TailoredSolver = &TailoredSolver_adtool2forces; - - -static void getDims(const solver_int stage, solver_int* nvar, solver_int* neq, solver_int* dimh, - solver_int* dimp, solver_int* diml, solver_int* dimu, solver_int* dimhl, solver_int* dimhu) -{ - const solver_int nvarArr[NSTAGES] = {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; - const solver_int neqArr[NSTAGES] = {7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}; - const solver_int dimhArr[NSTAGES] = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - const solver_int dimpArr[NSTAGES] = {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25}; - const solver_int dimlArr[NSTAGES] = {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; - const solver_int dimuArr[NSTAGES] = {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; - const solver_int dimhlArr[NSTAGES] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const solver_int dimhuArr[NSTAGES] = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - - *nvar = nvarArr[stage]; - *neq = neqArr[stage]; - *dimh = dimhArr[stage]; - *dimp = dimpArr[stage]; - *diml = dimlArr[stage]; - *dimu = dimuArr[stage]; - *dimhl = dimhlArr[stage]; - *dimhu = dimhuArr[stage]; -} - -/* Checks all inputs and returns stage number (1-indexed) */ -static void assignData(solver_int nrhs, const mxArray *prhs[], solver_int * const stage, solver_int * const nvar, solver_int * const neq, - solver_int * const dimh, solver_int * const dimp, solver_int * const diml, solver_int * const dimu, solver_int * const dimhl, solver_int * const dimhu) -{ - mxArray *arr; - - if (nrhs > 3 || nrhs < 1) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "This function takes at least one input: z. And at most 3 inputs: z, p, stage."); - } - - // get stage - *stage = (solver_int) 1; - if (nrhs == 3) - { - arr = prhs[2]; - if ( !mxIsDouble(arr) ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The third input (stage number) must be an integer."); - } - *stage = (solver_int) *mxGetPr(arr); - } - if ( *stage < 1 || (NSTAGES) < *stage ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "Stage must be between %d and %d.", 1, (NSTAGES)); - } - - /* Get other dimensions */ - *stage -= 1; /* 0-indexed stages */ - getDims(*stage, nvar, neq, dimh, dimp, diml, dimu, dimhl, dimhu); - - /* Check that passed z and p have correct dims */ - arr = prhs[0]; - if ( !mxIsDouble(arr) ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The first input (z) must be a column vector."); - } - if ( mxGetM(arr) != *nvar || mxGetN(arr) != 1 ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The first input (z) must be a column vector of length %d.", *nvar); - } - if (nrhs > 1) - { - arr = prhs[1]; - if ( *dimp > 0 && mxIsEmpty(arr)) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The second input (p) must be a column vector of length %d.", *dimp); - } - if ( !mxIsEmpty(arr) ) - { - if ( !mxIsDouble(arr) ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The second input (p) must be a column vector."); - } - if ( mxGetM(arr) != *dimp || mxGetN(arr) != 1 ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "The second input (p) must be a column vector of length %d.", *dimp); - } - } - } - else - { - if ( *dimp > 0 ) - { - mexErrMsgIdAndTxt("FORCESPRO:IncorrectInputs", "Run time parameters are required as a second input for evaluating this fcn."); - } - } -} - -/* THE mex-function */ -void mexFunction( solver_int nlhs, mxArray *plhs[], solver_int nrhs, const mxArray *prhs[] ) -{ - mxArray *arr; - solver_int nvar, neq, dimh, dimp, diml, dimu, dimhl, dimhu, stage, dimmul; - - // Allocate memory - solver_float *z, *p, *y, *l, *obj, *jacobj, *c, *jacc, *h, *jach, *hess; - - mxArray* obj_mex; - mxArray* gradobj_mex; - - - // get data - assignData(nrhs, prhs, &stage, &nvar, &neq, &dimh, &dimp, &diml, &dimu, &dimhl, &dimhu); - dimmul = diml+dimu+dimhl+dimhu; - - // Allocate memory - z = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar,1)); - p = (solver_float *) malloc(sizeof(solver_float)*MAX(dimp,1)); - y = (solver_float *) malloc(sizeof(solver_float)*MAX(neq,1)); - l = (solver_float *) malloc(sizeof(solver_float)*MAX(dimmul,1)); - obj = (solver_float *) malloc(sizeof(solver_float)); - jacobj = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar,1)); - c = (solver_float *) malloc(sizeof(solver_float)*MAX(neq,1)); - jacc = (solver_float *) malloc(sizeof(solver_float)*MAX(neq*nvar,1)); - h = (solver_float *) malloc(sizeof(solver_float)*MAX(dimh,1)); - jach = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar*dimh,1)); - hess = (solver_float *) malloc(sizeof(solver_float)*MAX(nvar*nvar,1)); - - /* Initialize all inputs */ - arr = prhs[0]; - copyMArrayToC_TailoredSolver(mxGetPr(arr), z, nvar); - if (nrhs > 1) - { - arr = prhs[1]; - if ( !mxIsEmpty(arr) ) - { - copyMArrayToC_TailoredSolver(mxGetPr(arr), p, dimp); - } - } - memset(y, 0, sizeof(solver_float)*neq); - memset(l, 0, sizeof(solver_float)*dimmul); - memset(obj, 0, sizeof(solver_float)); - memset(jacobj, 0, sizeof(solver_float)*nvar); - memset(c, 0, sizeof(solver_float)*neq); - memset(jacc, 0, sizeof(solver_float)*neq*nvar); - memset(h, 0, sizeof(solver_float)*dimh); - memset(jach, 0, sizeof(solver_float)*dimh*nvar); - memset(hess, 0, sizeof(solver_float)*nvar*nvar); - - // Evaluate fcns and read output into mex format - TailoredSolver_adtool2forces(z, y, l, p, obj, jacobj, c, jacc, h, jach, hess, stage, 0, 0); - obj_mex = mxCreateDoubleMatrix(1, 1, mxREAL); - gradobj_mex = mxCreateDoubleMatrix(nvar, 1, mxREAL); - copyCArrayToM_TailoredSolver(obj, mxGetPr(obj_mex), 1); - copyCArrayToM_TailoredSolver(jacobj, mxGetPr(gradobj_mex), nvar); - plhs[0] = obj_mex; - plhs[1] = gradobj_mex; - - - // Free memory - free(z); free(p); free(y); free(l); free(obj); free(jacobj); free(c); free(jacc); free(h); free(jach); free(hess); -} \ No newline at end of file diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolver_py.py b/solver/codeGen/TailoredSolver/interface/TailoredSolver_py.py index b63471c..699aa54 100644 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolver_py.py +++ b/solver/codeGen/TailoredSolver/interface/TailoredSolver_py.py @@ -18,7 +18,7 @@ # #def __init__(): ''' -a Python wrapper for a fast solver generated by FORCESPRO v6.1.0 +a Python wrapper for a fast solver generated by FORCESPRO v6.3.0 OUTPUT = TailoredSolver_py.TailoredSolver_solve(PARAMS) solves a multistage problem subject to the parameters supplied in the following dictionary: @@ -197,7 +197,7 @@ class TailoredSolver_mem(ctypes.Structure): def TailoredSolver_solve(params_arg): ''' -a Python wrapper for a fast solver generated by FORCESPRO v6.1.0 +a Python wrapper for a fast solver generated by FORCESPRO v6.3.0 OUTPUT = TailoredSolver_py.TailoredSolver_solve(PARAMS) solves a multistage problem subject to the parameters supplied in the following dictionary: diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolver_simulinkBlock.c b/solver/codeGen/TailoredSolver/interface/TailoredSolver_simulinkBlock.c index cb84f34..5afcdcb 100644 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolver_simulinkBlock.c +++ b/solver/codeGen/TailoredSolver/interface/TailoredSolver_simulinkBlock.c @@ -56,15 +56,15 @@ static void mdlInitializeSizes(SimStruct *S) DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, 0); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) - { - return; /* Parameter mismatch will be reported by Simulink */ + { + return; /* Parameter mismatch will be reported by Simulink */ } - /* initialize size of continuous and discrete states to zero */ + /* initialize size of continuous and discrete states to zero */ ssSetNumContStates(S, 0); ssSetNumDiscStates(S, 0); - /* initialize input ports - there are 7 in total */ + /* initialize input ports - there are 7 in total */ if (!ssSetNumInputPorts(S, 7)) return; /* Input Port 0 */ @@ -118,9 +118,9 @@ static void mdlInitializeSizes(SimStruct *S) - /* initialize output ports - there are 2 in total */ + /* initialize output ports - there are 2 in total */ if (!ssSetNumOutputPorts(S, 2)) return; - + /* Output Port 0 */ ssSetOutputPortMatrixDimensions(S, 0, 160, 1); ssSetOutputPortDataType(S, 0, SS_DOUBLE); @@ -132,10 +132,10 @@ static void mdlInitializeSizes(SimStruct *S) ssSetOutputPortComplexSignal(S, 1, COMPLEX_NO); /* no complex signals suppported */ - /* set sampling time */ + /* set sampling time */ ssSetNumSampleTimes(S, 1); - /* set internal memory of block */ + /* set internal memory of block */ ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); @@ -143,11 +143,11 @@ static void mdlInitializeSizes(SimStruct *S) ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ - /* SS_OPTION_USE_TLC_WITH_ACCELERATOR removed */ - /* SS_OPTION_USE_TLC_WITH_ACCELERATOR removed */ + /* SS_OPTION_USE_TLC_WITH_ACCELERATOR removed */ + /* SS_OPTION_USE_TLC_WITH_ACCELERATOR removed */ /* ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | - SS_OPTION_WORKS_WITH_CODE_REUSE)); */ - ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE ); + SS_OPTION_WORKS_WITH_CODE_REUSE)); */ + ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE); } #if defined(MATLAB_MEX_FILE) @@ -209,13 +209,13 @@ static void mdlSetDefaultPortDataTypes(SimStruct *S) */ static void mdlOutputs(SimStruct *S, int_T tid) { - solver_int32_default i, j, k; - - /* file pointer for printing */ - FILE *fp = NULL; + solver_int32_default i, j, k; + + /* file pointer for printing */ + FILE *fp = NULL; - /* Simulink data */ - const real_T *lb = (const real_T*) ssGetInputPortSignal(S,0); + /* Simulink data */ + const real_T *lb = (const real_T*) ssGetInputPortSignal(S,0); const real_T *ub = (const real_T*) ssGetInputPortSignal(S,1); const real_T *hu = (const real_T*) ssGetInputPortSignal(S,2); const real_T *xinit = (const real_T*) ssGetInputPortSignal(S,3); @@ -227,15 +227,16 @@ static void mdlOutputs(SimStruct *S, int_T tid) real_T *X = (real_T*) ssGetOutputPortSignal(S,1); - /* Solver data */ - static TailoredSolver_params params; - static TailoredSolver_output output; - static TailoredSolver_info info; + /* Solver data + * Note: mem struct may store a state in case of warm-starting */ + static TailoredSolver_params params; + static TailoredSolver_output output; + static TailoredSolver_info info; static TailoredSolver_mem * mem; - solver_int32_default solver_exitflag; + solver_int32_default solver_exitflag; - /* Copy inputs */ - for(i = 0; i < 320; i++) + /* Copy inputs */ + for(i = 0; i < 320; i++) { params.lb[i] = (double) lb[i]; } @@ -270,35 +271,35 @@ static void mdlOutputs(SimStruct *S, int_T tid) #if SET_PRINTLEVEL_TailoredSolver > 0 - /* Prepare file for printfs */ + /* Prepare file for printfs */ fp = fopen("stdout_temp","w+"); - if( fp == NULL ) - { - mexErrMsgTxt("freopen of stdout did not work."); - } - rewind(fp); - #endif + if( fp == NULL ) + { + mexErrMsgTxt("freopen of stdout did not work."); + } + rewind(fp); + #endif if (mem == NULL) { mem = TailoredSolver_internal_mem(0); } - /* Call solver */ - solver_exitflag = TailoredSolver_solve(¶ms, &output, &info, mem, fp , pt2function_TailoredSolver); - - #if SET_PRINTLEVEL_TailoredSolver > 0 - /* Read contents of printfs printed to file */ - rewind(fp); - while( (i = fgetc(fp)) != EOF ) - { - ssPrintf("%c",i); - } - fclose(fp); - #endif + /* Call solver */ + solver_exitflag = TailoredSolver_solve(¶ms, &output, &info, mem, fp , pt2function_TailoredSolver); - /* Copy outputs */ - for(i = 0; i < 160; i++) + #if SET_PRINTLEVEL_TailoredSolver > 0 + /* Read contents of printfs printed to file */ + rewind(fp); + while( (i = fgetc(fp)) != EOF ) + { + ssPrintf("%c",i); + } + fclose(fp); + #endif + + /* Copy outputs */ + for(i = 0; i < 160; i++) { U[i] = (real_T) output.U[i]; } diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolver_simulinkBlockcompact.c b/solver/codeGen/TailoredSolver/interface/TailoredSolver_simulinkBlockcompact.c index 2d5921e..726c488 100644 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolver_simulinkBlockcompact.c +++ b/solver/codeGen/TailoredSolver/interface/TailoredSolver_simulinkBlockcompact.c @@ -56,15 +56,15 @@ static void mdlInitializeSizes(SimStruct *S) DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, 0); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) - { - return; /* Parameter mismatch will be reported by Simulink */ + { + return; /* Parameter mismatch will be reported by Simulink */ } - /* initialize size of continuous and discrete states to zero */ + /* initialize size of continuous and discrete states to zero */ ssSetNumContStates(S, 0); ssSetNumDiscStates(S, 0); - /* initialize input ports - there are 7 in total */ + /* initialize input ports - there are 7 in total */ if (!ssSetNumInputPorts(S, 7)) return; /* Input Port 0 */ @@ -118,19 +118,19 @@ static void mdlInitializeSizes(SimStruct *S) - /* initialize output ports - there are 1 in total */ + /* initialize output ports - there are 1 in total */ if (!ssSetNumOutputPorts(S, 1)) return; - + /* Output Port 0 */ ssSetOutputPortMatrixDimensions(S, 0, 320, 1); ssSetOutputPortDataType(S, 0, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 0, COMPLEX_NO); /* no complex signals suppported */ - /* set sampling time */ + /* set sampling time */ ssSetNumSampleTimes(S, 1); - /* set internal memory of block */ + /* set internal memory of block */ ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); @@ -138,11 +138,11 @@ static void mdlInitializeSizes(SimStruct *S) ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ - /* SS_OPTION_USE_TLC_WITH_ACCELERATOR removed */ - /* SS_OPTION_USE_TLC_WITH_ACCELERATOR removed */ + /* SS_OPTION_USE_TLC_WITH_ACCELERATOR removed */ + /* SS_OPTION_USE_TLC_WITH_ACCELERATOR removed */ /* ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | - SS_OPTION_WORKS_WITH_CODE_REUSE)); */ - ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE ); + SS_OPTION_WORKS_WITH_CODE_REUSE)); */ + ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE); } #if defined(MATLAB_MEX_FILE) @@ -204,13 +204,13 @@ static void mdlSetDefaultPortDataTypes(SimStruct *S) */ static void mdlOutputs(SimStruct *S, int_T tid) { - solver_int32_default i, j, k; - - /* file pointer for printing */ - FILE *fp = NULL; + solver_int32_default i, j, k; + + /* file pointer for printing */ + FILE *fp = NULL; - /* Simulink data */ - const real_T *lb = (const real_T*) ssGetInputPortSignal(S,0); + /* Simulink data */ + const real_T *lb = (const real_T*) ssGetInputPortSignal(S,0); const real_T *ub = (const real_T*) ssGetInputPortSignal(S,1); const real_T *hu = (const real_T*) ssGetInputPortSignal(S,2); const real_T *xinit = (const real_T*) ssGetInputPortSignal(S,3); @@ -221,15 +221,16 @@ static void mdlOutputs(SimStruct *S, int_T tid) real_T *outputs = (real_T*) ssGetOutputPortSignal(S,0); - /* Solver data */ - static TailoredSolver_params params; - static TailoredSolver_output output; - static TailoredSolver_info info; + /* Solver data + * Note: mem struct may store a state in case of warm-starting */ + static TailoredSolver_params params; + static TailoredSolver_output output; + static TailoredSolver_info info; static TailoredSolver_mem * mem; - solver_int32_default solver_exitflag; + solver_int32_default solver_exitflag; - /* Copy inputs */ - for(i = 0; i < 320; i++) + /* Copy inputs */ + for(i = 0; i < 320; i++) { params.lb[i] = (double) lb[i]; } @@ -264,35 +265,35 @@ static void mdlOutputs(SimStruct *S, int_T tid) #if SET_PRINTLEVEL_TailoredSolver > 0 - /* Prepare file for printfs */ + /* Prepare file for printfs */ fp = fopen("stdout_temp","w+"); - if( fp == NULL ) - { - mexErrMsgTxt("freopen of stdout did not work."); - } - rewind(fp); - #endif + if( fp == NULL ) + { + mexErrMsgTxt("freopen of stdout did not work."); + } + rewind(fp); + #endif if (mem == NULL) { mem = TailoredSolver_internal_mem(0); } - /* Call solver */ - solver_exitflag = TailoredSolver_solve(¶ms, &output, &info, mem, fp , pt2function_TailoredSolver); - - #if SET_PRINTLEVEL_TailoredSolver > 0 - /* Read contents of printfs printed to file */ - rewind(fp); - while( (i = fgetc(fp)) != EOF ) - { - ssPrintf("%c",i); - } - fclose(fp); - #endif + /* Call solver */ + solver_exitflag = TailoredSolver_solve(¶ms, &output, &info, mem, fp , pt2function_TailoredSolver); - /* Copy outputs */ - for(i = 0; i < 160; i++) + #if SET_PRINTLEVEL_TailoredSolver > 0 + /* Read contents of printfs printed to file */ + rewind(fp); + while( (i = fgetc(fp)) != EOF ) + { + ssPrintf("%c",i); + } + fclose(fp); + #endif + + /* Copy outputs */ + for(i = 0; i < 160; i++) { outputs[i] = (real_T) output.U[i]; } diff --git a/solver/codeGen/TailoredSolver/interface/TailoredSolvercompact_lib.mdl b/solver/codeGen/TailoredSolver/interface/TailoredSolvercompact_lib.mdl index 1170256..2204f07 100644 --- a/solver/codeGen/TailoredSolver/interface/TailoredSolvercompact_lib.mdl +++ b/solver/codeGen/TailoredSolver/interface/TailoredSolvercompact_lib.mdl @@ -60,13 +60,13 @@ Model { } } } - Created "5/15/2023 4:53:02 PM" + Created "12/19/2023 2:31:27 PM" Creator "embotech AG" UpdateHistory "UpdateHistoryNever" ModifiedByFormat "%" LastModifiedBy "embotech AG" ModifiedDateFormat "%" - LastModifiedDate "5/15/2023 4:53:02 PM" + LastModifiedDate "12/19/2023 2:31:27 PM" RTWModifiedTimeStamp 315310195 ModelVersionFormat "1.%" ConfigurationManager "None" diff --git a/solver/codeGen/TailoredSolver/lib/libTailoredSolver.a b/solver/codeGen/TailoredSolver/lib/libTailoredSolver.a index eb5027b..ec1b988 100644 Binary files a/solver/codeGen/TailoredSolver/lib/libTailoredSolver.a and b/solver/codeGen/TailoredSolver/lib/libTailoredSolver.a differ diff --git a/solver/codeGen/TailoredSolver/lib/libTailoredSolver.so b/solver/codeGen/TailoredSolver/lib/libTailoredSolver.so index 6f0e32a..f73beab 100755 Binary files a/solver/codeGen/TailoredSolver/lib/libTailoredSolver.so and b/solver/codeGen/TailoredSolver/lib/libTailoredSolver.so differ diff --git a/solver/codeGen/TailoredSolver/lib/libTailoredSolver_withModel.so b/solver/codeGen/TailoredSolver/lib/libTailoredSolver_withModel.so index d258fc0..2f4bd27 100755 Binary files a/solver/codeGen/TailoredSolver/lib/libTailoredSolver_withModel.so and b/solver/codeGen/TailoredSolver/lib/libTailoredSolver_withModel.so differ diff --git a/solver/codeGen/TailoredSolver/lib_target/libTailoredSolver.a b/solver/codeGen/TailoredSolver/lib_target/libTailoredSolver.a index 6ad62c5..7f241bc 100644 Binary files a/solver/codeGen/TailoredSolver/lib_target/libTailoredSolver.a and b/solver/codeGen/TailoredSolver/lib_target/libTailoredSolver.a differ diff --git a/solver/codeGen/TailoredSolver/lib_target/libTailoredSolver.so b/solver/codeGen/TailoredSolver/lib_target/libTailoredSolver.so index a7d29a4..a311cde 100755 Binary files a/solver/codeGen/TailoredSolver/lib_target/libTailoredSolver.so and b/solver/codeGen/TailoredSolver/lib_target/libTailoredSolver.so differ diff --git a/solver/codeGen/TailoredSolverBuildable.m b/solver/codeGen/TailoredSolverBuildable.m index 5c0c959..ad9da31 100644 --- a/solver/codeGen/TailoredSolverBuildable.m +++ b/solver/codeGen/TailoredSolverBuildable.m @@ -50,7 +50,7 @@ function updateBuildInfo(buildInfo, cfg) end end - function [output,exitflag,info] = forcesInitOutputsMatlab() + function [output, exitflag, info] = forcesInitOutputsMatlab() infos_it = coder.nullcopy(zeros(1, 1)); infos_it2opt = coder.nullcopy(zeros(1, 1)); infos_res_eq = coder.nullcopy(zeros(1, 1)); @@ -104,7 +104,7 @@ function updateBuildInfo(buildInfo, cfg) [output,exitflag,info] = TailoredSolverBuildable.forcesCall(params.lb, params.ub, params.hu, params.xinit, params.x0, params.all_parameters, params.num_of_threads); end - function [output,exitflag,info] = forcesCall(lb, ub, hu, xinit, x0, all_parameters, num_of_threads) + function [output, exitflag, info] = forcesCall(lb, ub, hu, xinit, x0, all_parameters, num_of_threads) solvername = 'TailoredSolver'; @@ -116,14 +116,14 @@ function updateBuildInfo(buildInfo, cfg) 'all_parameters', double(all_parameters),... 'num_of_threads', uint32(num_of_threads)); - [output_c, exitflag_c, info_c] = TailoredSolverBuildable.forcesInitOutputsC(); + [output_c, exitflag_c, info_c] = TailoredSolverBuildable.forcesInitOutputsC(); %#ok headerName = [solvername '.h']; coder.cinclude(headerName); coder.cinclude([solvername '_memory.h']); coder.cinclude([solvername '_adtool2forces.h']); % define memory pointer - memptr = coder.opaque([solvername '_mem *'], 'HeaderFile', headerName); + memptr = coder.opaque([solvername '_mem *'], 'HeaderFile', headerName); %#ok memptr = coder.ceval([solvername '_internal_mem'], uint32(0)); % define solver input information (params, file and casadi) coder.cstructname(params, [solvername '_params'], 'extern', 'HeaderFile', headerName); @@ -168,7 +168,7 @@ function updateBuildInfo(buildInfo, cfg) end methods (Static, Access = private) - function [output,exitflag,info] = forcesInitOutputsC() + function [output, exitflag, info] = forcesInitOutputsC() infos_it = coder.nullcopy(int32(zeros(1, 1))); infos_it2opt = coder.nullcopy(int32(zeros(1, 1))); infos_res_eq = coder.nullcopy(double(zeros(1, 1))); diff --git a/solver/codeGen/TailoredSolver_adtool2forces.c b/solver/codeGen/TailoredSolver_adtool2forces.c index 5ffdae3..f920e81 100644 --- a/solver/codeGen/TailoredSolver_adtool2forces.c +++ b/solver/codeGen/TailoredSolver_adtool2forces.c @@ -8,7 +8,7 @@ #ifdef __cplusplus extern "C" { #endif - + #include "TailoredSolver/include/TailoredSolver.h" #ifndef NULL @@ -51,8 +51,8 @@ extern solver_int32_default TailoredSolver_adtool2forces(TailoredSolver_float *x TailoredSolver_float *nabla_h, /* Jacobian of inequality constraints (column major) */ TailoredSolver_float *hess, /* Hessian (column major) */ solver_int32_default stage, /* stage number (0 indexed) */ - solver_int32_default iteration, /* iteration number of solver */ - solver_int32_default threadID /* Id of caller thread */) + solver_int32_default iteration, /* iteration number of solver */ + solver_int32_default threadID /* Id of caller thread */) { /* AD tool input and output arrays */ const TailoredSolver_callback_float *in[4]; @@ -70,7 +70,7 @@ extern solver_int32_default TailoredSolver_adtool2forces(TailoredSolver_float *x TailoredSolver_callback_float nabla_h_sparse[6]; TailoredSolver_callback_float c_sparse[5]; TailoredSolver_callback_float nabla_c_sparse[26]; - + /* pointers to row and column info for * column compressed format used by AD tool */ diff --git a/solver/codeGen/TailoredSolver_adtool2forces.o b/solver/codeGen/TailoredSolver_adtool2forces.o index e88d898..9b2ac77 100644 Binary files a/solver/codeGen/TailoredSolver_adtool2forces.o and b/solver/codeGen/TailoredSolver_adtool2forces.o differ diff --git a/solver/codeGen/TailoredSolver_casadi.o b/solver/codeGen/TailoredSolver_casadi.o index 176fbee..f59c713 100644 Binary files a/solver/codeGen/TailoredSolver_casadi.o and b/solver/codeGen/TailoredSolver_casadi.o differ diff --git a/solver/codeGen/TailoredSolver_py.py b/solver/codeGen/TailoredSolver_py.py index b63471c..699aa54 100644 --- a/solver/codeGen/TailoredSolver_py.py +++ b/solver/codeGen/TailoredSolver_py.py @@ -18,7 +18,7 @@ # #def __init__(): ''' -a Python wrapper for a fast solver generated by FORCESPRO v6.1.0 +a Python wrapper for a fast solver generated by FORCESPRO v6.3.0 OUTPUT = TailoredSolver_py.TailoredSolver_solve(PARAMS) solves a multistage problem subject to the parameters supplied in the following dictionary: @@ -197,7 +197,7 @@ class TailoredSolver_mem(ctypes.Structure): def TailoredSolver_solve(params_arg): ''' -a Python wrapper for a fast solver generated by FORCESPRO v6.1.0 +a Python wrapper for a fast solver generated by FORCESPRO v6.3.0 OUTPUT = TailoredSolver_py.TailoredSolver_solve(PARAMS) solves a multistage problem subject to the parameters supplied in the following dictionary: