您的位置:首页 > 服装鞋帽 > 女装 > Sylvain MOS

Sylvain MOS

luyued 发布于 2011-03-21 20:18   浏览 N 次  

parameter nr(r);
loop(r, nr(r) = sum((i,v)$(IN(v,r) or OUT(v,r)), Z.l(i,v)););
display nr;

* to estimate minimal number of slots

u1=milpnlp u2=LeeCrudeOil1.gms u3=7 mip=cplex nlp=snopt
u3=7 number of slots
r1 1.000, r2 1.000, r3 4.000, r4 5.000, r5 5.000, r6 5.000
r7 3.000

u3=5
r1 1.000, r2 1.000, r3 4.000, r4 5.000, r5 5.000, r6 5.000
r7 3.000

u3=6
r1 1.000, r2 1.000, r3 5.000, r4 4.000, r5 5.000, r6 5.000
r7 3.000

u3=8
r1 1.000, r2 1.000, r3 4.000, r4 5.000, r5 5.000, r6 5.000
r7 3.000

u3=9
r1 1.000, r2 1.000, r3 4.000, r4 5.000, r5 5.000, r6 5.000
r7 3.000
----------------------------------------------------------------------------------------------------------------

$ONEMPTY
$ONUELLIST

*** Sets declaration
Sets
i slots / i1*i%gams.user3% /
v operations
p products z
r inventory resources
k properties
vs sets of operations
;
Alias (i,j,i1,i2);
Alias (v,w,v1,v2);
Alias (vs,vs1,vs2,vs3);
Sets
ORD2(i,j) ordered slots (i <= j)
VSET(vs,v) sets of operations membership
CLIQUE(vs) clique sets
CLIQUE2(v,w) clique sets of two operations
SETREQPREC1(vs)
SETREQPREC1ANTECEDENT(vs,v)
SETREQPREC1SUBSEQUENT(vs,v)
IN(v,r) inventory inlet operations
OUT(v,r) inventory outlet operations
;

*** Parameters declaration
Parameters
H
minS(v)
maxS(v)
minD(v)
maxD(v)
minE(v)
maxE(v)
minVT(v)
maxVT(v)
minB(v)
maxB(v)
minCT(r)
maxCT(r)
iniCT(r)
iniCP(r,p)
minFR(v)
maxFR(v)
totD(vs)
minDem(vs)
maxDem(vs)
val(v,p)
prop(p,k)
minProp(v,k)
maxProp(v,k)
maxE(v)
minN(vs)
maxN(vs)
minN1(vs)
maxN1(vs)
;

*** Variables declaration
Variable OBJ;
Binary Variable Z(i,v);
Positive Variables S(i,v), D(i,v), E(i,v);
Positive Variables VT(i,v), VP(i,v,p);
Positive Variables LT(i,r), LP(i,r,p);

*** Constraints declaration
Equations
Objective

MinAssignment
MOSAssignment

MinCard
MaxCard
MinCard1
MaxCard1

SetReqPrec1Time
SSTSetReqPrec1

Time
MinStart
MaxEnd
MinVolumeTotal
MaxVolumeTotal
VolumeCompo
MinLevelTotal
MaxLevelTotal
MinLevelProduct
MaxLevelProduct
LevelCompo

LevelTotalDef
LevelProdDef
CompositionCst

MinFlowrate
MaxFlowrate

TotalDuration

MinDemand
MaxDemand

MinProperty
MaxProperty

MinEndLevelTotal
MaxEndLevelTotal
MinEndLevelProduct
MaxEndLevelProduct

NoOverlapClique

SBClique2
;

*** Constraints construction
Objective..
OBJ =E= Sum((i,v,p),val(v,p) * VP(i,v,p)) ;

MinAssignment(i)..
Sum(v,Z(i,v)) =G= 1 ;
MOSAssignment(i,vs)$CLIQUE(vs)..
Sum(v$VSET(vs,v),Z(i,v)) =L= 1 ;

Mincard(vs)$(minN(vs)>0)..
Sum((i,v)$VSET(vs,v),Z(i,v)) =G= minN(vs) ;
MaxCard(vs)$(maxN(vs)<INF)..
Sum((i,v)$VSET(vs,v),Z(i,v)) =L= maxN(vs) ;
Mincard1(i,vs)$(ord(i)=1 And minN1(vs)>0)..
Sum(v$VSET(vs,v),Z(i,v)) =G= minN1(vs) ;
MaxCard1(i,vs)$(ord(i)=1 And maxN1(vs)<INF)..
Sum(v$VSET(vs,v),Z(i,v)) =L= maxN1(vs) ;

SetReqPrec1Time(vs)$SETREQPREC1(vs)..
Sum((i,v)$SETREQPREC1ANTECEDENT(vs,v), E(i,v))=L= Sum((i,v)$SETREQPREC1SUBSEQUENT(vs,v), S(i,v));
SSTSetReqPrec1(i,vs)$SETREQPREC1(vs)..

图文资讯
广告赞助商