defining loop using weighted sum-multi objective
defining loop using weighted sum-multi objective
Dear All,
I am trying to use loop for objective function which include two different objective. I am trying to use weighted sum and trying to observed the effect of weighted sum to each objective function.
I could define the parameter and I can run the model without an error, but I observed that for each weighted sum (different value), I keep getting the same objective value.
I am not sure where I am making a mistake but some how it looks like the loop I defined is not taking all the scenarios.
Could you please take a look at the below model and let me know is there any other way to define the loop?
Thank you in advance.
set p(t) /year1*year4/;
set w' lambda'/1*9/;
parameter
lambda(w) 'weight on objective function'
/
1 0.1
2 0.2
3 0.3
4 0.4
5 0.5
6 0.6
7 0.7
8 0.9
9 0.9
/;
objective .. h =e=sum((w,t),CS(t)*lambda(w))+(-sum((i,m,t,w), l(i)*u(i,m)*x(i,t,m)*(1-lambda(w))));
parameter lam(w), resobj(w);
loop(p,
lam(w)=lambda(w);
solve thesisdeterministic using MIP maximizing h;
resobj(w)=h.l;
);
--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Re: defining loop using weighted sum-multi objective
Hi Deniz,
If I get you right, you want to solve your model several times with different values for lambda.
In your current code you loop over p (year1 to year4) and assign the values of lambda(w) to lam(w) which is completely independent from the loop controlling set p. Hence you always get identical results. I also think that you actually want to use a scalar lambda in your objective function instead of the sum over all lambda(w).
What you can do is to define parameter lam as a scalar and adjust the objective function accordingly. Then you loop over w, assign the value of lambda(w) to lam and solve your model.
set p(t) /year1*year4/;
set w 'lambda'/1*9/;
parameter
lambda(w) 'weight on objective function' /
1 0.1
2 0.2
3 0.3
4 0.4
5 0.5
6 0.6
7 0.7
8 0.9
9 0.9
/;
parameter lam, resobj(w);
objective .. h =e=sum(t,CS(t))*lam + (-sum((i,m,t), l(i)*u(i,m)*x(i,t,m)))*(1-lam);
loop(w,
lam = lambda(w);
solve thesisdeterministic using MIP maximizing h;
resobj(w)=h.l;
);
Hope this helps.
Best,
Fred
On Monday, March 7, 2016 at 7:55:02 AM UTC+1, deniz wrote:
Dear All,
I am trying to use loop for objective function which include two different objective. I am trying to use weighted sum and trying to observed the effect of weighted sum to each objective function.
I could define the parameter and I can run the model without an error, but I observed that for each weighted sum (different value), I keep getting the same objective value.
I am not sure where I am making a mistake but some how it looks like the loop I defined is not taking all the scenarios.
Could you please take a look at the below model and let me know is there any other way to define the loop?
Thank you in advance.
set p(t) /year1*year4/;
set w' lambda'/1*9/;
parameter
lambda(w) 'weight on objective function'
/
1 0.1
2 0.2
3 0.3
4 0.4
5 0.5
6 0.6
7 0.7
8 0.9
9 0.9
/;
objective .. h =e=sum((w,t),CS(t)*lambda(w))+(-sum((i,m,t,w), l(i)*u(i,m)*x(i,t,m)*(1-lambda(w))));
parameter lam(w), resobj(w);
loop(p,
lam(w)=lambda(w);
solve thesisdeterministic using MIP maximizing h;
resobj(w)=h.l;
);
--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Re: defining loop using weighted sum-multi objective
Thank you so much!
You are absolutely right! I appreciated your help very much!
Regards.
On Monday, March 7, 2016 at 12:55:02 AM UTC-6, deniz wrote:
Dear All,
I am trying to use loop for objective function which include two different objective. I am trying to use weighted sum and trying to observed the effect of weighted sum to each objective function.
I could define the parameter and I can run the model without an error, but I observed that for each weighted sum (different value), I keep getting the same objective value.
I am not sure where I am making a mistake but some how it looks like the loop I defined is not taking all the scenarios.
Could you please take a look at the below model and let me know is there any other way to define the loop?
Thank you in advance.
set p(t) /year1*year4/;
set w' lambda'/1*9/;
parameter
lambda(w) 'weight on objective function'
/
1 0.1
2 0.2
3 0.3
4 0.4
5 0.5
6 0.6
7 0.7
8 0.9
9 0.9
/;
objective .. h =e=sum((w,t),CS(t)*lambda(w))+(-sum((i,m,t,w), l(i)*u(i,m)*x(i,t,m)*(1-lambda(w))));
parameter lam(w), resobj(w);
loop(p,
lam(w)=lambda(w);
solve thesisdeterministic using MIP maximizing h;
resobj(w)=h.l;
);
--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.