MATLAB: How to use available Matlab P-file in a script.

genetic algorithmlaplace crossover and power mutationp file

Hi
I write for my self a simple form of NSGA II to solve an optimization problem with integer constraints. I use the ordinary crossover and mutation to generate new solutions then I use the "round" function to convert the new children into integer form before calling them in the cost function of the problem. But unfortunately, I didn't get good results.
then I think I can call ordinary genetic algorithm special mutation and crossover functions specialized for solving integer constraint optimization problems. I mean to use Laplace crossover and power mutation functions. Unfortunately, these functions are Matlab P-files, so they aren't allowed to see the code inside the files.
As my question is there any way that I can call these three P-file functions, namely; "CreationFcn: @gaminlpcreationuniform" and "CrossoverFcn: @gaminlpcrossoverlaplace" and "MutationFcn: @gaminlpmutationpower" inside my NSGA II code. so that I will create new integer candidate solutions for my optimization problem. I would be so grateful if anyone could help me.
Thanks in advance.
Yousef Azimi

Best Answer

As far as MATLAB is concerned, there is no difference in the calling sequence for a .p file and the same function implemented as a .m file. Either way you need to pass in the expected parameters in the expected order.
The expected parameter for those particular kinds of functions are defined in the documentation.
The built-in functions such as gaminlpcrossoverlaplace use exactly the same calling sequence as the custom functions: in both cases all that ga() receives in the option is the function handle, and it does not examine the function handle to figure out if it is somehow "special" that should hypothetically be treated differently.