I try to solve the Knapsack-Problem with the Optaplanner by using drools. Did someone this before? This refers to the example by optaplanner.
Thanks for your help
I have implemented these rules as follows:
rule "weigth"
dialect "java"
when
$knapsack : Knapsack($capacity : capacity)
$weightTotal : Number(intValue > $capacity) from accumulate(
Item(
$weight : weight),
sum($weight)
)
then
scoreHolder.addHardConstraintMatch(kcontext, $capacity - $weightTotal.intValue())
end