why do i get 50 outputs for multi objective genetic algorithm?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
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
채택된 답변
Walter Roberson
2018년 2월 8일
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.
댓글 수: 11
I have two variables which need to get optimized....each of these variables are of size 11x1...
How do I get 11x 2 outputs
You cannot get an 11 x 2 output. You need to use 22 variables and reshape the 1x22 output to 11x2
You need to re-read https://www.mathworks.com/matlabcentral/answers/380826-your-fitness-function-must-return-a-scalar-value#comment_532223
Your model has 22 parameters (you indicate now.) Do all of the parameters together combine to create a single "goodness" value? If you were given a pair of 11 variables (22 in all), and you were given a different pair of 11 variables, then how would you evaluate whether the first pair was "better" than the second pair?
I have 11 pairs of variables...(22 overall) I need each pair to be minimised.. And I need to see the output of the same.... How do I proceed?
If you were given a pair of 11 variables (22 values in all), and you were given a different pair of 11 variables (22 values), then how would you evaluate whether the first pair was "better" than the second pair?
Whichever is minimised.. is better If you see my fitness code...I have y=X+w-l
Where only X and w need to get minimised...l is constant... And it should be in the constraints also... That's my objective....I am giving X and w variables.....and l variables... It needs to find the optimum values for X and w...such that X+w-l is close to zero.... I need the need X and w values..for further analysis
"It needs to find the optimum values for X and w...such that X+w-l is close to zero"
That is information that was missing. You should square the result of X+w-I and emit that as the cost.
But suppose that the inputs that give a low value for the first component of X+w-I end up giving a high value for the second component of X+w-I. How do you compare that situation to one in which the first two components were (for example) both average in value?
how will squaring the result help?? it will give me the output as scalar... is that the idea you are imposing???
"But suppose that the inputs that give a low value for the first component of X+w-I end up giving a high value for the second component of X+w-I. How do you compare that situation to one in which the first two components were (for example) both average in value?"
i am not able to clearly understand your question.
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?
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
"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 ?
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
