由于目标函数大而导致GMPL语法错误

时间:2018-10-01 14:49:02

标签: optimization model linear mathprog

我目前正在攻读文学博士学位,因此我一生第一次被迫与GMPL合作。我正面临“文字集中的语法错误”,实际上不知道如何解决此问题。它在目标函数内的第45行中。 非常感谢您的帮助!

我知道还有很多其他错误,但是我计划在我的学术顾问的额外帮助下逐一解决它们。请注意,我完全不熟悉编码,并且在我的教育范围内大多绕过编码课程。

我在数据部分中剪切了部分代码,以使文章简短。

编辑:这可能会有所帮助,它是原始模型: enter image description here

 #Komplettes Erweitertes Modell
 #Fragen
#Set of Sets exisitert in GMPL nicht, wie ma mb und mc lösen?
#Kann eig. nicht richtig sein, dass man die Anzahl der Streifen vor Start des Modells festlegen muss
#Paramter1
param m;
param p;
param q;
param m1;
param m2;
param m3;


#Sets
set I := 1..m;
set J := 1..p;
set K := 1..q;
set ma := 1..m1;
set mb := 1..m2;
set mc := 1..m3;

#Parameter
# Aus Syntaxgruenden wurden L und W in GL und GW umbenannt
param GL;
param GW;
param l{I};
param w{I};
param B{I};
param v{I};
param s;
param z;
param r;
param M;

#Variablen
var x{i in I,j in J,k in K}, binary;
var L{j in J}, integer>=0;
var W{k in K}, integer>=0;
var a{j in J, k in K}, integer>=0;
var b{j in J, k in K}, integer>=0;
var C{j in J,k in K}, binary;
var D{j in J,k in K}, binary;

#Zielfunktion
maximize obj: sum{i in I}(sum{j in J}(sum{k in K}(v[i]*x[i,j,k])+(z*(sum{j in J}((sum{k in K}(D[j,k]+C[j,k])))))));

#Nebenbedingungen
subject to:
con1: sum{j in J}(L[j])<=GL;
con2: sum{k in K}(W[k])<=GW;
con3{j in J, k in K}: sum{i in I} (x[i, j, k]<=1);
con4{j in J, k in K}: sum{i in I}((l[i]*x[i, j, k])<=L[j]); 
con5{j in J, k in K}: L[j]<=sum{i in I}(l[i]*x[i, j, k]+M-todo*(1-sum{i in I}(x[i, j, k])));
con6{j in J, k in K}: sum{i in I}((w[i]*x[i, j, k]))<=W[k]);
con7{j in J, k in K}: W[k]<=sum{i in I}(w[i]*x[i, j, k]+M-todo*(1-sum{i in I}(x[i, j, k])));
con8{i in I}: sum{j in J}(sum{k in K}(x[i, j, k]<=B[i]));
con9{j in J}: L[j]<=L[j+1];
con10{k in K}: W[k]<=W[k+1];
#Ab hier eigene
#Walzrichtung
con11: m1+m2+m3=m;
con12{i in I, j in J, k in K}: x[i+m3, j, k]+x[i, j, k]<=1;
#Reste
con13{j in J, k in K}: L[j, k]-l[i] >= r+s;
con13{j in J, k in K}: W[j, k]-w[i] >= r+s;
con14{j in J, k in K}: (1-C[j, k])*M+a[j, k]-r+s;
con15{j in J, k in K}: (1-D[j, k])*M+b[j, k]-r+s;
con16{j in J, k in K}: -C[j, k]*M+a[j, k]-r+s;
con17{j in J, k in K}: -D[j, k]*M+b[j, k]-r+s;


#Eingabewerte
data;
param GL := 100;
param GW := 100;
param m := 6;
param p := 2;
param q := 2;
param m1 :=2;
param m2 :=2;
param m3 :=2;
#Teil 1
param l{1} := 25;
param w{1} := 25;
param B{1} := 1;
param v{1} := 625;
[...]
#Rest
param s := 5;
param z := 1;
param r := 10;
param M := 9999999999;

0 个答案:

没有答案