Hi Filip

thank you very much, I am reading the documentation, thanks for your
time and patience, thanks


Filip Konvicka wrote:
> Hi David,
> 
> you should read the documentation on FD.plus, FD.sum etc. There are some
> type problems in your script. FD.plus expects that each of its 3
> arguments is a FD variable. You are passing two lists (this is what the
> error message is about) and one atom (septima_1) to it. Note that
> variable names start with Uppercase. 'septima_1' is an atom (i.e. a
> non-integer value).
> 
> The easy way to fix this is using what I told you last time: replace
> 
>>       {FD.plus SumaVariables7_1 SumaVariables7_2 septima_1}
>>       septima_1 =<: 1
> 
> with
> 
>   {FD.sum {Append SumaVariables7_1 SumaVariables7_2} '=<:' 1}
> 
> Your script can also be fixed like this:
> 
> for E in 1..1 do
>    SumaVariables7_1=for M in 1..Salas collect:Collect do
>               for  W in 1..5  do
>                   {Collect X.M.W.1}
>                end
>                 end
>    SumaVariables7_2=for M in 1..Salas collect:Collect do
>           for  W in 1..5  do
>              {Collect X.M.W.4}
>           end
>            end
>    Septima_1={FD.decl} %% a variable
> in
>    {FD.sum {Append SumaVariables7_1 SumaVariables7_2} '=:' Septima_1}
>    Septima_1 =<: 1
> end
> 
> Summing SumaVariables7_1 and SumaVariables7_2 is not possible directly,
> because each of these is a list of values, not a value (this is why we
> use FD.sum). Another way of summing these is expressing the sum of
> SumaVariables7_1 and the sum of SumaVariables7_2 (say, X and Y), and
> then summing X and Y using FD.plus:
>   {FD.sum SumaVariables7_1 '=:' X}
>   {FD.sum SumaVariables7_2 '=:' Y}
>   {FD.plus X Y Septima_1}
> 
> See my previous answer for details.
> 
> And maybe the best would be not having lists of values in
> SumaVariables7_1 and SumaVariables7_2, but rather the respective sums
> (as the variable names indicate):
> 
> for E in 1..1 do
>    SumaVariables7_1={FD.sum
>                        for M in 1..Salas collect:Collect do
>               for  W in 1..5  do
>                   {Collect X.M.W.1}
>                end
>                 end
>                      '=:'
>                     }
>    SumaVariables7_2={FD.sum
>                      for M in 1..Salas collect:Collect do
>                  for  W in 1..5  do
>                     {Collect X.M.W.4}
>                  end
>                  end
>                      '=:'
>                     }
> in
>    {FD.plus SumaVariables7_1 SumaVariables7_2} =<: 1
> %% or (equivalently):
>    {FD.sum [SumaVariables7_1 SumaVariables7_2] '=<:' 1}
> end
> 
> Cheers,
> Filip
> 
>> David López wrote:
>>> Filip Konvicka wrote:
>>>> Hi David,
>>>>
>>>> SumaVariables7_1 is a list, not a tuple (lists look like [1 2 3],
>>>> tuples
>>>> look like 1#2#3). You can concatenate two lists using Append - for
>>>> example
>>>>
>>> thanks Filip, buyt i realy do is sum this two list.
>>>
>>> attach pdf with the constraint is enclosed.
>>>
>>> it wanted to be able to add those two lists for all the period that is
>>> reflected in the set of ordered pairs
>>>
>>>
>>> I hope thank you very much that you understand to me,
>>>
>>
>> i try with this script:
>>
>>  %septima restriccion: No deben existir mas de un bloque entre
>> asignaturas w
>>    for E in 1..1 do
>>       SumaVariables7_1=for M in 1..Salas collect:Collect do
>>               for  W in 1..5  do
>>                  {Collect X.M.W.1}
>>               end
>>                end
>>       SumaVariables7_2=for M in 1..Salas collect:Collect do
>>               for  W in 1..5  do
>>                  {Collect X.M.W.4}
>>               end
>>                end
>>    in
>>       {FD.plus SumaVariables7_1 SumaVariables7_2 septima_1}
>>       septima_1 =<: 1
>>    end
>>
>> but raise this message:
>>
>> %*************************** type error *************************
>> %**
>> %** Expected type: finite domain integer in {0,...,134 217 726}
>> %** At argument:   1
>> %** In statement:  {FDP.plus
>> _{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|,,,|,,,
>>
>> _{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|_{0#1}|,,,|,,,
>>
>> septima_1}
>> %**
>> %** Call Stack:
>> %** procedure 'ForProc' in file
>> "/home/deibyd/documentos/tesis/mozart-oz/tutorial/memoria_salas.oz",
>> line 321, column 3, PC = 137180160
>>
>> thanks for the patience and the answer
>>
>>
>>
> 

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to