Constraints with summation #1428
-
Hi everybody, I have the following constraint in my optimization model: sp(i,c)-s(i,c)+sum(j,sub(j,i,c))= 0 for all i and c sp,s, and sub are decision variables. How can I write this constraint using YALMIP? I examine two following codes to know the answer of this question but I get errors (obj is not important): clc I=40; J=40; C=15; sumsub=sum(sub,1) sizes=size(s) con=[sp-s+sumsubp==0] Error using + (line 35) If I replace the above con with the below (By multiplying -1 ), con=[-sp+s-sumsubp==0] then the error is: Error in lmi/categorizeproblem>multipletermsInEquality (line 509) Error in lmi/categorizeproblem (line 163) Error in compileinterfacedata (line 298) Error in solvesdp (line 301) Error in solvesdp_multiple (line 27) Error in solvesdp (line 22) Error in optimize (line 31) Error in Untitled7 (line 19) What is the best way to consider the mentioned constraint in an optimization modeling? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Dimensions/class don't match. You probably want
or
|
Beta Was this translation helpful? Give feedback.
Dimensions/class don't match. You probably want
sumsubp = squeeze(sumsub(1,:,:))
or
sumsubp = squeeze(sumsub)