Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Convex crossover in genetic algorithm

  • To: mathgroup at
  • Subject: [mg112666] Re: Convex crossover in genetic algorithm
  • From: Bill Rowe <readnews at>
  • Date: Sat, 25 Sep 2010 02:21:08 -0400 (EDT)

On 9/24/10 at 5:39 AM, lightnation at (lightnation) wrote:

>If you are interested in the genetic algorithm, please help me make
>coding about convex crossover. The coding below is convex crossover
>in RCGA. It's working, but the convergence is not so good. Please
>correct me. (The whole algorithm is posted in this.

Are you aware Mathematica already has this functionality built-in?

That is:

In[1]:= obj = x^2 + 2 y^2 - 0.3 Cos[3 Pi x] - 0.4 Cos[4 Pi y] + 0.7;
constraints = {-1 <= x <= 1, -1 <= y <= 1};

In[4]:= NMaximize[{obj, And @@ constraints}, {x, y},
  Method -> {"DifferentialEvolution", "ScalingFactor" -> .1}]

Out[4]= {3.60426,{x->1.,y->-0.805358}}

Here, I tweaked the ScalingFactor since the default value fails
to find a maximum. But note, allowing NMaximize to automatically
choose the method finds a maximum, i.e.,

In[5]:= NMaximize[{obj, And @@ constraints}, {x, y}]

Out[5]= {3.60426,{x->1.,y->0.805358}}

More information about methods used by NMaximize and NMinimize
can be found in


Included here are details of various options for the methods not
described in the basic documentation for NMaximize, i.e., the
main documentation page in the Documentation Center for NMaximize

  • Prev by Date: Re: Using Mathematica remotely (installed on Mac, to be accessed
  • Next by Date: Re: Creating a Grid with square cells
  • Previous by thread: Convex crossover in genetic algorithm
  • Next by thread: Re: Convex crossover in genetic algorithm