с 3D нужно только индексировать:
dvar float+ Gas[1..2][1..2][1..2];
dvar float+ Chloride[1..2][1..2][1..2];
dvar float obj;
maximize
obj;
subject to {
ctObj:obj==sum(i,j,k in 1..2 )(40 * Gas[i,j,k]) + sum(i,j,k in 1..2 ) (50 * Chloride[i,j,k]);
forall(i,j,k in 1..2) ctMaxTotal:
Gas[i,j,k] + Chloride[i,j,k] <= 50;
forall(i,j,k in 1..2 )ctMaxTotal2:
3 * Gas[i,j,k] + 4 * Chloride[i,j,k] <= 180;
forall(i,j,k in 1..2 ) ctMaxChloride:
Chloride[i,j,k] <= 40;
}
execute
{
writeln("Chloride=",Chloride);
writeln("Gas=",Gas);
writeln("dual=",ctMaxTotal[1][2][1].dual);
}