Dear Mary,

Mary Aranda Cabezas wrote:
Hello
Perhaps it formulates it better is expressed of the following form:
(...)

Pj = (Tj * Nj) / Suma

Suma = it is the sum of the Tj and Nj of all those variables not even
determined

As Suma is the same value for all variables, you don't need to compute it explicitly. Simply evaluate the denominator of Pj:

        Wj = Tj * Nj

and select the variable with the greatest Wj.

You can program this with the generic distribution strategy. It is possible that the distributor needs extra information about the variable. The trick is to give the distributor a list of "things", where each "thing" contains a variable together with its information.

I put an example in attachment, where each variable is associated with a weight. The order gives a preference to the variable with smaller weight, or smaller domain when they have the same weight. If you play with the explorer, you will see that X and Y are always distributed before Z, even if Z has a smaller domain.

In order to adapt the example to your case, you have to change the W's. The value you put there should allow you to compute the Wj I suggested above. Don't forget to switch the order such that the variable with maximal weight is chosen before.

Cheers,
raph
declare
fun {Order X1#W1 X2#W2}
   W1<W2 orelse (W1==W2 andthen {FD.reflect.size X1}<{FD.reflect.size X2})
end
Strategy = generic(order:  Order
                   filter: fun {$ X#_} {Not {IsDet X}} end
                   select: fun {$ X#_} X end
                   value:  min)
proc {Script Sol}
   [X Y Z]={FD.list 3 1#10}
in
   Sol = sol(X Y Z)
   Z <: 3
   X >: Y + Z
   {FD.distribute Strategy [X#2 Y#2 Z#3]}
end
{ExploreOne Script}
_________________________________________________________________________________
mozart-users mailing list                               
mozart-users@ps.uni-sb.de
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to