답변 (2개)

Brendan Hamm
Brendan Hamm 2016년 4월 21일

0 개 추천

The function simple_mult contains two objective functions and returns the objective function evaluation of both of these objectives. That is
f(1) = sqrt(1+x.^2);
f(2) = 4 + 2*sqrt(1+(x-1).^2);
Since these functions will have different minimums we want to run the optimization on each of them separately. To do this we call this function inside of pickindex and then return only one of the solutions. So if k = 1, we are returned the sqrt(1+x.^2) evaluated at x and if k = 2, we get 4 + 2*sqrt(1+(x-1).^2) evaluated at x. Since the return depends on k, when we run the minimization fminbnd with a specified value of k we are minimizing the corresponding objective function from simple_mult.

댓글 수: 1

JL555
JL555 2016년 4월 21일
I tried implementing that for different objective functions but the error always pointed out to that 3rd line with "not enough input arguments"

댓글을 달려면 로그인하십시오.

Brendan Hamm
Brendan Hamm 2016년 4월 21일
편집: Brendan Hamm 2016년 4월 21일

0 개 추천

1. Do your objective functions take exactly one input argument? I assume you have more based upon this error. 2. I can't really point out what the issue is with your objective functions without seeing your code. Please place your code in a comment and make sure to format it with the { } Code button (located at the top of the text box where you type your comments).
You can see that the code works with the following example. Try this create a function file called runPareto.m and define the file to look exactly as below:
function goal = runPareto
k = 1;
[min1,minfn1] = fminbnd(@(x)pickindex(x,k),-1,2);
k = 2;
[min2,minfn2] = fminbnd(@(x)pickindex(x,k),-1,2);
goal = [min1,min2];
end
function f = simple_mult(x)
f(:,1) = sqrt(1+x.^2);
f(:,2) = 4 + 2*sqrt(1+(x-1).^2);
end
function z = pickindex(x,k)
z = simple_mult(x); % evaluate both objectives
z = z(k); % return objective k
end
Now at the command line you can run:
goal = runPareto
and this should return to you the vector [0,1] (i.e. the x that minimizes each function).

댓글 수: 12

JL555
JL555 2016년 4월 21일
ok let me try..but publishing that code here is not possible. Can i forward the .m files to you through your mail?
JL555
JL555 2016년 4월 22일
편집: JL555 2016년 4월 22일
goal return the maximum values of the first 2 data of 1st function only i.e. of f(:,1) and my aim is to get the pareto front
Brendan Hamm
Brendan Hamm 2016년 4월 22일
You can attach it with the paperclip icon.
Brendan Hamm
Brendan Hamm 2016년 4월 28일
I'm out on the road training this week, so I will get back to you next week on this.
JL555
JL555 2016년 4월 28일
ok thanks
Brendan Hamm
Brendan Hamm 2016년 5월 3일
It looks like the file was removed. I hadn't downloaded it yet, so if you could post that again I can help.
JL555
JL555 2016년 5월 11일
let me know if u get this ..i will contact u the password
JL555
JL555 2016년 5월 11일
F and emissn are the two objective functions
Brendan Hamm
Brendan Hamm 2016년 5월 12일
I have it. Send me the password at your convenience.
JL555
JL555 2016년 5월 13일
편집: JL555 2016년 5월 13일
i have contacted you the password. Thank you for taking the time looking into this problem. and can u come with the conclusion by this weekend?..thank you
JL555
JL555 2016년 5월 20일
Sir,where are you?
Brendan Hamm
Brendan Hamm 2016년 5월 21일
So, what exactly is the code you sent. There seem to be several files which somebody else wrote and one file which is un-commented. I am not sure how you intended these files to be called or what the relation is to your original problem which you posted. I am not going to pour through hundreds of lines of code searching for a similarity to the pareto front problem you mentioned. Provide some information if you would like me to spend any of my time on this.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

질문:

2016년 4월 21일

댓글:

2016년 5월 21일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by