首頁>Club>
2
回覆列表
  • 1 # 使用者2777651610554

    @sum(m:x)是集迴圈函式 是對集m中的所有元素對應的x求和 具體幾個看集的定義例如 可寫程式如下:model:

    sets:

    row/1..4/:b;

    col/1..5/:c1,c2,x;

    link(row,col):a;

    endsets

    data:

    c1=1,1,3,4,2;

    c2=-8,-2,-3,-1,-2;

    a=1 1 1 1 1

    1 2 2 1 6

    2 1 6 0 0

    0 0 1 1 5;

    b=400,800,200,200;

    enddata

    max=@sum(col:c1*x^2+c2*x); %就是方程的第一行,大致相當於求和符號Σ

    @for(row(i):@sum(col(j):a(i,j)*x(j)) %Σa(i,j)*x(j)

    @for(col:@gin(x));

    @for(col:@bnd(0,x,99));

    End

    求得:x1=50,x2=99,x3=0,x4=99,x5=20.最大值為51568。

    這樣應該可以理解

  • 中秋節和大豐收的關聯?
  • 光對人體的危害?