home: GA and ES

Evolution of a Prism Lens

The goal is to optimize the shape of lens in such a way, that parallel rays falling into the lens will focus in one single point. The shape is optimized by modifying the lens segments' thickness.

evolving a PrismLens using genetic algorithms

  • GA - interface help
  • Genetic Algorithms Theory should be an applet here

    Evolution of a Prism Lens - Problem Info

    The goal is to optimize the shape of lens in such a way, that parallel rays falling into the lens will focus in one single point. The shape is optimized by modifying the lens segments' thickness.

    chromosome (genotype representation)

    The lens pieces' height and position are fixed, similar to the ES genotype. The genotype contains n+1 15-Bit pieces for n+1 thickness values, if n is the number of lens pieces.

      // 9 lens pieces: 10 thickness values
      [[011100111000000]
       [010010110100110]
       [100101101000011]
       [110001011000001]
       [100100011111101]
       [111101001010100]
       [011101011100011]
       [010001011111001]
       [010111001100001]
       [010110010111011]]
    
  • drawing the chromsome (phenotype representation)

    At first the lens pieces together with the incoming (parallel) rays are drawn. For each incoming ray a refracted ray is calculated at the left lens border. For this refracted ray the point of intersection with the right lens border is calculated. The ray from the left lens border to the point of intersection at the right lens border is drawn and is used to calculate the outgoing refracted ray at the right lens border. Finally the point of intersection of the outgoing ray with the focus-plane is calculated and the ray from the point of intersection with the right lens border and the point of intersection with focus-plane is drawn.

    quality function

    For each incoming ray 2 refracted rays and 3 points of intersection are calculated:
    1.intersection: incoming ray and left lens-border
    1.refracted ray: incoming ray at 1.intersection
    2.intersection: 1.refracted ray with right lens-border
    2.refratced ray: outgoing ray at 2.intersection
    3.intersection: 2.refracted ray with focus-plane

    For each incoming ray i, let di be the distance of the 3rd intersection-point and the focus within the focus-plane. Then the quality of a prism lens is calculated by summing up the squared distances di^2 for each ray.

    Calculating the quality for the prism lens is somewhat like doing ray tracing. We have to calculate refracted rays and points of intersection.
    Given a line (the lens border) and an incoming ray I we calculate the refracted ray T as follows (Ref.: Glassner, Ray Tracing, p.291ff):

    T = -p*I+(p*c1-c2)*N
    with
    N = normal of lens border
    p = refraction proportion r2/r1 (lens/medium)
    c1 = -I*N = cos(angle between I and N)
    c2 = sqrt(1-p^2(1-c1^2)) = cos(angle between T and -N)


    applet parameters