gamultiobj n by m fitness function evaluation

조회 수: 2 (최근 30일)
SM
SM 2021년 8월 14일
댓글: Walter Roberson 2021년 8월 16일
Hello
I am trying to optimise 120 parameters using gamultiobj function.
My fitness function output is a matrix with 300 by 88 points, but it seems that the gamultiobj function accepts a single vector as the output of the fitness function since, when I track the error, it tries to assign a matrix of 1 by 26400 to 300 by 88 which through error. 1 by 26400 is calculated inside the gamultiobj function using numel(scorese), which is 300x88=26400.
To clarify: I face the error saying that it is impossible to assign 300 by 88 to 1-26400.
Can anyone help me with how to resolve this?
Thank you in advance
Here is the error:
Unable to perform assignment because the size of the left side is 1-by-26400 and the size of
the right side is 300-by-88.
Error in objAndConVectorizer (line 33)
Fvals(i,:) = feval(objFcn,(pop(i,:)));
Error in gamultiobjMakeState (line 85)
[Score,C,Ceq,isFeas] =
objAndConVectorizer(state.Population(initScoreProvided+1:end,:), ...
Error in gamultiobjsolve (line 20)
state = gamultiobjMakeState(GenomeLength,FitnessFcn,ConstrFcn,output.problemtype,options);
Error in gamultiobj (line 304)
[x,fval,exitFlag,output,population,scores] = gamultiobjsolve(FitnessFcn,nvars, ...
Error in OptimiseParameters_GenAL (line 186)
gamultiobj(f,...
Error in CameraCalibration (line 100)
OptimiseParameters_GenAL(imagePath, nImages, nCameras, boardWidth, boardHeight,
squareSize, calibrationID, thresh, maxIter)
Caused by:
Failure in user-supplied fitness function evaluation. Cannot continue.

채택된 답변

Walter Roberson
Walter Roberson 2021년 8월 14일
reshape() the array into a vector as the last operation.
There is no point in trying to fight gamultiobj() to get it to accept an objective function returning an array: it is not designed for that.
  댓글 수: 2
SM
SM 2021년 8월 16일
편집: SM 2021년 8월 16일
Thanks for your resposen.
I am wondering if this techniques introduce any error to the system?
since currently every point in a column (out of 88) is depedent, by reshaping the matrix, I reckong that I am removing this dependency.
I am wondering if it may result in inaccuracy?
Walter Roberson
Walter Roberson 2021년 8월 16일
No, ga() techniques do not use gradient or hessians, just one position component and one velocity component for every entry. You could use any (consistent) scrambling of the output and ga() and gamultiobj() would not notice or care.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by