## Weighted sum method with three objectives

Problems with syntax of GAMS
User
Posts: 6
Joined: 2 months ago

### Weighted sum method with three objectives

Hi everyone,
I can run my model with different weight sets for 2 objectives as follows;

set u /1*11/;

loop(u,
w1=1-(ord(u)-1)*0.1;
w2=1-w1;

However, when it comes to 3 objective, I was stuck. Could you help me about this issue? (For intervals of 0.1 similarly above statement)

Renger
Posts: 636
Joined: 4 years ago

### Re: Weighted sum method with three objectives

Hi Kaidr
Why don't you use the random number generator and generate a set of random weights? Something like this:

Code: Select all

``````set u /1*11/;

Option Seed=12

parameter w1(u), w2(u), w3(u), delta(u);

w1(u) = uniformInt(0,10);
w2(u) = uniformInt(0,10);
w3(u) = uniformInt(0,10);
delta(u) = w1(u) + w2(u) + w3(u);
w1(u) = round(w1(u)/delta(u),1);
w2(u) = round(w2(u)/delta(u),1);
w3(u) = 1 - w1(u) - w2(u);

parameter check(u);

check(u) = w1(u) + w2(u) + w3(u);

display w1,w2, w3, check;``````
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

User
Posts: 6
Joined: 2 months ago

### Re: Weighted sum method with three objectives

Dear Renger,
Thank you for your answer. It absolutely works but, it may not generate all possible weight pairs, am I right? Or some weight pairs can repeat? This may cause missing some Pareto optimal solutions. Is there a way of producing all possible weights as increasing way such as:

w1 w2 w3
0.1 0 0.9
0.1 0.1 0.8
0.1 0.2 0.7
...
0.1 0.9 0
...
0.9 0.1 0.

Actually, such an approach will cause so many subproblems and will increase the solution effort and times. I think that I can use the epsilon constraint method but I am not sure how will I apply the epsilon constraint method to three objectives. Could you also help me with this issue?

Renger
Posts: 636
Joined: 4 years ago

### Re: Weighted sum method with three objectives

Hi
According to me, you will have 55 combinations of weights. I used this code (there might be a more subtle way to do this):

Code: Select all

``````set ln1 /1*10/;
set cnt /1*110/  Counter;
parameter w,  w1, w2, w3, delta;

parameter counter;

* Set the first value (as not calculated in the loop)
w("1","1") = 1;
w("1","2") = 0;
w("1","3") = 0;
counter = 0;

loop(ln1,
w1  = 1 - (ord(ln1) -1)*0.1 + EPS;
delta = 1 - w1;
w2 = 0;
w3 = 0;
counter = counter + 1;
while(delta > 0.01,
counter = counter + 1;
w2 = w2 + 0.1;
w(cnt,"1")\$(ord(cnt) = counter) = w1;
w(cnt,"2")\$(ord(cnt) = counter) = w2;
w(cnt,"3")\$(ord(cnt) = counter) = 1 - w1 - w2 + EPS;
delta = 1 - w1 - w2;
);
);
display w;
``````
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist