help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Help-glpk] Wish list - an extended "if then else" statement


From: Meketon, Marc
Subject: RE: [Help-glpk] Wish list - an extended "if then else" statement
Date: Fri, 14 Jan 2011 06:07:53 -0600

Nice.  Thanks.

-----Original Message-----
From: Andrew Makhorin [mailto:address@hidden
Sent: Friday, January 14, 2011 7:07 AM
To: Meketon, Marc
Cc: glpk xypron; address@hidden
Subject: RE: [Help-glpk] Wish list - an extended "if then else" statement

On Sat, 2011-01-01 at 10:55 -0600, Meketon, Marc wrote:
> Cool!  Thank you!  A bit of a kludge, but a lot better than my kludge.
>
>
> -----Original Message-----
> From: glpk xypron [mailto:address@hidden
> Sent: Saturday, January 01, 2011 7:50 AM
> To: Meketon, Marc; address@hidden
> Subject: Re: [Help-glpk] Wish list - an extended "if then else"
> statement
>
> Hello Marc,
>
> > for{(time,ad) in EVENTS} {
> >   if ad='A' then printf "dual=%3g  %5d\n", ARRIVALS[time].dual, time
> >
> >   else printf "          %5d dual=%3g\n", time, DEPARTURES[time].dual;
> > }
> >
> > but that doesn't work.
>
> This is the closest you can get with the existing syntax:
>
> for{(time, ad) in EVENTS} {
>   printf{ i in {1} : ad == "A" }
>     "dual=%3g  %5d\n", ARRIVALS[time].dual, time;
>   printf{ i in {1} : ad != "A" }
>     "%5d dual=%3g\n", time, DEPARTURES[time].dual; }
>
> Best regards
>
> Xypron

Another, more general way to simulate the if-then-else statement

   if c then S1 else S2

is the following:

   for {0..0: c}
   {
      S1;
   }
   for {0..0: not c}
   {
      S2;
   }

----------------------------------------------------------------------------
This e-mail and any attachments may be confidential or legally privileged.  If 
you received this message in error or are not the intended recipient, you 
should destroy the e-mail message and any attachments or copies, and you are 
prohibited from retaining, distributing, disclosing or using any information 
contained herein.  Please inform us of the erroneous delivery by return e-mail.

Thank you for your cooperation.
----------------------------------------------------------------------------


This e-mail and any attachments may be confidential or legally privileged. If 
you received this message in error or are not the intended recipient, you 
should destroy the e-mail message and any attachments or copies, and you are 
prohibited from retaining, distributing, disclosing or using any information 
contained herein.  Please inform us of the erroneous delivery by return e-mail. 
Thank you for your cooperation.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]