Re: [AMPL 6303] Three Dimensional Array

196 views
Skip to first unread message

Sachin Argade

unread,
Nov 10, 2012, 11:09:52 AM11/10/12
to am...@googlegroups.com
first question is what is tr ? is it really transpose? 


On Fri, Nov 9, 2012 at 8:16 PM, Rajesh Kumar Narasimhan <rajesh...@gmail.com> wrote:
Hi,

subject to populationdensity {i in 1..m,j in 1..n,t in 1..T}: N[i,j,t] = NB[i,j,t] *(1-(W[i,j]* x[i,j,t])) + ((GR/VR) * SeedBank[i,j,t]);

The population density(N[i,j,t]) changes for each period(t). For 3 period problem below is the result shown. 

I expect the results to be shown as N[*,*,1] , N[*,*,2], N[*,*,3], but the result i got is different. Can you suggest to get the results in the correct format.
How to get the result in non-transpose '(tr)' .

RESULT :

N [1,*,*] (tr)
:       1           2           3        :=
0        2           2           2
1       85.72       85.72       85.72
2     3748.69     3748.69     3748.69
3   167650      167650      163937

 [2,*,*] (tr)
:       1           2           3        :=
0        2           2           2
1       85.72       85.72       85.72
2     3748.69     3748.69     3748.69
3   167053      163937      167650

 [3,*,*] (tr)
:       1           2           3        :=
0        2           2           2
1       85.72       85.72       85.72
2     3748.69     3748.69     3748.69
3   163938      163937      167650
;

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ampl/-/jgDN2OBkkDwJ.
To post to this group, send email to am...@googlegroups.com.
To unsubscribe from this group, send email to ampl+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ampl?hl=en.



--
Sachin Argade

Robert Fourer

unread,
Nov 11, 2012, 10:52:48 AM11/11/12
to am...@googlegroups.com

If you specify "display N" then AMPL will choose which index to "slice" through; in general it will be an index that gives the most compact display, but if there is more than one possibility for giving the most compact display then AMPL will make a choice arbitrarily.  In the tables that result, if there are more columns than rows then AMPL will automatically transpose them, as indicated by "(tr)" at the beginning of each table.

 

To force a slice through the third index, you can write

 

   display {t in 0..T}: {i in 1..m, j in 1..n} N[i,j,t];

 

To discourage transposing, change the option display_transpose from its default of 0 to a sufficiently large negative value; say, "option display_transpose -10;".  For a more detailed explanation see chapter 12 of the AMPL book, www.ampl.com/BOOK/download.html.

 

Bob Fourer

4...@ampl.com

 

 

From: am...@googlegroups.com [mailto:am...@googlegroups.com]

On Behalf Of Rajesh Kumar Narasimhan
Sent: Friday, November 09, 2012 8:16 PM
To: am...@googlegroups.com
Subject: [AMPL 6303] Three Dimensional Array

Reply all
Reply to author
Forward
0 new messages