Error while executing 'osqp' class destructor

11 views (last 30 days)
Hello,
While I am running my script this error occurs. The script was running perfectly a few days before.
Warning: The following error was caught while executing 'osqp' class destructor:
Undefined function 'osqp_mex' for input arguments of type 'char'.
Error in osqp/delete (line 40)
osqp_mex('delete', this.objectHandle);
Error in osqp (line 32)
function this = osqp(varargin)
Error in sdpsettings>setup_osqp_options (line 1222)
s = osqp;
Error in sdpsettings (line 244)
options.osqp = setup_osqp_options;
Error in step1_V18_V1 (line 386)
diagnostics=optimize(Constraints,Obj,sdpsettings('savesolveroutput',1,'savesolverinput',1,'solver','gurobi'));
> In osqp (line 32)
In sdpsettings>setup_osqp_options (line 1222)
In sdpsettings (line 244)
In step1_V18_V1 (line 386)
Thank you in advance. Error

Answers (1)

Rajeev
Rajeev on 20 Feb 2023
This error message indicates that MATLAB is unable to find the "osqp_mex" function, which is required by the "osqp" class destructor.
The "osqp_mex" function is a MEX file that is generated from the OSQP solver source code. This error may occur if the MEX file is not properly installed or if the path to the MEX file is not set correctly.
To resolve this error, you can try the following steps:
  • Make sure that the OSQP solver is installed correctly on your system. You can download the latest version of the OSQP solver from the official website (https://osqp.org/).
  • Check that the path to the OSQP solver is added to MATLAB's search path. You can do this by running the following command in MATLAB:
which osqp_mex
If MATLAB cannot find the "osqp_mex" function, it may be because the path to the MEX file is not set correctly.
In this case, you can try adding the path to the OSQP solver to MATLAB's search path by running the command:
addpath('/path/to/osqp-matlab/')
where "/path/to/osqp-matlab/" is the path to the directory containing the OSQP MATLAB interface files.
  • If the above steps do not work, you can try recompiling the "osqp_mex" function from the OSQP solver source code. To do this, you will need to download the OSQP solver source code from the official website and follow the installation instructions. Once the OSQP solver is installed, you can compile the "osqp_mex" function by running the following command in MATLAB:
osqp_matlab_setup()
This should generate the "osqp_mex" function and add it to MATLAB's search path.

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!