Variable is lower (zero) than lower bound in GA

Discussion in 'MATLAB' started by Süle Attila, Apr 12, 2011.

  1. I try to optimize neural network's parameters by genetic algorithm with optimtool.
    bounds are LB =[0, 5, 1] UB = [0.5, 100, 20]
    One of the variables is then hidden layer's neuron number. Sometimes the variables are full zero with no respect to the bounds. When it is occurs the Neural Network cannot works, but I manage this. The problem is after this case (when variables are full zeros) I get the following message:
    Error using ==> makeState at 54
    Your fitness function must return a scalar value

    I think the main problem is the zero variables, how to avoid this?

    Süle Attila
    Süle Attila, Apr 12, 2011
    1. Advertisements

  2. Süle Attila

    Rakesh Kumar Guest

    Based on the error message it seems that your objective function is returning a vector value (instead of a scalar) when evaluated at a single decision variable. Use the debugger in your objective function and make sure that when called with a vector as input, the output is a scalar.

    Rakesh Kumar, Apr 12, 2011
    1. Advertisements

  3. I forget to say it, but I have debuged my function and the return value is a simple scalar 0 (or any other number, what I want to return if the decision variable is null (under the UB).
    The error has trown in the makeState.m in line 54:
    if numel(Score) ~= individualsToEvaluate
    Süle Attila, Apr 12, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.