« Return to Thread: [AMPL 1841] Defining declarations on subscripted variables

[AMPL 1841] Defining declarations on subscripted variables

by Jacob JKW :: Rate this Message:

Reply to Author | View in Thread


So this this is a simplified version of what I have:

###########START###########
model;
reset;

set OUTCOMES;
set SOME_SET;

data;
set OUTCOMES := foo bar;
set SOME_SET := wilma fred;

model;

var x (SOME_SET}
var y {OUTCOMES};

subj to Some_Constraint_1:
  y["foo"] = 21*x["wilma"] - 11*x["fred"];

subj to Some_Constraint_2:
  y["bar"] = -9*x["wilma"] - 28 *x["fred"];

/* more stuff follows */

###########END###########

Now what I'd like to do is get rid of the two constraints and just add
them to the declaration of y, but I just can't figure out the proper
format for doing so.

Obviously if y weren't subscripted I could just write something like

var y = 21*x["wilma"] - 11*x["fred"]

but because of the subscripts I just don't know how to handle it.

As always, my apologies if I've missed this in either the FAQ or the
AMPL book.


Thanks in advance,
J.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: [AMPL 1841] Defining declarations on subscripted variables

LightInTheBox - Buy quality products at wholesale price!