yalmip / YALMIP

MATLAB toolbox for optimization modeling
https://yalmip.github.io/
Other
464 stars 134 forks source link

no response when defining the Objective #1213

Closed Hurricane-k closed 1 year ago

Hurricane-k commented 1 year ago

first, I define two spdvar, the first one is a matrix of size (30,8), and another is a matrix of size (10,1)

co_srd = sdpvar(30,8); # the size of co_spd is (30,8)
co_spd = sdpvar(10,1);

and then I defined the Objective

# sample_values is a known matrix of size (30,1), A is a known matrix of size (8,10), 
# so the temp_obj is a matrix of size (30,1) containing  spdvar 
temp_obj = sample_values-co_srd*A*co_spd;

but when I run the next command, there is no response, just not warning, no error, have no idea how to deal with it

Objective = temp_obj'*temp_obj; 
Hurricane-k commented 1 year ago

I find if decrease the dimension of the spdvar, co_srd decrease to size of (16,8), the Objective can be done. so the higher dimension makes a huge gap?

Hurricane-k commented 1 year ago

i GOT the problem, Matlab console shows

Error using repmat Requested 65920x66186 (32.5GB) array exceeds maximum array size preference.
Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. 
See array size limit or preference panel for more information.
johanlofberg commented 1 year ago

The number of terms there will be in that quartic expression will just be outside the capabilites/scope of YALMIP. Even it did manage to create that objective, what solver did you hope would be capable of solving that.

One way to reduce the complexity of the expression is to add a new variable e, add the nonconvex quadratic constraints e == temp_obj and then use sparse convex quadratic objective e'*e