0

In matalb I am implementing genetic algorithm using ga. In a typical call to ga like x = ga(nvars,@fitnessfunc) when returns gives message on terminal specifying the reason for the termination of the genetic algorithm. A typical message is:

Optimization terminated: average change in the fitness value less than options.TolFun.

I want to turn off this message. I read the documentation but found nothing.

Any ideas?

Ander Biguri
  • 35,140
  • 11
  • 74
  • 120
Nishant
  • 2,571
  • 1
  • 17
  • 29

2 Answers2

1

You could try the answer given in here.

Use the evalc and then you wont display the text plus you can actually read it and use it for your own purposes (like knowing why did it stop etc)

Community
  • 1
  • 1
Ander Biguri
  • 35,140
  • 11
  • 74
  • 120
1

Found the answer here minutes after posting the question. To stop the display we have to set display parameter of options structure to 'off'. The proper code is below:

problem.solver = 'ga';
problem.options = gaoptimset('display','off','param2','value2'...);
problem.fitnessfnc = @fitness;
problem.nvars = nvars;
output = ga(problem);
Nishant
  • 2,571
  • 1
  • 17
  • 29