[rules-users] Modeling Cargo Pickup in Optaplanner

Geoffrey De Smet ge0ffrey.spam at gmail.com
Mon Jul 8 04:17:52 EDT 2013


I might not fully understand your domain, by how about something like this?

abstract class Cargo {}
class Sofa extends Cargo {}
class Desk extends Cargo {}

class Truck {}

class CargoAssignment {
    Cargo cargo;

    Truck truck; // @PlanningVariable on it's getter
}

class CargoSolution implements Solution {...}

On 07-07-13 22:16, Andrew Varner wrote:
> 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
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list