without knowing how you are accessing the database your two algorithms come down to something like:

Alg. 1
max(select max(p) from y, select max(t) from z)

Alg. 2
select min(p) from y + select min(t) from z

which is basically the same as what Michael has proposed.

Personally I think if you are already using Drools then this would fit, but it wouldn't seem like enough of a reason to introduce Drools on its own.

cheers
Steve



On Wed, Apr 23, 2008 at 2:27 AM, Cheng Wei Lee <zhenwei.li@gmail.com> wrote:
I've 2 algorithms to calculate the cost of a product. At any one time, there is only 1 algorithm in use. Initially algorithm 1 will be the default. Subsequently, the decision to use which algorithm will depend on customers feedback. The algorithms are:

Algorithm 1:
Cost = MAX(P1, T1, P2, T2, P3, T3, ...)

Algorithm 2:
Cost = MIN(P1, P2, P3, ...) + MIN(T1, T2, T3, ...)

The values of P1, P2, ... are stored within a database. The number of Ps & Ts are unknown but can be determined by querying the database, Would drools be a good option to use to store the algorithms? If so, how could I be able to retrieve the values of P1, P2, etc from the database from within drools?

Thanks!


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
steven.williams@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference