Hi,

I’m trying to maximize for a specific column in a matrix. I’ve been

able to do that easily just by defining z and maximizing for it.

However, I want to now, maximize for each column in an iterative

fashion using loop.

I can’t quite figure out how to do this because I can’t modify

equation after first defining as column 1 for example.

How would I go about changing that?

Thanks

AB

–~–~---------~–~----~------------~-------~–~----~

To post to this group, send email to gamsworld@googlegroups.com

To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en

-~----------~----~----~----~------~----~------~–~—

\

AB4166 wrote:

Hi,

I’m trying to maximize for a specific column in a matrix. I’ve been

able to do that easily just by defining z and maximizing for it.

However, I want to now, maximize for each column in an iterative

fashion using loop.

I can’t quite figure out how to do this because I can’t modify

equation after first defining as column 1 for example.

How would I go about changing that?

Thanks

AB

–~–~---------~–~----~------------~-------~–~----~

To post to this group, send email to gamsworld@googlegroups.com

To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en

-~----------~----~----~----~------~----~------~–~—

Assuming you have z as the obj var, you could define z using some data that you change in the loop. For example,

set J ‘all columns’ / j1 * j100 /;

set JJ(J) ‘objective col’;

equation o;

o… z =e= sum{JJ, x(JJ)};

loop {J,

JJ = NO;

JJ(J) = YES;

solve yourModel max z using LP;

};

Something like this will do the job.

–

Steven Dirkse, Ph.D. GAMS Development Corporation

1217 Potomac St. NW Washington DC 20007

Voice: (202)342-0180 Fax: (202)342-0181

mailto:sdirkse@gams.com http://www.gams.com

\