芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/resource.optimyar.com/ROL1/Newsvendor_2.gms
Set S /s1*s5/ Positive Variable x m(s) MM(s) ; *x.fx=50; Binary Variable u(s); Parameter d(s) / s1 0 s2 30 s3 50 s4 70 s5 100 / prob(s) ; prob(s)=1/5; Scalar bM ; bM=smax(s,d(s)); Free Variable z; Equations obj cons1 cons2 cons3 cons4 cons5 ; obj(s).. z =l= -7*x + 10*m(s)+2*MM(s); cons1(s).. m(s)=l=x; cons2(s).. m(s)=l=d(s); cons3(s).. MM(s)=g=x-d(s); cons4(s).. MM(s)=l=x-d(s) + (1-u(s))*bM; cons5(s).. MM(s)=l=u(s)*bM; Model Test1 / obj cons1 cons2 cons3 cons4 cons5 / ; Options MIP = CPLEX OPTCR=0 RESLIM=120 ; Solve Test1 US MIP MAX Z Display "input" Prob bM ; Display "Output" x.l u.l m.l MM.l Z.l ; Parameter R(s); R(s) = -7*x.l + 10*m.l(s)+2*MM.l(s); Display R;