[AMPL 2089] objective of the master problem consists of objectives of subproblems

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[AMPL 2089] objective of the master problem consists of objectives of subproblems

joachimstadel

Hi there,

I've got a problem of the form:

var A,B
var f,g,h
var x,y

"master problem":
max A + B
s.t. some conditions depending on f,g,h.

"subproblem1":
min A
s.t. some conditions depending on f,g,h and x,A.

"subproblem2":
min B
s.t. some conditions depending on f,g,h and y,B.


I don't know how to implement a master and subproblem routine in AMPL.
Can anyone help?
Thanks a lot!

So far my code looks like this:
_______________________________________________________
param E := 0.0000000001;

param numJobs >= 1;
param numMachines >= 2;
param numSteps >= 1;

param fast >= 1;
param factor >= 1;

set Jobs = 1..numJobs;
set Machines = 1..numMachines;
set Steps = 1..numSteps;

var s {Machines, Steps} >= E;
var p {Jobs} >= E;
var r {Jobs} >= 0;

var x {Jobs, Machines} integer >= 0, <= 1;
var y {Jobs, Machines, Steps} integer >= 0, <= 1;

var Co default 1;
var Cm default 0;



maximize alpha: Cm / Co;

subject to release{i in 1..(numJobs-1)}: r[i] <= r[i+1];

subject to speed1{t in Steps}: s[1,t] == t * fast* factor / numSteps;
subject to speed2{t in Steps}: s[2,t] == fast;
subject to otherspeed{t in Steps, w in Steps, j in 3..numMachines}: s
[j,t]=s[j,w];
subject to maxspeed{j in 3..numMachines, t in Steps}: s[j,t] <= s
[2,t];


minimize opt: Co;

subject to sumo{i in Jobs}: sum{j in Machines} x[i,j] == 1;
subject to scho{j in Machines, k in Jobs, l in Jobs, t in Steps}: r[k]
+ (sum{i in k..l} x[i,j] * p[i]) / s[j,t] <= Co;


minimize mono: Cm;

subject to summ{i in Jobs, t in Steps}: sum{j in Machines} y[i,j,t] ==
1;
subject to schm{j in Machines, k in Jobs, l in Jobs, t in Steps}: r[k]
+ (sum{i in k..l} y[i,j,t] * p[i]) / s[j,t] <= Cm;

subject to monom{t in 1..(numSteps-1)}: sum{i in Jobs} y[i,1,t] * p[i]
<= sum{i in Jobs} y[i,1,t+1] * p[i];

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

[AMPL 2090] Re: objective of the master problem consists of objectives of subproblems

Eli Olinick

There are some examples like this in the looping and testing write up that can
be found on http://www.ampl.com/NEW/loop2.html
On Thu, November 20, 2008 05:22, [hidden email] wrote:

>
> Hi there,
>
> I've got a problem of the form:
>
> var A,B
> var f,g,h
> var x,y
>
> "master problem":
> max A + B
> s.t. some conditions depending on f,g,h.
>
> "subproblem1":
> min A
> s.t. some conditions depending on f,g,h and x,A.
>
> "subproblem2":
> min B
> s.t. some conditions depending on f,g,h and y,B.
>
>
> I don't know how to implement a master and subproblem routine in AMPL.
> Can anyone help?
> Thanks a lot!
>
> So far my code looks like this:
> _______________________________________________________
> param E := 0.0000000001;
>
> param numJobs >= 1;
> param numMachines >= 2;
> param numSteps >= 1;
>
> param fast >= 1;
> param factor >= 1;
>
> set Jobs = 1..numJobs;
> set Machines = 1..numMachines;
> set Steps = 1..numSteps;
>
> var s {Machines, Steps} >= E;
> var p {Jobs} >= E;
> var r {Jobs} >= 0;
>
> var x {Jobs, Machines} integer >= 0, <= 1;
> var y {Jobs, Machines, Steps} integer >= 0, <= 1;
>
> var Co default 1;
> var Cm default 0;
>
>
>
> maximize alpha: Cm / Co;
>
> subject to release{i in 1..(numJobs-1)}: r[i] <= r[i+1];
>
> subject to speed1{t in Steps}: s[1,t] == t * fast* factor / numSteps;
> subject to speed2{t in Steps}: s[2,t] == fast;
> subject to otherspeed{t in Steps, w in Steps, j in 3..numMachines}: s
> [j,t]=s[j,w];
> subject to maxspeed{j in 3..numMachines, t in Steps}: s[j,t] <= s
> [2,t];
>
>
> minimize opt: Co;
>
> subject to sumo{i in Jobs}: sum{j in Machines} x[i,j] == 1;
> subject to scho{j in Machines, k in Jobs, l in Jobs, t in Steps}: r[k]
> + (sum{i in k..l} x[i,j] * p[i]) / s[j,t] <= Co;
>
>
> minimize mono: Cm;
>
> subject to summ{i in Jobs, t in Steps}: sum{j in Machines} y[i,j,t] ==
> 1;
> subject to schm{j in Machines, k in Jobs, l in Jobs, t in Steps}: r[k]
> + (sum{i in k..l} y[i,j,t] * p[i]) / s[j,t] <= Cm;
>
> subject to monom{t in 1..(numSteps-1)}: sum{i in Jobs} y[i,1,t] * p[i]
> <= sum{i in Jobs} y[i,1,t+1] * p[i];
>
> >
>


Eli

------------------------------------------------
Eli V. Olinick
Associate Professor
Department of Engineering Management, Information, and Systems
Bobby B. Lyle School of Engineering
Southern Methodist University
PO Box 750122
Dallas, TX  75275-0123

Vox: (214) 768 3092
Fax: (214) 768 1112

Operations Research: the Science of Better
http://www.scienceofbetter.org



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---