gamultiobj n by m fitness function evaluation

1 visualizzazione (ultimi 30 giorni)
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.

Risposta accettata

Walter Roberson
Walter Roberson il 14 Ago 2021
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 Commenti
SM
SM il 16 Ago 2021
Modificato: SM il 16 Ago 2021
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 il 16 Ago 2021
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.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by