|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
[AMPL 1874] Modeling Non-Integer Discrete Variables in AMPLHello Everybody, Does anyone know how to model non-integer discrete variables in AMPL? For example, x takes values in the set {0, 0.1, 0.17, 0.29, 0.77, 1.02}. For a well behaved discrete set, e.g. {0, 0.25, 0.50, 0.75, 1}, this is easy by letting y=4x and setting y as an integer variable. For other cases, I don't know if AMPL allows defining discrete variables over a set. I would appreciate if anyone lets me know a work-around. Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 1875] Re: Modeling Non-Integer Discrete Variables in AMPLYou could write var x in {0, 0.1, 0.17, 0.29, 0.77, 1.02}; and let AMPL convert to an integer program. Or you could do the conversion yourself: set Sx; # possible values for x var x; var xv {Sx} binary; # x = i iff xv[i] = 1 subj to AtMostOneValueForX: sum {i in Sx} xv[i] = 1; subj to ConsistentValueForX: x = sum {i in Sx} i * xv[i]; Either way, you would then place x in other objective and/or constraint expressions, and would use a solver that can handle binary (integer) variables. Bob Fourer 4er@... > -----Original Message----- > From: ampl@... [mailto:ampl@...] On Behalf Of > Suleyman Demirel > Sent: Wednesday, July 23, 2008 11:00 AM > To: AMPL Modeling Language > Subject: [AMPL 1874] Modeling Non-Integer Discrete Variables in AMPL > > > Hello Everybody, > > Does anyone know how to model non-integer discrete variables in AMPL? > For example, x takes values in the set {0, 0.1, 0.17, 0.29, 0.77, > 1.02}. > > For a well behaved discrete set, e.g. {0, 0.25, 0.50, 0.75, 1}, this > is easy by letting y=4x and setting y as an integer variable. For > other cases, I don't know if AMPL allows defining discrete variables > over a set. > > I would appreciate if anyone lets me know a work-around. > > Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 1876] Re: Modeling Non-Integer Discrete Variables in AMPLThanks a lot! On Wed, Jul 23, 2008 at 2:02 PM, Robert Fourer <4er@...> wrote:
-- ______________________________________________ Suleyman Demirel - Office: +1 734 615 9503 PhD Candidate in Operations Management Stephen M. Ross School of Business University of Michigan, Ann Arbor Web: http://www.umich.edu/~sdemirel ______________________________________________ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~--- |
| Free Forum Powered by Nabble | Forum Help |