diff --git a/CMakeLists.txt b/CMakeLists.txt index 7335a564167991b77a83d55ab459baee09c2d479..96761f71a1de2487719fe17bd908e08743bff0d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,7 +99,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC eiquadprog::eiquadprog) find_package(osqp REQUIRED) # Link the OSQP shared library -target_link_libraries(${PROJECT_NAME} PRIVATE osqp::osqp) +target_link_libraries(${PROJECT_NAME} PUBLIC osqp::osqp) #find_package(yaml-cpp REQUIRED) #target_link_libraries(${PROJECT_NAME} PRIVATE yaml-cpp::yaml-cpp) diff --git a/include/osqp_folder/LICENSE b/include/osqp_folder/LICENSE deleted file mode 100644 index 5a568288d8a3816fd915dc1554612f68c253e9dd..0000000000000000000000000000000000000000 --- a/include/osqp_folder/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2019 Bartolomeo Stellato, Goran Banjac, Paul Goulart, Stephen Boyd - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/include/osqp_folder/include/auxil.h b/include/osqp_folder/include/auxil.h deleted file mode 100644 index d756c2a49fd42a9a13283dd254d536ef92a18c7d..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/auxil.h +++ /dev/null @@ -1,181 +0,0 @@ -#ifndef AUXIL_H -# define AUXIL_H - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -# include "types.h" - - -/*********************************************************** -* Auxiliary functions needed to compute ADMM iterations * * -***********************************************************/ -# if EMBEDDED != 1 - -/** - * Compute rho estimate from residuals - * @param work Workspace - * @return rho estimate - */ -c_float compute_rho_estimate(OSQPWorkspace *work); - -/** - * Adapt rho value based on current unscaled primal/dual residuals - * @param work Workspace - * @return Exitflag - */ -c_int adapt_rho(OSQPWorkspace *work); - -/** - * Set values of rho vector based on constraint types - * @param work Workspace - */ -void set_rho_vec(OSQPWorkspace *work); - -/** - * Update values of rho vector based on updated constraints. - * If the constraints change, update the linear systems solver. - * - * @param work Workspace - * @return Exitflag - */ -c_int update_rho_vec(OSQPWorkspace *work); - -# endif // EMBEDDED - -/** - * Swap c_float vector pointers - * @param a first vector - * @param b second vector - */ -void swap_vectors(c_float **a, - c_float **b); - - -/** - * Cold start workspace variables xz and y - * @param work Workspace - */ -void cold_start(OSQPWorkspace *work); - - -/** - * Update x_tilde and z_tilde variable (first ADMM step) - * @param work [description] - */ -void update_xz_tilde(OSQPWorkspace *work); - - -/** - * Update x (second ADMM step) - * Update also delta_x (For for dual infeasibility) - * @param work Workspace - */ -void update_x(OSQPWorkspace *work); - - -/** - * Update z (third ADMM step) - * @param work Workspace - */ -void update_z(OSQPWorkspace *work); - - -/** - * Update y variable (fourth ADMM step) - * Update also delta_y to check for primal infeasibility - * @param work Workspace - */ -void update_y(OSQPWorkspace *work); - - -/** - * Compute objective function from data at value x - * @param work OSQPWorkspace structure - * @param x Value x - * @return Objective function value - */ -c_float compute_obj_val(OSQPWorkspace *work, - c_float *x); - -/** - * Check whether QP has solution - * @param info OSQPInfo - */ -c_int has_solution(OSQPInfo *info); - -/** - * Store the QP solution - * @param work Workspace - */ -void store_solution(OSQPWorkspace *work); - - -/** - * Update solver information - * @param work Workspace - * @param iter Iteration number - * @param compute_objective Boolean (if compute the objective or not) - * @param polish Boolean (if called from polish) - */ -void update_info(OSQPWorkspace *work, - c_int iter, - c_int compute_objective, - c_int polish); - - -/** - * Reset solver information (after problem updates) - * @param info Information structure - */ -void reset_info(OSQPInfo *info); - - -/** - * Update solver status (value and string) - * @param info OSQPInfo - * @param status_val new status value - */ -void update_status(OSQPInfo *info, - c_int status_val); - - -/** - * Check if termination conditions are satisfied - * If the boolean flag is ON, it checks for approximate conditions (10 x larger - * tolerances than the ones set) - * - * @param work Workspace - * @param approximate Boolean - * @return Residuals check - */ -c_int check_termination(OSQPWorkspace *work, - c_int approximate); - - -# ifndef EMBEDDED - -/** - * Validate problem data - * @param data OSQPData to be validated - * @return Exitflag to check - */ -c_int validate_data(const OSQPData *data); - - -/** - * Validate problem settings - * @param settings OSQPSettings to be validated - * @return Exitflag to check - */ -c_int validate_settings(const OSQPSettings *settings); - - -# endif // #ifndef EMBEDDED - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef AUXIL_H diff --git a/include/osqp_folder/include/constants.h b/include/osqp_folder/include/constants.h deleted file mode 100644 index d5cec84398d15e9b6251e43c17bed2ed1b887d04..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/constants.h +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef CONSTANTS_H -# define CONSTANTS_H - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - - -/******************* -* OSQP Versioning * -*******************/ -# define OSQP_VERSION ("0.6.0") /* string literals automatically null-terminated - */ - -/****************** -* Solver Status * -******************/ -# define OSQP_DUAL_INFEASIBLE_INACCURATE (4) -# define OSQP_PRIMAL_INFEASIBLE_INACCURATE (3) -# define OSQP_SOLVED_INACCURATE (2) -# define OSQP_SOLVED (1) -# define OSQP_MAX_ITER_REACHED (-2) -# define OSQP_PRIMAL_INFEASIBLE (-3) /* primal infeasible */ -# define OSQP_DUAL_INFEASIBLE (-4) /* dual infeasible */ -# define OSQP_SIGINT (-5) /* interrupted by user */ -# ifdef PROFILING -# define OSQP_TIME_LIMIT_REACHED (-6) -# endif // ifdef PROFILING -# define OSQP_NON_CVX (-7) /* problem non convex */ -# define OSQP_UNSOLVED (-10) /* Unsolved. Only setup function has been called */ - - -/************************* -* Linear System Solvers * -*************************/ -enum linsys_solver_type { QDLDL_SOLVER, MKL_PARDISO_SOLVER }; -extern const char * LINSYS_SOLVER_NAME[]; - - -/****************** -* Solver Errors * -******************/ -enum osqp_error_type { - OSQP_DATA_VALIDATION_ERROR = 1, /* Start errors from 1 */ - OSQP_SETTINGS_VALIDATION_ERROR, - OSQP_LINSYS_SOLVER_LOAD_ERROR, - OSQP_LINSYS_SOLVER_INIT_ERROR, - OSQP_NONCVX_ERROR, - OSQP_MEM_ALLOC_ERROR, - OSQP_WORKSPACE_NOT_INIT_ERROR, -}; -extern const char * OSQP_ERROR_MESSAGE[]; - - -/********************************** -* Solver Parameters and Settings * -**********************************/ - -# define RHO (0.1) -# define SIGMA (1E-06) -# define MAX_ITER (4000) -# define EPS_ABS (1E-3) -# define EPS_REL (1E-3) -# define EPS_PRIM_INF (1E-4) -# define EPS_DUAL_INF (1E-4) -# define ALPHA (1.6) -# define LINSYS_SOLVER (QDLDL_SOLVER) - -# define RHO_MIN (1e-06) -# define RHO_MAX (1e06) -# define RHO_EQ_OVER_RHO_INEQ (1e03) -# define RHO_TOL (1e-04) ///< tolerance for detecting if an inequality is set to equality - - -# ifndef EMBEDDED -# define DELTA (1E-6) -# define POLISH (0) -# define POLISH_REFINE_ITER (3) -# define VERBOSE (1) -# endif // ifndef EMBEDDED - -# define SCALED_TERMINATION (0) -# define CHECK_TERMINATION (25) -# define WARM_START (1) -# define SCALING (10) - -# define MIN_SCALING (1e-04) ///< minimum scaling value -# define MAX_SCALING (1e+04) ///< maximum scaling value - - -# ifndef OSQP_NULL -# define OSQP_NULL 0 -# endif /* ifndef OSQP_NULL */ - -# ifndef OSQP_NAN -# define OSQP_NAN ((c_float)0x7fc00000UL) // not a number -# endif /* ifndef OSQP_NAN */ - -# ifndef OSQP_INFTY -# define OSQP_INFTY ((c_float)1e30) // infinity -# endif /* ifndef OSQP_INFTY */ - - -# if EMBEDDED != 1 -# define ADAPTIVE_RHO (1) -# define ADAPTIVE_RHO_INTERVAL (0) -# define ADAPTIVE_RHO_FRACTION (0.4) ///< fraction of setup time after which we update rho -# define ADAPTIVE_RHO_MULTIPLE_TERMINATION (4) ///< multiple of check_termination after which we update rho (if PROFILING disabled) -# define ADAPTIVE_RHO_FIXED (100) ///< number of iterations after which we update rho if termination_check and PROFILING are disabled -# define ADAPTIVE_RHO_TOLERANCE (5) ///< tolerance for adopting new rho; minimum ratio between new rho and the current one -# endif // if EMBEDDED != 1 - -# ifdef PROFILING -# define TIME_LIMIT (0) ///< Disable time limit as default -# endif // ifdef PROFILING - -/* Printing */ -# define PRINT_INTERVAL 200 - - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef CONSTANTS_H diff --git a/include/osqp_folder/include/cs.h b/include/osqp_folder/include/cs.h deleted file mode 100644 index dff0a805231a52d8ac7f0e78b897b27321df0028..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/cs.h +++ /dev/null @@ -1,180 +0,0 @@ -#ifndef CS_H -# define CS_H - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -# include "types.h" // CSC matrix type -# include "lin_alg.h" // Vector copy operations - -/***************************************************************************** -* Create and free CSC Matrices * -*****************************************************************************/ - -/** - * Create Compressed-Column-Sparse matrix from existing arrays - (no MALLOC to create inner arrays x, i, p) - * @param m First dimension - * @param n Second dimension - * @param nzmax Maximum number of nonzero elements - * @param x Vector of data - * @param i Vector of row indices - * @param p Vector of column pointers - * @return New matrix pointer - */ -csc* csc_matrix(c_int m, - c_int n, - c_int nzmax, - c_float *x, - c_int *i, - c_int *p); - - -/** - * Create uninitialized CSC matrix atricture - (uses MALLOC to create inner arrays x, i, p) - * @param m First dimension - * @param n Second dimension - * @param nzmax Maximum number of nonzero elements - * @param values Allocate values (0/1) - * @param triplet Allocate CSC or triplet format matrix (1/0) - * @return Matrix pointer - */ -csc* csc_spalloc(c_int m, - c_int n, - c_int nzmax, - c_int values, - c_int triplet); - - -/** - * Free sparse matrix - (uses FREE to free inner arrays x, i, p) - * @param A Matrix in CSC format - */ -void csc_spfree(csc *A); - - -/** - * free workspace and return a sparse matrix result - * @param C CSC matrix - * @param w Workspace vector - * @param x Workspace vector - * @param ok flag - * @return Return result C if OK, otherwise free it - */ -csc* csc_done(csc *C, - void *w, - void *x, - c_int ok); - -/***************************************************************************** -* Copy Matrices * -*****************************************************************************/ - -/** - * Copy sparse CSC matrix A to output. - * output is allocated by this function (uses MALLOC) - */ -csc* copy_csc_mat(const csc *A); - - -/** - * Copy sparse CSC matrix A to B (B is preallocated, NO MALOC) - */ -void prea_copy_csc_mat(const csc *A, - csc *B); - - -/***************************************************************************** -* Matrices Conversion * -*****************************************************************************/ - - -/** - * C = compressed-column CSC from matrix T in triplet form - * - * TtoC stores the vector of indices from T to C - * -> C[TtoC[i]] = T[i] - * - * @param T matrix in triplet format - * @param TtoC vector of indices from triplet to CSC format - * @return matrix in CSC format - */ -csc* triplet_to_csc(const csc *T, - c_int *TtoC); - - -/** - * C = compressed-row CSR from matrix T in triplet form - * - * TtoC stores the vector of indices from T to C - * -> C[TtoC[i]] = T[i] - * - * @param T matrix in triplet format - * @param TtoC vector of indices from triplet to CSR format - * @return matrix in CSR format - */ -csc* triplet_to_csr(const csc *T, - c_int *TtoC); - - -/** - * Convert sparse to dense - */ -c_float* csc_to_dns(csc *M); - - -/** - * Convert square CSC matrix into upper triangular one - * - * @param M Matrix to be converted - * @return Upper triangular matrix in CSC format - */ -csc* csc_to_triu(csc *M); - - -/***************************************************************************** -* Extra operations * -*****************************************************************************/ - -/** - * p [0..n] = cumulative sum of c [0..n-1], and then copy p [0..n-1] into c - * - * @param p Create cumulative sum into p - * @param c Vector of which we compute cumulative sum - * @param n Number of elements - * @return Exitflag - */ -c_int csc_cumsum(c_int *p, - c_int *c, - c_int n); - -/** - * Compute inverse of permutation matrix stored in the vector p. - * The computed inverse is also stored in a vector. - */ -c_int* csc_pinv(c_int const *p, - c_int n); - -/** - * C = A(p,p)= PAP' where A and C are symmetric the upper part stored; - * NB: pinv not p! - * @param A Original matrix (upper-triangular) - * @param pinv Inverse of permutation vector - * @param AtoC Mapping from indices of A-x to C->x - * @param values Are values of A allocated? - * @return New matrix (allocated) - */ -csc* csc_symperm(const csc *A, - const c_int *pinv, - c_int *AtoC, - c_int values); - - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef CS_H diff --git a/include/osqp_folder/include/ctrlc.h b/include/osqp_folder/include/ctrlc.h deleted file mode 100644 index 749e8e78d640545e4bc20eca723e2ed7f037b792..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/ctrlc.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Interface for OSQP signal handling. - */ - -#ifndef CTRLC_H -# define CTRLC_H - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -# include "glob_opts.h" - -# if defined MATLAB - -/* No header file available here; define the prototypes ourselves */ -bool utIsInterruptPending(void); -bool utSetInterruptEnabled(bool); - -# elif defined IS_WINDOWS - -/* Use Windows SetConsoleCtrlHandler for signal handling */ -# include <windows.h> - -# else // if defined MATLAB - -/* Use sigaction for signal handling on non-Windows machines */ -# include <signal.h> - -# endif // if defined MATLAB - -/* METHODS are the same for both */ - -/** - * Start listener for ctrl-c interrupts - */ -void osqp_start_interrupt_listener(void); - -/** - * End listener for ctrl-c interrupts - */ -void osqp_end_interrupt_listener(void); - -/** - * Check if the solver has been interrupted - * @return Boolean indicating if the solver has been interrupted - */ -int osqp_is_interrupted(void); - - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - - -#endif /* END IFDEF CTRLC */ diff --git a/include/osqp_folder/include/error.h b/include/osqp_folder/include/error.h deleted file mode 100644 index 9d7879f03d49e31f5b5e8ae3b67a013aa01a4ea5..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/error.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef ERROR_H -# define ERROR_H - -/* OSQP error handling */ - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -# include "types.h" - - -/* OSQP error macro */ -# if __STDC_VERSION__ >= 199901L -/* The C99 standard gives the __func__ macro, which is preferred over __FUNCTION__ */ -# define osqp_error(error_code) _osqp_error(error_code, __func__); -#else -# define osqp_error(error_code) _osqp_error(error_code, __FUNCTION__); -#endif - - - -/** - * Internal function to print error description and return error code. - * @param Error code - * @param Function name - * @return Error code - */ - c_int _osqp_error(enum osqp_error_type error_code, - const char * function_name); - - - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef ERROR_H diff --git a/include/osqp_folder/include/glob_opts.h b/include/osqp_folder/include/glob_opts.h deleted file mode 100644 index 21bcac09aa3c16c40e2c65737d0016710c9f6ab7..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/glob_opts.h +++ /dev/null @@ -1,171 +0,0 @@ -#ifndef GLOB_OPTS_H -# define GLOB_OPTS_H - -# ifdef __cplusplus -extern "C" { -# endif /* ifdef __cplusplus */ - -/* - Define OSQP compiler flags - */ - -// cmake generated compiler flags -#include "osqp_configure.h" - -/* DATA CUSTOMIZATIONS (depending on memory manager)----------------------- */ - -// We do not need memory allocation functions if EMBEDDED is enabled -# ifndef EMBEDDED - -/* define custom printfs and memory allocation (e.g. matlab/python) */ -# ifdef MATLAB - # include "mex.h" -static void* c_calloc(size_t num, size_t size) { - void *m = mxCalloc(num, size); - mexMakeMemoryPersistent(m); - return m; -} - -static void* c_malloc(size_t size) { - void *m = mxMalloc(size); - mexMakeMemoryPersistent(m); - return m; -} - -static void* c_realloc(void *ptr, size_t size) { - void *m = mxRealloc(ptr, size); - mexMakeMemoryPersistent(m); - return m; -} - - # define c_free mxFree -# elif defined PYTHON -// Define memory allocation for python. Note that in Python 2 memory manager -// Calloc is not implemented - # include <Python.h> - # define c_malloc PyMem_Malloc - # if PY_MAJOR_VERSION >= 3 - # define c_calloc PyMem_Calloc - # else /* if PY_MAJOR_VERSION >= 3 */ -static void* c_calloc(size_t num, size_t size) { - void *m = PyMem_Malloc(num * size); - memset(m, 0, num * size); - return m; -} - # endif /* if PY_MAJOR_VERSION >= 3 */ - # define c_free PyMem_Free - # define c_realloc PyMem_Realloc - -# elif !defined OSQP_CUSTOM_MEMORY -/* If no custom memory allocator defined, use - * standard linux functions. Custom memory allocator definitions - * appear in the osqp_configure.h generated file. */ - # include <stdlib.h> - # define c_malloc malloc - # define c_calloc calloc - # define c_free free - # define c_realloc realloc -# endif /* ifdef MATLAB */ - -# endif // end ifndef EMBEDDED - - -/* Use customized number representation ----------------------------------- */ -# ifdef DLONG // long integers -typedef long long c_int; /* for indices */ -# else // standard integers -typedef int c_int; /* for indices */ -# endif /* ifdef DLONG */ - - -# ifndef DFLOAT // Doubles -typedef double c_float; /* for numerical values */ -# else // Floats -typedef float c_float; /* for numerical values */ -# endif /* ifndef DFLOAT */ - - -/* Use customized operations */ - -# ifndef c_absval -# define c_absval(x) (((x) < 0) ? -(x) : (x)) -# endif /* ifndef c_absval */ - -# ifndef c_max -# define c_max(a, b) (((a) > (b)) ? (a) : (b)) -# endif /* ifndef c_max */ - -# ifndef c_min -# define c_min(a, b) (((a) < (b)) ? (a) : (b)) -# endif /* ifndef c_min */ - -// Round x to the nearest multiple of N -# ifndef c_roundmultiple -# define c_roundmultiple(x, N) ((x) + .5 * (N)-c_fmod((x) + .5 * (N), (N))) -# endif /* ifndef c_roundmultiple */ - - -/* Use customized functions ----------------------------------------------- */ - -# if EMBEDDED != 1 - -# include <math.h> -# ifndef DFLOAT // Doubles -# define c_sqrt sqrt -# define c_fmod fmod -# else // Floats -# define c_sqrt sqrtf -# define c_fmod fmodf -# endif /* ifndef DFLOAT */ - -# endif // end EMBEDDED - - -# ifdef PRINTING -# include <stdio.h> -# include <string.h> - -# ifdef MATLAB -# define c_print mexPrintf - -// The following trick slows down the performance a lot. Since many solvers -// actually -// call mexPrintf and immediately force print buffer flush -// otherwise messages don't appear until solver termination -// ugly because matlab does not provide a vprintf mex interface -// #include <stdarg.h> -// static int c_print(char *msg, ...) -// { -// va_list argList; -// va_start(argList, msg); -// //message buffer -// int bufferSize = 256; -// char buffer[bufferSize]; -// vsnprintf(buffer,bufferSize-1, msg, argList); -// va_end(argList); -// int out = mexPrintf(buffer); //print to matlab display -// mexEvalString("drawnow;"); // flush matlab print buffer -// return out; -// } -# elif defined PYTHON -# include <Python.h> -# define c_print PySys_WriteStdout -# elif defined R_LANG -# include <R_ext/Print.h> -# define c_print Rprintf -# else /* ifdef MATLAB */ -# define c_print printf -# endif /* ifdef MATLAB */ - -/* Print error macro */ -# define c_eprint(...) c_print("ERROR in %s: ", __FUNCTION__); c_print(\ - __VA_ARGS__); c_print("\n"); - -# endif /* PRINTING */ - - -# ifdef __cplusplus -} -# endif /* ifdef __cplusplus */ - -#endif /* ifndef GLOB_OPTS_H */ diff --git a/include/osqp_folder/include/kkt.h b/include/osqp_folder/include/kkt.h deleted file mode 100644 index 9560d5ecbf4e26e77aabb315a78257adf560378f..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/kkt.h +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef KKT_H -# define KKT_H - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -# include "types.h" - -# ifndef EMBEDDED - -# include "cs.h" - -/** - * Form square symmetric KKT matrix of the form - * - * [P + param1 I, A'; - * A -diag(param2)] - * - * NB: Only the upper triangular part is stuffed! - * - * - * If Pdiag_idx is not OSQP_NULL, it saves the index of the diagonal - * elements of P there and the number of diagonal elements in Pdiag_n. - * - * Similarly, if rhotoKKT is not null, - * it saves where the values of param2 go in the final KKT matrix - * - * NB: Pdiag_idx needs to be freed! - * - * @param P cost matrix (already just upper triangular part) - * @param A linear constraint matrix - * @param format CSC (0) or CSR (1) - * @param param1 regularization parameter - * @param param2 regularization parameter (vector) - * @param PtoKKT (modified) index mapping from elements of P to KKT matrix - * @param AtoKKT (modified) index mapping from elements of A to KKT matrix - * @param Pdiag_idx (modified) Address of the index of diagonal elements in P - * @param Pdiag_n (modified) Address to the number of diagonal elements in P - * @param param2toKKT (modified) index mapping from param2 to elements of - *KKT - * @return return status flag - */ -csc* form_KKT(const csc *P, - const csc *A, - c_int format, - c_float param1, - c_float *param2, - c_int *PtoKKT, - c_int *AtoKKT, - c_int **Pdiag_idx, - c_int *Pdiag_n, - c_int *param2toKKT); -# endif // ifndef EMBEDDED - - -# if EMBEDDED != 1 - -/** - * Update KKT matrix using the elements of P - * - * @param KKT KKT matrix in CSC form (upper-triangular) - * @param P P matrix in CSC form (upper-triangular) - * @param PtoKKT Vector of pointers from P->x to KKT->x - * @param param1 Parameter added to the diagonal elements of P - * @param Pdiag_idx Index of diagonal elements in P->x - * @param Pdiag_n Number of diagonal elements of P - */ -void update_KKT_P(csc *KKT, - const csc *P, - const c_int *PtoKKT, - const c_float param1, - const c_int *Pdiag_idx, - const c_int Pdiag_n); - - -/** - * Update KKT matrix using the elements of A - * - * @param KKT KKT matrix in CSC form (upper-triangular) - * @param A A matrix in CSC form (upper-triangular) - * @param AtoKKT Vector of pointers from A->x to KKT->x - */ -void update_KKT_A(csc *KKT, - const csc *A, - const c_int *AtoKKT); - - -/** - * Update KKT matrix with new param2 - * - * @param KKT KKT matrix - * @param param2 Parameter of the KKT matrix (vector) - * @param param2toKKT index where param2 enters in the KKT matrix - * @param m number of constraints - */ -void update_KKT_param2(csc *KKT, - const c_float *param2, - const c_int *param2toKKT, - const c_int m); - -# endif // EMBEDDED != 1 - - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef KKT_H diff --git a/include/osqp_folder/include/lin_alg.h b/include/osqp_folder/include/lin_alg.h deleted file mode 100644 index e9589e9d7b714677f885ba38143a9b55fe4b3fb4..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/lin_alg.h +++ /dev/null @@ -1,216 +0,0 @@ -#ifndef LIN_ALG_H -# define LIN_ALG_H - - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -# include "types.h" - - -/* VECTOR FUNCTIONS ----------------------------------------------------------*/ - -# ifndef EMBEDDED - -/* copy vector a into output (Uses MALLOC)*/ -c_float* vec_copy(c_float *a, - c_int n); -# endif // ifndef EMBEDDED - -/* copy vector a into preallocated vector b */ -void prea_vec_copy(const c_float *a, - c_float *b, - c_int n); - -/* copy integer vector a into preallocated vector b */ -void prea_int_vec_copy(const c_int *a, - c_int *b, - c_int n); - -/* set float vector to scalar */ -void vec_set_scalar(c_float *a, - c_float sc, - c_int n); - -/* set integer vector to scalar */ -void int_vec_set_scalar(c_int *a, - c_int sc, - c_int n); - -/* add scalar to vector*/ -void vec_add_scalar(c_float *a, - c_float sc, - c_int n); - -/* multiply scalar to vector */ -void vec_mult_scalar(c_float *a, - c_float sc, - c_int n); - -/* c = a + sc*b */ -void vec_add_scaled(c_float *c, - const c_float *a, - const c_float *b, - c_int n, - c_float sc); - -/* ||v||_inf */ -c_float vec_norm_inf(const c_float *v, - c_int l); - -/* ||Sv||_inf */ -c_float vec_scaled_norm_inf(const c_float *S, - const c_float *v, - c_int l); - -/* ||a - b||_inf */ -c_float vec_norm_inf_diff(const c_float *a, - const c_float *b, - c_int l); - -/* mean of vector elements */ -c_float vec_mean(const c_float *a, - c_int n); - -# if EMBEDDED != 1 - -/* Vector elementwise reciprocal b = 1./a (needed for scaling)*/ -void vec_ew_recipr(const c_float *a, - c_float *b, - c_int n); -# endif // if EMBEDDED != 1 - -/* Inner product a'b */ -c_float vec_prod(const c_float *a, - const c_float *b, - c_int n); - -/* Elementwise product a.*b stored in c*/ -void vec_ew_prod(const c_float *a, - const c_float *b, - c_float *c, - c_int n); - -# if EMBEDDED != 1 - -/* Elementwise sqrt of the vector elements */ -void vec_ew_sqrt(c_float *a, - c_int n); - -/* Elementwise max between each vector component and max_val */ -void vec_ew_max(c_float *a, - c_int n, - c_float max_val); - -/* Elementwise min between each vector component and max_val */ -void vec_ew_min(c_float *a, - c_int n, - c_float min_val); - -/* Elementwise maximum between vectors c = max(a, b) */ -void vec_ew_max_vec(const c_float *a, - const c_float *b, - c_float *c, - c_int n); - -/* Elementwise minimum between vectors c = min(a, b) */ -void vec_ew_min_vec(const c_float *a, - const c_float *b, - c_float *c, - c_int n); - -# endif // if EMBEDDED != 1 - - -/* MATRIX FUNCTIONS ----------------------------------------------------------*/ - -/* multiply scalar to matrix */ -void mat_mult_scalar(csc *A, - c_float sc); - -/* Premultiply matrix A by diagonal matrix with diagonal d, - i.e. scale the rows of A by d - */ -void mat_premult_diag(csc *A, - const c_float *d); - -/* Premultiply matrix A by diagonal matrix with diagonal d, - i.e. scale the columns of A by d - */ -void mat_postmult_diag(csc *A, - const c_float *d); - - -/* Matrix-vector multiplication - * y = A*x (if plus_eq == 0) - * y += A*x (if plus_eq == 1) - * y -= A*x (if plus_eq == -1) - */ -void mat_vec(const csc *A, - const c_float *x, - c_float *y, - c_int plus_eq); - - -/* Matrix-transpose-vector multiplication - * y = A'*x (if plus_eq == 0) - * y += A'*x (if plus_eq == 1) - * y -= A'*x (if plus_eq == -1) - * If skip_diag == 1, then diagonal elements of A are assumed to be zero. - */ -void mat_tpose_vec(const csc *A, - const c_float *x, - c_float *y, - c_int plus_eq, - c_int skip_diag); - - -# if EMBEDDED != 1 - -/** - * Infinity norm of each matrix column - * @param M Input matrix - * @param E Vector of infinity norms - * - */ -void mat_inf_norm_cols(const csc *M, - c_float *E); - -/** - * Infinity norm of each matrix row - * @param M Input matrix - * @param E Vector of infinity norms - * - */ -void mat_inf_norm_rows(const csc *M, - c_float *E); - -/** - * Infinity norm of each matrix column - * Matrix M is symmetric upper-triangular - * - * @param M Input matrix (symmetric, upper-triangular) - * @param E Vector of infinity norms - * - */ -void mat_inf_norm_cols_sym_triu(const csc *M, - c_float *E); - -# endif // EMBEDDED != 1 - -/** - * Compute quadratic form f(x) = 1/2 x' P x - * @param P quadratic matrix in CSC form (only upper triangular) - * @param x argument float vector - * @return quadratic form value - */ -c_float quad_form(const csc *P, - const c_float *x); - - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef LIN_ALG_H diff --git a/include/osqp_folder/include/lin_sys.h b/include/osqp_folder/include/lin_sys.h deleted file mode 100644 index 69f3bdcff7107a65ebb3d6dcb491070d2bfca518..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/lin_sys.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef LIN_SYS_H -# define LIN_SYS_H - -/* KKT linear system definition and solution */ - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -# include "types.h" - -/** - * Load linear system solver shared library - * @param linsys_solver Linear system solver - * @return Zero on success, nonzero on failure. - */ -c_int load_linsys_solver(enum linsys_solver_type linsys_solver); - - -/** - * Unload linear system solver shared library - * @param linsys_solver Linear system solver - * @return Zero on success, nonzero on failure. - */ -c_int unload_linsys_solver(enum linsys_solver_type linsys_solver); - - -// NB: Only the upper triangular part of P is stuffed! - -/** - * Initialize linear system solver structure - * @param s Pointer to linear system solver structure - * @param P Cost function matrix - * @param A Constraint matrix - * @param sigma Algorithm parameter - * @param rho_vec Algorithm parameter - * @param linsys_solver Linear system solver - * @param polish 0/1 depending whether we are allocating for - *polishing or not - * @return Exitflag for error (0 if no errors) - */ -c_int init_linsys_solver(LinSysSolver **s, - const csc *P, - const csc *A, - c_float sigma, - const c_float *rho_vec, - enum linsys_solver_type linsys_solver, - c_int polish); - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef LIN_SYS_H diff --git a/include/osqp_folder/include/osqp.h b/include/osqp_folder/include/osqp.h deleted file mode 100644 index 296aff82deacb824145027d1a5a2b671c48a1061..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/osqp.h +++ /dev/null @@ -1,430 +0,0 @@ -#ifndef OSQP_H -# define OSQP_H - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -/* Includes */ -# include "types.h" -# include "util.h" // Needed for osqp_set_default_settings functions - - -// Library to deal with sparse matrices enabled only if embedded not defined -# ifndef EMBEDDED -# include "cs.h" -# endif // ifndef EMBEDDED - -/******************** -* Main Solver API * -********************/ - -/** - * @name Main solver API - * @{ - */ - -/** - * Set default settings from constants.h file - * assumes settings already allocated in memory - * @param settings settings structure - */ -void osqp_set_default_settings(OSQPSettings *settings); - - -# ifndef EMBEDDED - -/** - * Initialize OSQP solver allocating memory. - * - * All the inputs must be already allocated in memory before calling. - * - * It performs: - * - data and settings validation - * - problem data scaling - * - automatic parameters tuning (if enabled) - * - setup linear system solver: - * - direct solver: KKT matrix factorization is performed here - * - indirect solver: KKT matrix preconditioning is performed here - * - * NB: This is the only function that allocates dynamic memory and is not used - *during code generation - * - * @param workp Solver workspace pointer - * @param data Problem data - * @param settings Solver settings - * @return Exitflag for errors (0 if no errors) - */ -c_int osqp_setup(OSQPWorkspace** workp, const OSQPData* data, const OSQPSettings* settings); - -# endif // #ifndef EMBEDDED - -/** - * Solve quadratic program - * - * The final solver information is stored in the \a work->info structure - * - * The solution is stored in the \a work->solution structure - * - * If the problem is primal infeasible, the certificate is stored - * in \a work->delta_y - * - * If the problem is dual infeasible, the certificate is stored in \a - * work->delta_x - * - * @param work Workspace allocated - * @return Exitflag for errors - */ -c_int osqp_solve(OSQPWorkspace *work); - - -# ifndef EMBEDDED - -/** - * Cleanup workspace by deallocating memory - * - * This function is not used in code generation - * @param work Workspace - * @return Exitflag for errors - */ -c_int osqp_cleanup(OSQPWorkspace *work); - -# endif // ifndef EMBEDDED - -/** @} */ - - -/******************************************** -* Sublevel API * -* * -* Edit data without performing setup again * -********************************************/ - -/** - * @name Sublevel API - * @{ - */ - -/** - * Update linear cost in the problem - * @param work Workspace - * @param q_new New linear cost - * @return Exitflag for errors and warnings - */ -c_int osqp_update_lin_cost(OSQPWorkspace *work, - const c_float *q_new); - - -/** - * Update lower and upper bounds in the problem constraints - * @param work Workspace - * @param l_new New lower bound - * @param u_new New upper bound - * @return Exitflag: 1 if new lower bound is not <= than new upper bound - */ -c_int osqp_update_bounds(OSQPWorkspace *work, - const c_float *l_new, - const c_float *u_new); - - -/** - * Update lower bound in the problem constraints - * @param work Workspace - * @param l_new New lower bound - * @return Exitflag: 1 if new lower bound is not <= than upper bound - */ -c_int osqp_update_lower_bound(OSQPWorkspace *work, - const c_float *l_new); - - -/** - * Update upper bound in the problem constraints - * @param work Workspace - * @param u_new New upper bound - * @return Exitflag: 1 if new upper bound is not >= than lower bound - */ -c_int osqp_update_upper_bound(OSQPWorkspace *work, - const c_float *u_new); - - -/** - * Warm start primal and dual variables - * @param work Workspace structure - * @param x Primal variable - * @param y Dual variable - * @return Exitflag - */ -c_int osqp_warm_start(OSQPWorkspace *work, - const c_float *x, - const c_float *y); - - -/** - * Warm start primal variable - * @param work Workspace structure - * @param x Primal variable - * @return Exitflag - */ -c_int osqp_warm_start_x(OSQPWorkspace *work, - const c_float *x); - - -/** - * Warm start dual variable - * @param work Workspace structure - * @param y Dual variable - * @return Exitflag - */ -c_int osqp_warm_start_y(OSQPWorkspace *work, - const c_float *y); - - -# if EMBEDDED != 1 - -/** - * Update elements of matrix P (upper triangular) - * without changing sparsity structure. - * - * - * If Px_new_idx is OSQP_NULL, Px_new is assumed to be as long as P->x - * and the whole P->x is replaced. - * - * @param work Workspace structure - * @param Px_new Vector of new elements in P->x (upper triangular) - * @param Px_new_idx Index mapping new elements to positions in P->x - * @param P_new_n Number of new elements to be changed - * @return output flag: 0: OK - * 1: P_new_n > nnzP - * <0: error in the update - */ -c_int osqp_update_P(OSQPWorkspace *work, - const c_float *Px_new, - const c_int *Px_new_idx, - c_int P_new_n); - - -/** - * Update elements of matrix A without changing sparsity structure. - * - * - * If Ax_new_idx is OSQP_NULL, Ax_new is assumed to be as long as A->x - * and the whole A->x is replaced. - * - * @param work Workspace structure - * @param Ax_new Vector of new elements in A->x - * @param Ax_new_idx Index mapping new elements to positions in A->x - * @param A_new_n Number of new elements to be changed - * @return output flag: 0: OK - * 1: A_new_n > nnzA - * <0: error in the update - */ -c_int osqp_update_A(OSQPWorkspace *work, - const c_float *Ax_new, - const c_int *Ax_new_idx, - c_int A_new_n); - - -/** - * Update elements of matrix P (upper triangular) and elements of matrix A - * without changing sparsity structure. - * - * - * If Px_new_idx is OSQP_NULL, Px_new is assumed to be as long as P->x - * and the whole P->x is replaced. - * - * If Ax_new_idx is OSQP_NULL, Ax_new is assumed to be as long as A->x - * and the whole A->x is replaced. - * - * @param work Workspace structure - * @param Px_new Vector of new elements in P->x (upper triangular) - * @param Px_new_idx Index mapping new elements to positions in P->x - * @param P_new_n Number of new elements to be changed - * @param Ax_new Vector of new elements in A->x - * @param Ax_new_idx Index mapping new elements to positions in A->x - * @param A_new_n Number of new elements to be changed - * @return output flag: 0: OK - * 1: P_new_n > nnzP - * 2: A_new_n > nnzA - * <0: error in the update - */ -c_int osqp_update_P_A(OSQPWorkspace *work, - const c_float *Px_new, - const c_int *Px_new_idx, - c_int P_new_n, - const c_float *Ax_new, - const c_int *Ax_new_idx, - c_int A_new_n); - -/** - * Update rho. Limit it between RHO_MIN and RHO_MAX. - * @param work Workspace - * @param rho_new New rho setting - * @return Exitflag - */ -c_int osqp_update_rho(OSQPWorkspace *work, - c_float rho_new); - -# endif // if EMBEDDED != 1 - -/** @} */ - - -/** - * @name Update settings - * @{ - */ - - -/** - * Update max_iter setting - * @param work Workspace - * @param max_iter_new New max_iter setting - * @return Exitflag - */ -c_int osqp_update_max_iter(OSQPWorkspace *work, - c_int max_iter_new); - - -/** - * Update absolute tolernace value - * @param work Workspace - * @param eps_abs_new New absolute tolerance value - * @return Exitflag - */ -c_int osqp_update_eps_abs(OSQPWorkspace *work, - c_float eps_abs_new); - - -/** - * Update relative tolernace value - * @param work Workspace - * @param eps_rel_new New relative tolerance value - * @return Exitflag - */ -c_int osqp_update_eps_rel(OSQPWorkspace *work, - c_float eps_rel_new); - - -/** - * Update primal infeasibility tolerance - * @param work Workspace - * @param eps_prim_inf_new New primal infeasibility tolerance - * @return Exitflag - */ -c_int osqp_update_eps_prim_inf(OSQPWorkspace *work, - c_float eps_prim_inf_new); - - -/** - * Update dual infeasibility tolerance - * @param work Workspace - * @param eps_dual_inf_new New dual infeasibility tolerance - * @return Exitflag - */ -c_int osqp_update_eps_dual_inf(OSQPWorkspace *work, - c_float eps_dual_inf_new); - - -/** - * Update relaxation parameter alpha - * @param work Workspace - * @param alpha_new New relaxation parameter value - * @return Exitflag - */ -c_int osqp_update_alpha(OSQPWorkspace *work, - c_float alpha_new); - - -/** - * Update warm_start setting - * @param work Workspace - * @param warm_start_new New warm_start setting - * @return Exitflag - */ -c_int osqp_update_warm_start(OSQPWorkspace *work, - c_int warm_start_new); - - -/** - * Update scaled_termination setting - * @param work Workspace - * @param scaled_termination_new New scaled_termination setting - * @return Exitflag - */ -c_int osqp_update_scaled_termination(OSQPWorkspace *work, - c_int scaled_termination_new); - -/** - * Update check_termination setting - * @param work Workspace - * @param check_termination_new New check_termination setting - * @return Exitflag - */ -c_int osqp_update_check_termination(OSQPWorkspace *work, - c_int check_termination_new); - - -# ifndef EMBEDDED - -/** - * Update regularization parameter in polish - * @param work Workspace - * @param delta_new New regularization parameter - * @return Exitflag - */ -c_int osqp_update_delta(OSQPWorkspace *work, - c_float delta_new); - - -/** - * Update polish setting - * @param work Workspace - * @param polish_new New polish setting - * @return Exitflag - */ -c_int osqp_update_polish(OSQPWorkspace *work, - c_int polish_new); - - -/** - * Update number of iterative refinement steps in polish - * @param work Workspace - * @param polish_refine_iter_new New iterative reginement steps - * @return Exitflag - */ -c_int osqp_update_polish_refine_iter(OSQPWorkspace *work, - c_int polish_refine_iter_new); - - -/** - * Update verbose setting - * @param work Workspace - * @param verbose_new New verbose setting - * @return Exitflag - */ -c_int osqp_update_verbose(OSQPWorkspace *work, - c_int verbose_new); - - -# endif // #ifndef EMBEDDED - -# ifdef PROFILING - -/** - * Update time_limit setting - * @param work Workspace - * @param time_limit_new New time_limit setting - * @return Exitflag - */ -c_int osqp_update_time_limit(OSQPWorkspace *work, - c_float time_limit_new); -# endif // ifdef PROFILING - -/** @} */ - - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef OSQP_H diff --git a/include/osqp_folder/include/osqp_configure.h b/include/osqp_folder/include/osqp_configure.h deleted file mode 100644 index 79248bc3a4e18183109cd17e84817d28bf9ba982..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/osqp_configure.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef OSQP_CONFIGURE_H -# define OSQP_CONFIGURE_H - -# ifdef __cplusplus -extern "C" { -# endif /* ifdef __cplusplus */ - -/* DEBUG */ -/* #undef DEBUG */ - -/* Operating system */ -#define IS_LINUX -/* #undef IS_MAC */ -/* #undef IS_WINDOWS */ - -/* EMBEDDED */ -/* #undef EMBEDDED */ - -/* PRINTING */ -#define PRINTING - -/* PROFILING */ -#define PROFILING - -/* CTRLC */ -#define CTRLC - -/* DFLOAT */ -/* #undef DFLOAT */ - -/* DLONG */ -// #define DLONG - -/* ENABLE_MKL_PARDISO */ -#define ENABLE_MKL_PARDISO - -/* MEMORY MANAGEMENT */ -/* #undef OSQP_CUSTOM_MEMORY */ -#ifdef OSQP_CUSTOM_MEMORY -#include "" -#endif - - - -# ifdef __cplusplus -} -# endif /* ifdef __cplusplus */ - -#endif /* ifndef OSQP_CONFIGURE_H */ diff --git a/include/osqp_folder/include/polish.h b/include/osqp_folder/include/polish.h deleted file mode 100644 index 5a8dc28ffefa9fcb0d4cd826264f72ad3856088b..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/polish.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Solution polish based on assuming the active set */ -#ifndef POLISH_H -# define POLISH_H - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - - -# include "types.h" - -/** - * Solution polish: Solve equality constrained QP with assumed active - *constraints - * @param work Workspace - * @return Exitflag - */ -c_int polish(OSQPWorkspace *work); - - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef POLISH_H diff --git a/include/osqp_folder/include/proj.h b/include/osqp_folder/include/proj.h deleted file mode 100644 index ec0066a3af8f350ef80d014c205b1230c22e73cd..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/proj.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef PROJ_H -# define PROJ_H - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -# include "types.h" - - -/* Define Projections onto set C involved in the ADMM algorithm */ - -/** - * Project z onto \f$C = [l, u]\f$ - * @param z Vector to project - * @param work Workspace - */ -void project(OSQPWorkspace *work, - c_float *z); - - -/** - * Ensure z satisfies box constraints and y is is normal cone of z - * @param work Workspace - * @param z Primal variable z - * @param y Dual variable y - */ -void project_normalcone(OSQPWorkspace *work, - c_float *z, - c_float *y); - - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef PROJ_H diff --git a/include/osqp_folder/include/scaling.h b/include/osqp_folder/include/scaling.h deleted file mode 100644 index 0df9c04d9c77da2e6fbbec969ce45207cf293549..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/scaling.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef SCALING_H -# define SCALING_H - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -// Functions to scale problem data -# include "types.h" -# include "lin_alg.h" -# include "constants.h" - -// Enable data scaling if EMBEDDED is disabled or if EMBEDDED == 2 -# if EMBEDDED != 1 - -/** - * Scale problem matrices - * @param work Workspace - * @return exitflag - */ -c_int scale_data(OSQPWorkspace *work); -# endif // if EMBEDDED != 1 - - -/** - * Unscale problem matrices - * @param work Workspace - * @return exitflag - */ -c_int unscale_data(OSQPWorkspace *work); - - -/** - * Unscale solution - * @param work Workspace - * @return exitflag - */ -c_int unscale_solution(OSQPWorkspace *work); - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef SCALING_H diff --git a/include/osqp_folder/include/types.h b/include/osqp_folder/include/types.h deleted file mode 100644 index 4af5e0bde0b5f82b26b068aeca99dbbdaa331ae3..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/types.h +++ /dev/null @@ -1,324 +0,0 @@ -#ifndef OSQP_TYPES_H -# define OSQP_TYPES_H - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -# include "glob_opts.h" -# include "constants.h" - - -/****************** -* Internal types * -******************/ - -/** - * Matrix in compressed-column or triplet form - */ -typedef struct { - c_int nzmax; ///< maximum number of entries - c_int m; ///< number of rows - c_int n; ///< number of columns - c_int *p; ///< column pointers (size n+1); col indices (size nzmax) start from 0 when using triplet format (direct KKT matrix formation) - c_int *i; ///< row indices, size nzmax starting from 0 - c_float *x; ///< numerical values, size nzmax - c_int nz; ///< number of entries in triplet matrix, -1 for csc -} csc; - -/** - * Linear system solver structure (sublevel objects initialize it differently) - */ - -typedef struct linsys_solver LinSysSolver; - -/** - * OSQP Timer for statistics - */ -typedef struct OSQP_TIMER OSQPTimer; - -/** - * Problem scaling matrices stored as vectors - */ -typedef struct { - c_float c; ///< cost function scaling - c_float *D; ///< primal variable scaling - c_float *E; ///< dual variable scaling - c_float cinv; ///< cost function rescaling - c_float *Dinv; ///< primal variable rescaling - c_float *Einv; ///< dual variable rescaling -} OSQPScaling; - -/** - * Solution structure - */ -typedef struct { - c_float *x; ///< primal solution - c_float *y; ///< Lagrange multiplier associated to \f$l <= Ax <= u\f$ -} OSQPSolution; - - -/** - * Solver return information - */ -typedef struct { - c_int iter; ///< number of iterations taken - char status[32]; ///< status string, e.g. 'solved' - c_int status_val; ///< status as c_int, defined in constants.h - -# ifndef EMBEDDED - c_int status_polish; ///< polish status: successful (1), unperformed (0), (-1) unsuccessful -# endif // ifndef EMBEDDED - - c_float obj_val; ///< primal objective - c_float pri_res; ///< norm of primal residual - c_float dua_res; ///< norm of dual residual - -# ifdef PROFILING - c_float setup_time; ///< time taken for setup phase (seconds) - c_float solve_time; ///< time taken for solve phase (seconds) - c_float update_time; ///< time taken for update phase (seconds) - c_float polish_time; ///< time taken for polish phase (seconds) - c_float run_time; ///< total time (seconds) -# endif // ifdef PROFILING - -# if EMBEDDED != 1 - c_int rho_updates; ///< number of rho updates - c_float rho_estimate; ///< best rho estimate so far from residuals -# endif // if EMBEDDED != 1 -} OSQPInfo; - - -# ifndef EMBEDDED - -/** - * Polish structure - */ -typedef struct { - csc *Ared; ///< active rows of A - ///< Ared = vstack[Alow, Aupp] - c_int n_low; ///< number of lower-active rows - c_int n_upp; ///< number of upper-active rows - c_int *A_to_Alow; ///< Maps indices in A to indices in Alow - c_int *A_to_Aupp; ///< Maps indices in A to indices in Aupp - c_int *Alow_to_A; ///< Maps indices in Alow to indices in A - c_int *Aupp_to_A; ///< Maps indices in Aupp to indices in A - c_float *x; ///< optimal x-solution obtained by polish - c_float *z; ///< optimal z-solution obtained by polish - c_float *y; ///< optimal y-solution obtained by polish - c_float obj_val; ///< objective value at polished solution - c_float pri_res; ///< primal residual at polished solution - c_float dua_res; ///< dual residual at polished solution -} OSQPPolish; -# endif // ifndef EMBEDDED - - -/********************************** -* Main structures and Data Types * -**********************************/ - -/** - * Data structure - */ -typedef struct { - c_int n; ///< number of variables n - c_int m; ///< number of constraints m - csc *P; ///< the upper triangular part of the quadratic cost matrix P in csc format (size n x n). - csc *A; ///< linear constraints matrix A in csc format (size m x n) - c_float *q; ///< dense array for linear part of cost function (size n) - c_float *l; ///< dense array for lower bound (size m) - c_float *u; ///< dense array for upper bound (size m) -} OSQPData; - - -/** - * Settings struct - */ -typedef struct { - c_float rho; ///< ADMM step rho - c_float sigma; ///< ADMM step sigma - c_int scaling; ///< heuristic data scaling iterations; if 0, then disabled. - -# if EMBEDDED != 1 - c_int adaptive_rho; ///< boolean, is rho step size adaptive? - c_int adaptive_rho_interval; ///< number of iterations between rho adaptations; if 0, then it is automatic - c_float adaptive_rho_tolerance; ///< tolerance X for adapting rho. The new rho has to be X times larger or 1/X times smaller than the current one to trigger a new factorization. -# ifdef PROFILING - c_float adaptive_rho_fraction; ///< interval for adapting rho (fraction of the setup time) -# endif // Profiling -# endif // EMBEDDED != 1 - - c_int max_iter; ///< maximum number of iterations - c_float eps_abs; ///< absolute convergence tolerance - c_float eps_rel; ///< relative convergence tolerance - c_float eps_prim_inf; ///< primal infeasibility tolerance - c_float eps_dual_inf; ///< dual infeasibility tolerance - c_float alpha; ///< relaxation parameter - enum linsys_solver_type linsys_solver; ///< linear system solver to use - -# ifndef EMBEDDED - c_float delta; ///< regularization parameter for polishing - c_int polish; ///< boolean, polish ADMM solution - c_int polish_refine_iter; ///< number of iterative refinement steps in polishing - - c_int verbose; ///< boolean, write out progress -# endif // ifndef EMBEDDED - - c_int scaled_termination; ///< boolean, use scaled termination criteria - c_int check_termination; ///< integer, check termination interval; if 0, then termination checking is disabled - c_int warm_start; ///< boolean, warm start - -# ifdef PROFILING - c_float time_limit; ///< maximum number of seconds allowed to solve the problem; if 0, then disabled -# endif // ifdef PROFILING -} OSQPSettings; - - -/** - * OSQP Workspace - */ -typedef struct { - /// Problem data to work on (possibly scaled) - OSQPData *data; - - /// Linear System solver structure - LinSysSolver *linsys_solver; - -# ifndef EMBEDDED - /// Polish structure - OSQPPolish *pol; -# endif // ifndef EMBEDDED - - /** - * @name Vector used to store a vectorized rho parameter - * @{ - */ - c_float *rho_vec; ///< vector of rho values - c_float *rho_inv_vec; ///< vector of inv rho values - - /** @} */ - -# if EMBEDDED != 1 - c_int *constr_type; ///< Type of constraints: loose (-1), equality (1), inequality (0) -# endif // if EMBEDDED != 1 - - /** - * @name Iterates - * @{ - */ - c_float *x; ///< Iterate x - c_float *y; ///< Iterate y - c_float *z; ///< Iterate z - c_float *xz_tilde; ///< Iterate xz_tilde - - c_float *x_prev; ///< Previous x - - /**< NB: Used also as workspace vector for dual residual */ - c_float *z_prev; ///< Previous z - - /**< NB: Used also as workspace vector for primal residual */ - - /** - * @name Primal and dual residuals workspace variables - * - * Needed for residuals computation, tolerances computation, - * approximate tolerances computation and adapting rho - * @{ - */ - c_float *Ax; ///< scaled A * x - c_float *Px; ///< scaled P * x - c_float *Aty; ///< scaled A * x - - /** @} */ - - /** - * @name Primal infeasibility variables - * @{ - */ - c_float *delta_y; ///< difference between consecutive dual iterates - c_float *Atdelta_y; ///< A' * delta_y - - /** @} */ - - /** - * @name Dual infeasibility variables - * @{ - */ - c_float *delta_x; ///< difference between consecutive primal iterates - c_float *Pdelta_x; ///< P * delta_x - c_float *Adelta_x; ///< A * delta_x - - /** @} */ - - /** - * @name Temporary vectors used in scaling - * @{ - */ - - c_float *D_temp; ///< temporary primal variable scaling vectors - c_float *D_temp_A; ///< temporary primal variable scaling vectors storing norms of A columns - c_float *E_temp; ///< temporary constraints scaling vectors storing norms of A' columns - - - /** @} */ - - OSQPSettings *settings; ///< problem settings - OSQPScaling *scaling; ///< scaling vectors - OSQPSolution *solution; ///< problem solution - OSQPInfo *info; ///< solver information - -# ifdef PROFILING - OSQPTimer *timer; ///< timer object - - /// flag indicating whether the solve function has been run before - c_int first_run; - - /// flag indicating whether the update_time should be cleared - c_int clear_update_time; - - /// flag indicating that osqp_update_rho is called from osqp_solve function - c_int rho_update_from_solve; -# endif // ifdef PROFILING - -# ifdef PRINTING - c_int summary_printed; ///< Has last summary been printed? (true/false) -# endif // ifdef PRINTING - -} OSQPWorkspace; - - -/** - * Define linsys_solver prototype structure - * - * NB: The details are defined when the linear solver is initialized depending - * on the choice - */ -struct linsys_solver { - enum linsys_solver_type type; ///< linear system solver type functions - c_int (*solve)(LinSysSolver *self, - c_float *b); ///< solve linear system - -# ifndef EMBEDDED - void (*free)(LinSysSolver *self); ///< free linear system solver (only in desktop version) -# endif // ifndef EMBEDDED - -# if EMBEDDED != 1 - c_int (*update_matrices)(LinSysSolver *s, - const csc *P, ///< update matrices P - const csc *A); // and A in the solver - - c_int (*update_rho_vec)(LinSysSolver *s, - const c_float *rho_vec); ///< Update rho_vec -# endif // if EMBEDDED != 1 - -# ifndef EMBEDDED - c_int nthreads; ///< number of threads active -# endif // ifndef EMBEDDED -}; - - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef OSQP_TYPES_H diff --git a/include/osqp_folder/include/util.h b/include/osqp_folder/include/util.h deleted file mode 100644 index 6b2aac342363007a256d05d916a8b11d6f480056..0000000000000000000000000000000000000000 --- a/include/osqp_folder/include/util.h +++ /dev/null @@ -1,222 +0,0 @@ -#ifndef UTIL_H -# define UTIL_H - -# ifdef __cplusplus -extern "C" { -# endif // ifdef __cplusplus - -# include "types.h" -# include "constants.h" - -/****************** -* Versioning * -******************/ - -/** - * Return OSQP version - * @return OSQP version - */ -const char* osqp_version(void); - - -/********************** -* Utility Functions * -**********************/ - -# ifndef EMBEDDED - -/** - * Copy settings creating a new settings structure (uses MALLOC) - * @param settings Settings to be copied - * @return New settings structure - */ -OSQPSettings* copy_settings(const OSQPSettings *settings); - -# endif // #ifndef EMBEDDED - -/** - * Custom string copy to avoid string.h library - * @param dest destination string - * @param source source string - */ -void c_strcpy(char dest[], - const char source[]); - - -# ifdef PRINTING - -/** - * Print Header before running the algorithm - * @param work osqp workspace - */ -void print_setup_header(const OSQPWorkspace *work); - -/** - * Print header with data to be displayed per iteration - */ -void print_header(void); - -/** - * Print iteration summary - * @param work current workspace - */ -void print_summary(OSQPWorkspace *work); - -/** - * Print information after polish - * @param work current workspace - */ -void print_polish(OSQPWorkspace *work); - -/** - * Print footer when algorithm terminates - * @param info info structure - * @param polish is polish enabled? - */ -void print_footer(OSQPInfo *info, - c_int polish); - - -# endif // ifdef PRINTING - - -/********************************* -* Timer Structs and Functions * * -*********************************/ - -/*! \cond PRIVATE */ - -# ifdef PROFILING - -// Windows -# ifdef IS_WINDOWS - - // Some R packages clash with elements - // of the windows.h header, so use a - // slimmer version for conflict avoidance -# ifdef R_LANG -#define NOGDI -# endif - -# include <windows.h> - -struct OSQP_TIMER { - LARGE_INTEGER tic; - LARGE_INTEGER toc; - LARGE_INTEGER freq; -}; - -// Mac -# elif defined IS_MAC - -# include <mach/mach_time.h> - -/* Use MAC OSX mach_time for timing */ -struct OSQP_TIMER { - uint64_t tic; - uint64_t toc; - mach_timebase_info_data_t tinfo; -}; - -// Linux -# else // ifdef IS_WINDOWS - -/* Use POSIX clock_gettime() for timing on non-Windows machines */ -# include <time.h> -# include <sys/time.h> - - -struct OSQP_TIMER { - struct timespec tic; - struct timespec toc; -}; - -# endif // ifdef IS_WINDOWS - -/*! \endcond */ - -/** - * Timer Methods - */ - -/** - * Start timer - * @param t Timer object - */ -void osqp_tic(OSQPTimer *t); - -/** - * Report time - * @param t Timer object - * @return Reported time - */ -c_float osqp_toc(OSQPTimer *t); - -# endif /* END #ifdef PROFILING */ - - -/* ================================= DEBUG FUNCTIONS ======================= */ - -/*! \cond PRIVATE */ - - -# ifndef EMBEDDED - -/* Compare CSC matrices */ -c_int is_eq_csc(csc *A, - csc *B, - c_float tol); - -/* Convert sparse CSC to dense */ -c_float* csc_to_dns(csc *M); - -# endif // #ifndef EMBEDDED - - -# ifdef PRINTING -# include <stdio.h> - - -/* Print a csc sparse matrix */ -void print_csc_matrix(csc *M, - const char *name); - -/* Dump csc sparse matrix to file */ -void dump_csc_matrix(csc *M, - const char *file_name); - -/* Print a triplet format sparse matrix */ -void print_trip_matrix(csc *M, - const char *name); - -/* Print a dense matrix */ -void print_dns_matrix(c_float *M, - c_int m, - c_int n, - const char *name); - -/* Print vector */ -void print_vec(c_float *v, - c_int n, - const char *name); - -/* Dump vector to file */ -void dump_vec(c_float *v, - c_int len, - const char *file_name); - -// Print int array -void print_vec_int(c_int *x, - c_int n, - const char *name); - -# endif // ifdef PRINTING - -/*! \endcond */ - - -# ifdef __cplusplus -} -# endif // ifdef __cplusplus - -#endif // ifndef UTIL_H diff --git a/include/osqp_folder/lib/libosqp.a b/include/osqp_folder/lib/libosqp.a deleted file mode 100644 index 31059d2c104f7f6e360a8f5fadf149eec6ab2292..0000000000000000000000000000000000000000 Binary files a/include/osqp_folder/lib/libosqp.a and /dev/null differ diff --git a/include/osqp_folder/lib/libosqp.so b/include/osqp_folder/lib/libosqp.so deleted file mode 100755 index 7d0166fbe8f44b4e259c0643acb23a512a876bde..0000000000000000000000000000000000000000 Binary files a/include/osqp_folder/lib/libosqp.so and /dev/null differ diff --git a/include/qrw/MPC.hpp b/include/qrw/MPC.hpp index e2ff4b5afd65fe9e157d47f9cf5233aafafde271..0e7be911aea1ebd2bd2355b55f300ffaeb968fee 100644 --- a/include/qrw/MPC.hpp +++ b/include/qrw/MPC.hpp @@ -9,11 +9,7 @@ #include <vector> #include <Eigen/Core> #include <Eigen/Dense> -#include "osqp_folder/include/osqp.h" -#include "osqp_folder/include/cs.h" -#include "osqp_folder/include/auxil.h" -#include "osqp_folder/include/util.h" -#include "osqp_folder/include/osqp_configure.h" +#include "osqp.h" #include "other/st_to_cc.hpp" typedef Eigen::MatrixXd matXd; diff --git a/include/qrw/QPWBC.hpp b/include/qrw/QPWBC.hpp index 11aadf6bc06943e2b9ce39753a64b0774c043b89..8bbe2feb0ec8656d01241392a7adc3069d06513c 100644 --- a/include/qrw/QPWBC.hpp +++ b/include/qrw/QPWBC.hpp @@ -10,11 +10,7 @@ #include <vector> #include <Eigen/Core> #include <Eigen/Dense> -#include "osqp_folder/include/osqp.h" -#include "osqp_folder/include/cs.h" -#include "osqp_folder/include/auxil.h" -#include "osqp_folder/include/util.h" -#include "osqp_folder/include/osqp_configure.h" +#include "osqp.h" #include "other/st_to_cc.hpp" class QPWBC { diff --git a/src/MPC.cpp b/src/MPC.cpp index c3cbf6d6bd93273dc9c910832b240714bd18554a..b14eaf07d8ea7a87f6cd3400b13cb80122312d47 100644 --- a/src/MPC.cpp +++ b/src/MPC.cpp @@ -525,8 +525,8 @@ int MPC::call_solver(int k) { // settings->rho = 0.1f; // settings->sigma = 1e-6f; // settings->max_iter = 4000; - settings->eps_abs = (float)1e-5; - settings->eps_rel = (float)1e-5; + settings->eps_abs = (c_float)1e-5; + settings->eps_rel = (c_float)1e-5; /*settings->eps_prim_inf = 1e-4f; settings->eps_dual_inf = 1e-4f; settings->alpha = 1.6f; @@ -535,8 +535,8 @@ int MPC::call_solver(int k) { settings->polish_refine_iter = 3;*/ settings->adaptive_rho = (c_int)1; settings->adaptive_rho_interval = (c_int)200; - settings->adaptive_rho_tolerance = (float)5.0; - settings->adaptive_rho_fraction = (float)0.7; + settings->adaptive_rho_tolerance = (c_float)5.0; + // settings->adaptive_rho_fraction = (c_float)0.7; osqp_setup(&workspce, data, settings); /*self.prob.setup(P=self.P, q=self.Q, A=self.ML, l=self.NK_inf, u=self.NK.ravel(), verbose=False) @@ -705,7 +705,7 @@ void MPC::my_print_csc_matrix(csc *M, const char *name) { c_int k = 0; // Print name - c_print("%s :\n", name); + printf("%s :\n", name); for (j = 0; j < M->n; j++) { row_start = M->p[j]; @@ -720,7 +720,7 @@ void MPC::my_print_csc_matrix(csc *M, const char *name) { double c = M->x[k++]; if ((a >= 12 * (n_steps - 1)) && (a < 12 * (n_steps - 1) + 24) && (b >= 12 * (n_steps - 1)) && (b < 12 * (n_steps - 1) * 2)) { - c_print("\t%3u [%3u,%3u] = %.3g\n", k - 1, a, b - 12 * n_steps, c); + printf("\t%3u [%3u,%3u] = %.3g\n", k - 1, a, b - 12 * n_steps, c); } } } diff --git a/src/QPWBC.cpp b/src/QPWBC.cpp index c8818ef53426acb04623abe8b1e502a62e2dbd72..1984221d47203622af0cfd7ad657235f3f839b0e 100644 --- a/src/QPWBC.cpp +++ b/src/QPWBC.cpp @@ -247,7 +247,7 @@ int QPWBC::call_solver() { settings->adaptive_rho = (c_int)1; settings->adaptive_rho_interval = (c_int)200; settings->adaptive_rho_tolerance = (float)5.0; - settings->adaptive_rho_fraction = (float)0.7; + // settings->adaptive_rho_fraction = (float)0.7; settings->verbose = true; osqp_setup(&workspce, data, settings); @@ -401,7 +401,7 @@ void QPWBC::my_print_csc_matrix(csc *M, const char *name) { c_int k = 0; // Print name - c_print("%s :\n", name); + printf("%s :\n", name); for (j = 0; j < M->n; j++) { row_start = M->p[j]; @@ -414,7 +414,7 @@ void QPWBC::my_print_csc_matrix(csc *M, const char *name) { int a = (int)M->i[i]; int b = (int)j; double c = M->x[k++]; - c_print("\t%3u [%3u,%3u] = %.3g\n", k - 1, a, b, c); + printf("\t%3u [%3u,%3u] = %.3g\n", k - 1, a, b, c); } }