Dear all,
I have an multi-objective function and I used PSO to solve it.
I used the following command in my optimization function program to save the variables.
save resg.mat F1 F2 F3
But it is not saved and throwing the error message as follows.
Error using save
Unable to write file resg.mat: permission denied.
Error in facility (line 116)
save resg.mat F1 F2 F3
Error in fcnvectorizer (line 19)
y(i,:) = feval(fun,(pop(i,:)));
Error in particleswarm>pswcore (line 297)
state.Fvals = fcnvectorizer(state.Positions, objFcn, 1, options.SerialUserFcn);
Error in particleswarm (line 151)
[x,fval,exitFlag,output] = pswcore(objFcn,nvars,lbRow,ubRow,output,options);
Error in testFn (line 14)
[node,fval,exitflag,output]=particleswarm(@facility,nvars,lb,ub,options);
Caused by:
Failure in user-supplied fitness function evaluation. GA cannot continue.
Please help me out in this.
Thanks in advance.

 채택된 답변

Mike Croucher
Mike Croucher 2022년 1월 5일

0 개 추천

This looks like an operating system error. In particular, you are trying to write to a folder where you don't have write permissions.
What's the output of the command pwd just before you try to save? Ensure you change directory to somewhere you have permissions to save and you should be fine.
With that said...it looks like you are adding this save command to the objective function you want solving by the particleswarm function. If so, this might not be a good idea as it will be called hundreds, maybe thousands of times. Your save command will then be called many times, always overwriting the files it saved last time. This will be a huge waste of time and will slow down your program a lot!

댓글 수: 3

Muthukannan
Muthukannan 2022년 1월 5일
Thank you Mr. Mike.
I have a multi-objective function like as follows.
f=a1*F1+a2*F2+a3*F3;
where a1, a2, a3 are some constants and F1, F2, F3 are individual objective function.
while solving this function using pso, i can get only fval and solution vectors. I cannot get these individual function values i.e F1, F2, F3.
Is there any other way to get these objective values?
Thank you in advance.
Walter Roberson
Walter Roberson 2022년 1월 5일
In your plot function, call the functions individually on the vector you were passed. It might help to memoize() the functions if they are expensive.
Muthukannan
Muthukannan 2022년 1월 6일
Thank you...

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

추가 답변 (0개)

카테고리

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

제품

릴리스

R2021b

질문:

2022년 1월 5일

댓글:

2022년 1월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by