tag:blogger.com,1999:blog-5869426.post5437997858482790452..comments2024-03-25T09:15:58.430+00:00Comments on Drools & jBPM: Planning problems in the cloudMark Proctorhttp://www.blogger.com/profile/03304277188725220501noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-5869426.post-83496980098730366472011-02-26T09:27:04.983+00:002011-02-26T09:27:04.983+00:00Here's the Planner constraint code for cloud b...<a href="https://github.com/droolsjbpm/drools-planner/blob/master/drools-planner-examples/src/main/resources/org/drools/planner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl" rel="nofollow">Here's the Planner constraint code for cloud balance</a> to compare.Geoffrey De Smethttps://www.blogger.com/profile/14668727421421215806noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-48944633697266277442010-11-19T19:36:34.508+00:002010-11-19T19:36:34.508+00:00Such IP maths are pretty hard to read for a plain ...Such IP maths are pretty hard to read for a plain old java object oriented programmer like me... but if I am not mistaken, the IP solver listing doesn't include the "cost" soft constraint.<br /><br />In my experience, IP solvers don't scale up. Have you tried implementing the ITC2007 examination track in cplex or gurobi? I believe several did, but none made the finalists (and not in the other tracks either IIRC).<br /><br />BTW, is it possible to reuse a peice of javacode in such IP solver maths? For example:<br />public boolean isHoliday(Date date, Country country);Geoffrey De Smethttps://www.blogger.com/profile/14668727421421215806noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-63466990957840295232010-11-15T07:53:24.328+00:002010-11-15T07:53:24.328+00:00Whoops, you should drop the 'n' in the ca...Whoops, you should drop the 'n' in the capacity constraints, i.e. :<br /><br />Sum_i C(i)*x_ij <= C(j)*y_j forall j<br />Sum_i R(i)*x_ij <= R(j)*y_j forall j<br />Sum_i N(i)*x_ij <= N(j)*y_j forall jWimnoreply@blogger.comtag:blogger.com,1999:blog-5869426.post-34175832272785305952010-11-15T07:50:09.830+00:002010-11-15T07:50:09.830+00:00And this is the IP formulation for solving this as...And this is the IP formulation for solving this assignment problem. (Note that a column oriented approach might be more interesting/efficient!)<br /><br /><br />let i = 1 .. n be the index for the processes<br />let j = 1 .. m be the index for the machines<br /><br />let C(i) be the required CPU speed for the process and C(j) be the available CPU speed for the machines<br /><br />Similarly, R(i) and R(j) indicate required/available ram, N(i) and N(j) indicate required/available network<br /><br />define the binary decision variables x_ij and y_j. <br /><br />Let x_ij = 1 if process i is assigned to machine j, and x_ij = 0 otherwise<br /><br />Let y_j = 1 if machine j is used, y_j = 0 otherwise<br /><br />Minimize Sum_j y_j<br /><br />Subject to:<br /><br />Sum_j x_ij = 1 forall i (all processes should be assigned exactly once)<br /><br />Sum_i C(i)*x_ij <= n*C(j)*y_j forall j (sum of processes on a machine should not exceed CPU speed)<br /><br />Sum_i R(i)*x_ij <= n*R(j)*y_j forall j<br /><br />Sum_i N(i)*x_ij <= n*N(j)*y_j forall j<br /><br />x_ij = binary forall i,j and y_j binary forall j<br /><br />You could feed this IP program to any IP solver (cplex, gurobi, ...)Wimnoreply@blogger.com