Prev: One-Dimensional Analysis Using the Graphical Interface PROBLEM
Next: Multiple line detection in 2D plane
From: Marat on 6 Mar 2010 23:08 Hello all, I am following the example mentioned in the Multiobjective GA Hybrid Function section of the help docs in order to use my own fitness function with gamultiobj and run fgoalattain and again gamultiobj. But I get the error, "FGOALATTAIN only accepts inputs of data type double" I am not exactly sure if my input data type is double, but I am trying to optimise weights in network topology which are both *double and integer types, similar to the travelling salesman, except that there are multiple weights and 2 more objectives. Below is the sequence of me doing this: % call moga on my objs %.. define more options [x,feval,reason,output] = gamultiobj(FitnessFcn,numberOfVariables,A,b,Aeq,beq,lb,ub,options); % call the hybrid fun options = gaoptimset(options,'HybridFcn',@fgoalattain); % Reset the random states (only to compare with previous run) rand('twister',output.randstate); randn('state',output.randnstate); % error message points to the line below [x,feval,reason,output] = gamultiobj(FitnessFcn,numberOfVariables,A,b,Aeq,beq,lb,ub,options); % call MOGA again on top of hybrid output % execution does not reach to this point!! options = gaoptimset(options,'HybridFcn',[]); % No hybrid function % Provide initial population and scores options = gaoptimset(options,'InitialPopulation',Population,'InitialScore',Score); [x,feval,reason,output] = gamultiobj(FitnessFcn,numberOfVariables,A,b,Aeq,beq,lb,ub,options); Strange thing is if I move: options = gaoptimset(options,'HybridFcn',@fgoalattain); rand('twister',output.randstate); randn('state',output.randnstate); below the gamultiobj call the error does not occur, but this means that I am not reseting the state to what it was when I first run my MOGA and not including @fgoalattain with the options structure, thus the @fgoalattain is running on some other points which defeats the purpose in using @fgoalattain after gamultiobj. I use Matlab 2007b. Nevertheless, when I run the example provided in the doc there is no much difference in the spread measure values--even after running several times. Please help and Thanks for your time! |