\$Title Solving Three-dimensional Noughts and Crosses using Cplex distributed MIP (RS02,SEQ=676) \$Ontext We solve the cube model using the Cplex distributed MIP algorithm The information about the server addresses, ports and password come through the environment variable CPXDM. \$Offtext \$echo computeserver %sysenv.CPXDM% > cplexd.opt Sets s domain for line identification / a, b, c, incr, decr / x(s) coordinate labels / a, b, c / d(s) directions / incr, decr / b bounds / low, high / Alias (x,y,z), (d,dp), (s,sp,spp) Set ld(s,sp,spp) line definition ; ld("incr",y,z) = yes; ld(x,"incr",z) = yes; ld(x,y,"incr") = yes; ld("incr",d,z) = yes; ld(x,"incr",d) = yes; ld(d,y,"incr") = yes; ld("incr",d,dp) = yes; display ld; Parameters ls(b) sign for line definitions / low +1, high -1 / lr(b) rhs for line definitions / low 2, high -1 / df(x,s) line definition function; df(x,y) = ord(y) - ord(x); df(x,"decr") = 1 + card(x) - 2*ord(x); display df; Variables core(x,y,z) placement of balls (white 0 black 1) line(s,sp,spp) line identification num number of lines of equal color Binary Variables core; Positive Variable line; Equations nbb total number of balls definition ldef(s,sp,spp,b) line definitions ndef number of lines definition ; nbb.. sum((x,y,z), core(x,y,z)) =e= floor(card(x)**3/2); ldef(s,sp,spp,b)\$ld(s,sp,spp).. ls(b)*sum(x, core(x+df(x,s),x+df(x,sp),x+df(x,spp))) =l= line(s,sp,spp) + lr(b) ; ndef.. num =e= sum((s,sp,spp)\$ld(s,sp,spp), line(s,sp,spp)) ; Model cube / all /; cube.optfile=1; \$ifthen %system.buildcode% == SOX * On Sparc Solaris the system can't find some shared objects required for the Cplex remote object. * Hence, we need to set things explictely and make sure the LD_LIBRARY_PATH environment is not * forgotten when we call the solver. \$setenv LD_LIBRARY_PATH %gams.sysdir%:%sysenv.LD_LIBRARY_PATH% cube.solvelink = %solvelink.CallScript%; \$endif option mip=cplexd, optcr=0; Solve cube minimizing num using mip; abort\$(cube.modelstat<>1 or cube.solvestat<>1) 'Bad model/solvestatus', cube.modelstat, cube.solvestat; abort\$(abs(num.l-4)>1e-4) 'Bad num.l', num.l;