how to define constraint function:

조회 수: 26 (최근 30일)
ISIMG
ISIMG 2012년 5월 12일
Good evening, i want to define the following joined function and call it in the main programme.
i try this :
for k1=1:3;
for k2=1:3;
for e1=1:10;
for e2=1:10;
e1~=e2;
z(k1,e1)=tabaffes(k1,e1)*tabaffes(k2,e2);
z(k1,e1)<=tabaffes(k1,e1);
z(k1,e1)<=tabaffes(k2,e2);
z(k1,e1)>=tabaffes(k1,e1)+tabaffes(k2,e2)-1;
z(k1,e1)>=0;
tabaffee(e1,e2)=sum(z(k1,e1));
F=sum(sum(coutl(k1,e1))*tabaffes(k1,e1))+sum(sum((couth(e1,e2))*(1-tabaffee(e1,e2))));
disp(F);
end
end
end
end
and in the main programme:
F=soleval(SB,it_max);
but that give me always the same result then i would like to have a variety of results , thank you for helping me in this stuff.

답변 (1개)

Walter Roberson
Walter Roberson 2012년 5월 12일
Your test e1~=e2; and your tests of z(k1,e1), only calculate the results of those logical comparisons and then throw the results away (you do not store the results and you do not display them either.)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by