[AMPL 2867] grouping for SUM

View: New views
2 Messages — Rating Filter:   Alert me  

[AMPL 2867] grouping for SUM

by hessam-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi All,

Assume that "x" is table with 10*10*10 dimension. Is there any
difference between these lines??

1- total = sum{ i in 1..10, j in 1..10, k in 1..10} x[i,j,k]

2- total = sum{ i in 1..10} ( sum{j in 1..10} ( sum{k in 1..10} x
[i,j,k] ))

Thanks,
Hessam

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---


[AMPL 2870] Re: grouping for SUM

by Robert Fourer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



The result is the same either way.

Bob Fourer
4er@...


> -----Original Message-----
> From: ampl@... [mailto:ampl@...]
> On Behalf Of hessam [hessam.1983@...]
> Sent: Monday, October 05, 2009 9:05 PM
> To: AMPL Modeling Language
> Subject: [AMPL 2867] grouping for SUM
>
> Hi All,
>
> Assume that "x" is table with 10*10*10 dimension. Is there any
> difference between these lines??
>
> 1- total = sum{ i in 1..10, j in 1..10, k in 1..10} x[i,j,k]
>
> 2- total = sum{ i in 1..10} ( sum{j in 1..10} ( sum{k in 1..10} x
> [i,j,k] ))
>
> Thanks,
> Hessam
>



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---