Name

cma_ask — get candidate solutions from cma optimizer

Calling Sequence

X = cma_ask(es,lambda,mod)
X = cma_ask(es,lambda) // the same with mod=0
X = cma_ask(es) // the same with lambda=es.sp.lambda
X = %cma_ask(es) // the same

Parameters

es

cma object from cma_new

lambda

number of column vectors to be returned

mod

default is 0. With mod set to one, always a list of vector(s) is returned, even for lambda=1.

X

list of column vectors, new candidate solutions. If lambda equals to one and with default mod 0, a single vector (not a list with one vector) is returned.

Description

Examples

  clear param
  param.x0 = ones(8,1);
  param.sigma0 = 0.5; 
  es = cma_new(param);  
  while ~ cma_stop(es)
    X = cma_ask(es);    // return a list with lambda column vectors
    y = [];             // just in case
    for i = 1:length(X) // evaluate all lambda candidate solution
      y(i) = fitfun(X(i)); // must return a scalar
      // re-sampling of infeasible solution if f==%nan (rejection method)
      while isnan(y(i)) 
        X(i) = cma_ask(es, 1); 
        y(i) = fitfun(X(i));
      end
    end 
    // do not use modified X here, unless you very well know what you do
    es = cma_tell(es, X, y');  // finish iteration
  end
  

See Also

cma_new , cma_tell , cma_optim

Authors

Nikolaus Hansen

Bibliography

Used Functions