이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
I am facing difficulty in displaying output of multi objective genetic algorithm.
조회 수: 3 (최근 30일)
이전 댓글 표시
This is my fitness function
function t=strength(x)
t(1) = -138.012+0.173.*x(1)+0.113.*x(2)+0.107.*x(3)+0.715.*x(4)-0.301.*x(5)-0.072.*x(6)+0.036.*x(7)+0.083.*x(8)+15.557.*x(9);
t(2) = 0.350-0.002.*x(1)-0.002.*x(2)+0.0.*x(3)+0.0.*x(4)-0.015.*x(5)+0.004.*x(6)-0.001.*x(7)-0.00000827.*x(8)-0.910.*x(9)+0.058.*x(10)+0.008.*x(11)+0.090.*x(12)-0.458.*x(13);
end
and this is my calling function
clear all
clc
opts.PopulationSize = 1000;
rng default;
options = optimoptions('gamultiobj','MutationFcn',@mutationadaptfeasible, 'CrossoverFcn', {@crossoverarithmetic}, 'SelectionFcn', {@selectiontournament,3}, 'PlotFcn', {@gaplotselection, @gaplotscorediversity, @gaplotbestindiv, @gaplotdistance, @gaplotpareto}, 'MaxGenerations', 1e5);
A = []; b = []; Aeq = []; beq = []; lb = [350 0 0 50 2 180 806 983 0.45 5 27.5 23.96 0]; ub = [350 0 0 50 2 180 806 983 0.45 5 27.5 23.96 0]; nonlcon = [];
obj = @(x) (strength(x));
bestx = gamultiobj(obj, 13, A, b, Aeq, beq, lb, ub, nonlcon, options);
format long g
Is their any way i can minimize the t(2), and simultaneous maximize t(1) and also
I want to show the final output of t(1) and t(2) and respective value of their variables ( x(1),x(2),x(3).....etc).
답변 (2개)
Walter Roberson
2022년 4월 17일
obj = @(x) [-1 1].*strength(x);
댓글 수: 3
harsh Brar
2022년 4월 17일
hey walter! thanks for the answer but can you please explain it and also can you help me displaying the output
Walter Roberson
2022년 4월 17일
Maximizing a function is the same as minimizing the negative of the function.
Walter Roberson
2022년 4월 17일
[bestx, fval] = gamultiobj(obj, 13, A, b, Aeq, beq, lb, ub, nonlcon, options);
fval = [-1 1].*fval;
The t1 values are now fval(:, 1) and the t2 values are fval(:, 2). For any given row fval(K, :) corresponds to bestx(K, :)
Remember that gamultiobj returns a set of Pareto solutions, places where you cannot improve one of the functions without making the other worse. It is not necessarily possible for there to be a global best solution.
Imagine for example if the equations described a circle and you were trying to maximize x while minimizing y: maximum x is the right of the circle but minimum y is the bottom of the circle, and you cannot have both simultaneously.
You can, of course, min() and max() the fval columns and you might happen to get lucky and find a location that has both at the same time. You just cannot count on it.
harsh Brar
2022년 4월 18일
thank you for the information, walter!
but as an output i have been shown this. Is there any way i can get single value of the variable rather than many values of same variable. for instance x(1)=350, x(2)=0...etc.
Optimization terminated: average change in the spread of Pareto solutions less than options.FunctionTolerance.
bestx =
Columns 1 through 5
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
350 0 0 50 2
Columns 6 through 10
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
180 806 983 0.45 5
Columns 11 through 13
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
27.5 23.96 0
fval =
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
62.33165 1.78277059
댓글 수: 1
Walter Roberson
2022년 4월 18일
Is there any way i can get single value of the variable
Maybe, but perhaps not.
gamultiobj() would not normally generate duplicates, which suggests to me that the values you are seeing are possibly non-unique in decimal places not shown. For example there might be differences in the 7th decimal place. gamultiobj() would assume those differences are important, since you did not use options to increase the tolerance.
You could try reducing the list by
[~, ia] = uniquetol(bestx, 'byrows', true);
reduced_bestx = bestx(ia,:);
reduced_fval = fval(ia,:);
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
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)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
