C# project calls matlab function which uses CVX

I am using CVX and Gurobi to solve a mixed integer programming problem, and it can be dealt in MATLAB successfully. Now I want to use this function in a C# project (the function is packaged through Library Compiler in MATLAB), but calling this function results in an error: This type of variable does not support indexing with points. This appears when calling ‘cvx_begin’ in the corresponding MATLAB function. How can I solve this?

Everything that involves compiling CVX code and running it from outside Matlab is completely uncharted territory, proven to be almost surely impossible, and you are unfortunately on your own. You can find a few old posts about it on this forum.

An obvious solution would be to use the solver’s API for C# to model the same problem directly in C#.

Thank you very much. I’ve already tried to solve this optimization problem in C#, but it takes too much memory and time, then crashed. I’ll try to fix this.