2

我很困惑如何在 LINGO 上为这个模型编写代码(模型在图片上)。我希望“时期”(英语时期)是连续的。我试过这个代码,它是可行的,但它不是连续的。有人可以帮我解决这个问题吗?

(这是我尝试过的代码)

SETS:

HARI/I1..I3/;

PERIODE/J1..J4/;

PERIOD/P1..P3/;

SKS/T1..T2/;

KM/K1..K4/:A;

DOSEN/L1..L4/:G;

MK/M1..M8/:H, B;

RUANGAN/N1..N3/;

JADWAL(HARI, PERIODE, KM, DOSEN, MK, RUANGAN):X;

PREFERENSI(HARI, PERIODE, DOSEN):Y;

ULANG(HARI, PERIODE, KM):Z;

CONSECUTIVE(HARI, PERIOD, KM, SKS, MK, RUANGAN):W;

ENDSETS

DATA:

H = 2 2 2 2 2 2 2 2;

B = 1 1 1 1 1 1 1 1;

G = 4 4 4 4;

A = 4 4 4 4;

ENDDATA


@FOR(HARI(I): @FOR(KM(K): @FOR(DOSEN(L): @FOR(MK(M): @FOR(RUANGAN(N): @FOR(SKS(T)|T#EQ#2: X(I,1,K,L,M,N) - X(I,T,K,L,M,N)<=0))))));

@FOR(HARI(I): @FOR(KM(K): @FOR(DOSEN(L): @FOR(MK(M): @FOR(RUANGAN(N): @FOR(PERIOD(P)|P#EQ#1#AND#P#EQ#2#AND#P#EQ#3: @FOR(SKS(T)|T#EQ#2:T+P<=4)))))));

@FOR(HARI(I): @FOR(KM(K): @FOR(DOSEN(L): @FOR(MK(M): @FOR(RUANGAN(N): @FOR(PERIOD(P)|P#EQ#1#AND#P#EQ#2#AND#P#EQ#3: @FOR(SKS(T)|T#EQ#2:-X(I,J,K,L,M,N)+X(I,P+1,K,L,M,N)-X(I,P+T,K,L,M,N)<=0)))))));

@FOR(HARI(I): @FOR(KM(K): @FOR(DOSEN(L): @FOR(MK(M): @FOR(RUANGAN(N): @FOR(SKS(T)|T#EQ#2: X(I,4,K,L,M,N) - X(I,4-T,K,L,M,N)<=0))))));

在此处输入图像描述

4

0 回答 0