[AMPL 2872] output mismatch

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

[AMPL 2872] output mismatch

by Timon Stasko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


The output to excel is not the same as that displayed to the screen.

I can type:
display opcost;

and I get a vector of 60 non-zero values.

On the other hand, the following code yields output to excel which is
a vector of 60 zeros. Other variables are outputting to the same excel
file without a problem. I've never seen this before and am totally
stumped.

table opco OUT "ODBC" "long.xlsx":  [T], opcost;
write table opco;


--~--~---------~--~----~------------~-------~--~----~
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 2896] Re: output mismatch

by Robert Fourer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



I would check that the numbers in the spreadsheet are really zeros and are
not just being formatted as zeroes.  Otherwise, since other values are
writing to the spreadsheet correctly, the problem may well have something to
do with the particular way that opcost is defined, or with the particular
values involved, so more information would be needed to diagnose it.

Bob Fourer
4er@...


> -----Original Message-----
> From: ampl@... [mailto:ampl@...]
> On Behalf Of Timon Stasko [timon.stasko@...]
> Sent: Wednesday, October 07, 2009 12:53 PM
> To: AMPL Modeling Language
> Subject: [AMPL 2872] output mismatch
>
>
> The output to excel is not the same as that displayed to the screen.
>
> I can type:
> display opcost;
>
> and I get a vector of 60 non-zero values.
>
> On the other hand, the following code yields output to excel which is
> a vector of 60 zeros. Other variables are outputting to the same excel
> file without a problem. I've never seen this before and am totally
> stumped.
>
> table opco OUT "ODBC" "long.xlsx":  [T], opcost;
> write table opco;
>



--~--~---------~--~----~------------~-------~--~----~
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 2899] Re: output mismatch

by Timon Stasko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thank you. That is a good idea about the formatting, but sadly I don't
think the formatting in Excel was the cause. The good news is that I
found that transfering the values of opcost into a parameter, and then
outputting that parameter to Excel fixed the problem. The only change
I made in Excel was renaming the table (which is something I had tried
doing by itself before). I have no idea why it works this way.

A sample of some of the opcost values follow:

349530.14
349530.14
349530.14
349530.14
370884.983
370884.983
370884.983
370884.983
391151.3489


The original declaration of opcost is:

var opcost {t in T} = sum {i in I, r in R[t]} x[i,t,r]*c[i,t,r];

depending on:
set T; # set of time periods
set R{T}; # set of run plans in each time period
set I; # set of vehicles (existing and potential)
param c{i in I, t in T, r in R[t]};
var x{i in I, t in T, r in R[t]} binary;

The declaration, transfer, and new ouptut lines which work are:

param opcostv{T};
for {t in T} {
 let opcostv[t]:=opcost[t];
}

table opco OUT "ODBC" "long.xlsx":  [T], opcostv;
write table opco;

On Oct 20, 1:53 pm, "Robert Fourer" <4...@...> wrote:

> I would check that the numbers in the spreadsheet are really zeros and are
> not just being formatted as zeroes.  Otherwise, since other values are
> writing to the spreadsheet correctly, the problem may well have something to
> do with the particular way that opcost is defined, or with the particular
> values involved, so more information would be needed to diagnose it.
>
> Bob Fourer
> 4...@...
>
>
>
> > -----Original Message-----
> > From: ampl@... [mailto:ampl@...]
> > On Behalf Of Timon Stasko [timon.sta...@...]
> > Sent: Wednesday, October 07, 2009 12:53 PM
> > To: AMPL Modeling Language
> > Subject: [AMPL 2872] output mismatch
>
> > The output to excel is not the same as that displayed to the screen.
>
> > I can type:
> > display opcost;
>
> > and I get a vector of 60 non-zero values.
>
> > On the other hand, the following code yields output to excel which is
> > a vector of 60 zeros. Other variables are outputting to the same excel
> > file without a problem. I've never seen this before and am totally
> > stumped.
>
> > table opco OUT "ODBC" "long.xlsx":  [T], opcost;
> > write table opco;- Hide quoted text -
>
> - Show quoted text -

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---