[rules-users] Modeling Cargo Pickup in Optaplanner

Andrew Varner drew.varner at me.com
Sun Jul 7 16:16:24 EDT 2013


I'm looking to find the best combination of items for predetermined load plans using Optaplanner.  It'd pick the best items out of an inventory (collection of cargo) to fill the load plan.

For example, if a truck shows up at the warehouse, it might carry two sofas and a desk (Example 1). It could also carry five chairs and an end table.

It seems like I could reduce the problem space significantly by breaking the items into classes versus coding the load plans into a hard constraint.

E.g.
//Example 1
class LoadPlan1 {
   Sofa cargo1;
   Sofa cargo2;
   Desk cargo3;
   ...
}

versus a more generic approach...


// Example 2
class Cargo {
    String type; //"sofa", "desk"
    // load is  nullable
    Load load;
   ...
}

Am I on the right path? I think I'd need hard constraints for Example 1 to make sure that cargo1 and cargo2 aren't the same sofa. 

Thanks,
Drew


More information about the rules-users mailing list