Asked by anu vru
on 8 Feb 2018

hello, i am trying to use multi objective genetic algorithm. i have 3 vectors..each of size 11x1

i am getting an output... though the output is 50x2

could someone please explain why it is so...or is there any way to change it. i am new to matlab please help me with this thank you

Answer by Walter Roberson
on 8 Feb 2018

Accepted Answer

gamultiobj returns a sampling of the Pareto fronts.

Your code needs to stop overwriting the parameter x in your fitness function: you are computing the same thing every time.

You are telling the optimizer that you have 2 variables but your computation is for a vector of length 11.

I wonder if what you are trying to optimize is some kind of mixing coefficients, in which case it might make sense to be optimizing on 2 or 3 variables.

Walter Roberson
on 8 Feb 2018

Squaring the result will not force y to be a scalar.

Any time you want to optimize for "value closest to 0", you should think in terms of squaring the value.

Squaring the value is symmetric around 0: a result of -0.1 squared would be the same as 0.1 squared, so squaring does not favor positive over negative.

Squaring the value makes it rapidly more expensive as you get further away from 0, so any kind of search is going to quickly head towards where the 0 exists, instead of wasting time searching values far from zero that happen to be nearly equal in the function.

Your first thought might have been to use abs() instead of squaring. The difficulty with that is that abs() is not differentiable -- but squaring is. That is important for all of the minimizers except ga(), gamultiobj(), and particleswarm (I would need to have a closer look at simulannealbnd and fgoalobtain), and even for ga() and particleswarm() the estimates of where to try next are going to be more accurate if the function is differentiable.

"i am not able to clearly understand your question."

In your current description of your code, you want to emit 11 different results and you want to minimize all of them. Suppose I have inputs A1 and B1 (11 x 1 each) and I call R1 = F(A1,B1) giving an 11 x 1 result. Now suppose that R1(1) is 1/1000 and R1(2) is 1792. Suppose I also have inputs A2 and B2 (11 x 1 each) and I call R2 = F(A2,B2) giving an 11 x 1 result. Now suppose that R2(1) is 400 and R2(2) is 450. So we have outputs [1/1000, 1792] and [400, 450]. Which of those two is "better" ? Is it the first one because the 1/1000 is much lower than the 400, even though the 1792 is much higher than 450? Is the "better" one the one that has the lowest mean, so (1792+1/1000)/2 = 896.05 is worse than (400+450)/2 = 425 ? Is it the one with the lowest sum-of-squares ?

It might be easy to make a decision when all R1 < R2, but that will not typically happen: typically you will get a mix of higher and lower values. How do you choose?

anu vru
on 8 Feb 2018

i understand your point now. for starters,each A1 and B1 and A2 and B2 have individual constraints, hence which ever is much further away from constraints in more suitable. second.. i also have a variable C which is constant. and by my formula..A()+B()-C=0 this is my actual objective though in ideal cases this is not possible hence finding the minimum values of A and B such that A()+B()=C

hence which ever output gives me a values closer to C is chosen to be optimum in my case.

for example, if A lies between (0.5-2.5) and B between(0.5-2) and my C is given as 3. then there can be many answers for A and B... 1 and 2 0.5 and 2.5 2.5 and 0.5

but optimum will be 1.5 and 1.5

Walter Roberson
on 8 Feb 2018

"which ever is much further away from constraints in more suitable."

Each linear constraint defines a plane that divides the 11-dimensional solution space in two. Multiple linear constraints force the acceptable points to be "inside" all of the planes. Asking which point is furthest from the constraints would require finding the distance between the candidate point and all of the planes. That can be done, but it leads back to the question of how you decide which is best since you have multiple distances involved. Do you take the sum of squares of the euclidean distance to the closest point on each of the dividing planes? Even if the closest point on the plane is "outside" of the volume defined by the planes ?

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.