Hi all:
just a general question regarding sorting arrays of objects. I'm
sure this is a common problem for Jess users, so I thought I'd ask:
Is there a general design pattern for sorting a list when there are
multiple rules, some potentially quite complex, used to perform the
evaluation?
Let's use a real example:
In a warehouse situation, I have a number of orders that need to be
filled, and I have to make sure that the most critical ones are
filled first, considering that we have inventory constraints and not
all orders can be filled.
So I'm wanting to group orders with the same shipping method (not
ship ground today if I only have < 5 ground orders, for example, but
ship ground regardless if I haven't shipped anything ground in the
last 3 days), evaluate priority orders first ("rush" orders),
possibly look ahead to incoming inventory in the next few days, and
not ship accessories before I ship the main product (don't send the
guy his wireless mouse when he won't get the computer for another
week, for example, but do ship it if I know Computers are due in the
warehouse tomorrow). &c &c...
The best approach I have come up with is to create a "score"
attribute on Order, and each rule can add to or subtract from the
base score value.
Then after evaluating them all so that there are no Orders with equal
scores, sort the array on score outside of Jess, in Java.
Any other thoughts?
-dave-
David Coyle, PhD
[EMAIL PROTECTED]
"Entia non sunt multiplicanda praeter necessitatem"