How can I use Parallel computing to run multi-objective ga ?

조회 수: 6 (최근 30일)
Reem Digna
Reem Digna 2017년 5월 16일
답변: Xiatong Cai 2018년 12월 19일
Hello, I am using multi-objective ga to maximize the return of water allocated for hydropower and irrigation. There are two objective functions and 1932 decision variables.
I tried to use parallel computation by clicking on " Start parallel pool" and adding
options = gaoptimset(options,'UseParallel', true);
to the code after .
I got the following error:
Error using ENileSimulation (line 64)
Size can only have one unknown dimension.
Error in ENileNLGAconstraints (line 10)
[~,~,~, WBC]= ENSimulation(newrIR);
Error in objAndConVectorizer (line 37)
parfor (i = 1:popSize)
Error in gamultiobjMakeState (line 83)
[Score,C,Ceq,isFeas] =
objAndConVectorizer(state.Population(initScoreProvided+1:end,:), ...
Error in gamultiobjsolve (line 8)
state =
gamultiobjMakeState(GenomeLength,FitnessFcn,ConstrFcn,output.problemtype,options);
Error in gamultiobj (line 276)
[x,fval,exitFlag,output,population,scores] = gamultiobjsolve(FitnessFcn,nvars, ...
Error in OptimizationCode (line 73)
gamultiobj(@ENobjfun,nvars,[],[],[],[],lb,ub,@ENNLGAconstraints,options);
Caused by:
Failure in user-supplied fitness function evaluation. Cannot continue.
  댓글 수: 3
Reem Digna
Reem Digna 2017년 5월 17일
편집: Reem Digna 2017년 5월 17일
yes, ENileSimulation is supplied by me. Optimization was running well before trying to use parallel computing but slow(takes 6 weeks). The above error appeared when tried to use parallel computing. The message is about the dimension that should be one. Is it because of multi-objective nature of the system I am using?
Walter Roberson
Walter Roberson 2017년 5월 17일
We have no idea why ENileSimulation is saying that "Size can only have one unknown dimension." because we have no idea what the contents of ENobjfun or deeper routines are.
That error message can occur if you have a reshape() in which you have more than one [] such as
reshape(A, [], 17, [])
However, we have no access to your code to see why it is doing a reshape at all, let alone what parameters it is passing.

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

답변 (1개)

Xiatong Cai
Xiatong Cai 2018년 12월 19일
Hello,
Usually the problem is because in your setting, the vectorization which is selected as true. So you can use command ('UseVectorized', false) in the options to solve this problem.

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by