Coding for LINGO/LINDO (Integer Linear Programming)

275 views Asked by At

I'm confused how to write the code on LINGO for this model (the model is on pic). I want the "Periode" (period on English) to be consecutive. I tried this code, it's feasible but it's not in consecutive periods. Can someone help me with this problem?

(here's the code that i tried)

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))))));

enter image description here

0

There are 0 answers