optimization - MATLAB Genetic Algorithm "Subscripted assignment dimension mismatch" Error -
when trying use genetic algorithm solver in matlab, i'm getting following "subscripted assignment dimension mismatch" error: error message pastebin
now, says error has fitness function @ end, when test fitness function separately, works without errors. can link code fitness , constraint functions if help.
thank much!
i think see happening... because 1 of appendages cdraft inside if, don't return same length vector - i.e., return constraint vector first time, preallocates matrix constraint output, next time round give doesn't fit in matrix, error.
the clue in error stack: @ top of stack have
subscripted assignment dimension mismatch.
error in c:\program files\matlab\r2012b\toolbox\globaloptim\globaloptim\private\gaminlppenaltyfcn.p>i_convectorizer (line 135)
clearly not function you've written, , inspecting function there's nothing should cause error. end of error gives clue
caused by: failure in initial user-supplied fitness function evaluation. ga cannot continue.
the ga
function reporting error in bit of code handles user-supplied constraints. whole bit of code (the call user-supplied function , other associated lines) within 1 try...catch
statement returns error. this:
try c = userconfun(x); if isempty(chistory) chistory = zeros(length(c), 1000); % or whatever end chistory(:, currentiterationindex) = c; catch err error('failure in user-supplied fitness function blah blah blah'); end
consequently, looks error came function, though occurred after function returned.
Comments
Post a Comment