Crossover help for Genetic algorithm

  • Thread starter Thread starter Superposed_Cat
  • Start date Start date
  • Tags Tags
    Algorithm
Click For Summary

Discussion Overview

The discussion revolves around the challenges of implementing a genetic algorithm (GA) for a robot that learns to walk, specifically focusing on the crossover mechanism used in the GA. Participants explore different approaches to crossover and mutation to improve the algorithm's performance in the context of realistic physics.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes their GA approach, which involves modifying motor angles based on a specific notation, and expresses concern about the limitations of standard crossover methods leading to large changes in chromosomes.
  • Another participant critiques the parameterization of the problem, suggesting that it leads to slow convergence of the GA due to various factors, including the difficulty of writing crossover functions and the combinatorial nature of the optimization.
  • A proposed alternative involves representing each motor's values as vectors in a matrix, allowing for easier mutation and crossover by selecting parts of the matrix.
  • One participant introduces the idea of identifying patterns in the top-performing individuals of a small population to enhance the GA's efficiency.
  • There is a discussion about the importance of motor activation order, with one participant arguing that motors should be activated simultaneously to simplify the optimization process.
  • Another participant questions the necessity of motor order, leading to clarification about how the matrix representation avoids complications associated with order-dependent combinations.
  • A suggestion is made to experiment with both the original and alternative approaches to determine their effectiveness.

Areas of Agreement / Disagreement

Participants express differing views on the best approach to crossover and mutation in the GA, with no consensus reached on a single method. There is ongoing debate about the implications of motor activation order and the effectiveness of various parameterization strategies.

Contextual Notes

Limitations include the potential for slow convergence due to the chosen parameterization, the complexity of crossover functions, and the combinatorial nature of the optimization problem. The discussion highlights unresolved mathematical steps and dependencies on specific definitions.

Superposed_Cat
Messages
388
Reaction score
5
Hey all, we're making a robot that teaches itself to walk using a genetic algorithm(took a hiatus with this but have returned).
So i coded a simulator that to see why the GA wasn't working well with realistic physics.
The GA works like this "A++,B---,D+" would mean motor A's angle increase by 2*num, and B's angle decrease by 3*num value, angle D's, will be increased by 1*num. But now we can't use standard crossover otherwise they will be a HUGE change between the new and old chromosomes, So our current idea is to cross just the +'s and -'s ie
A++,B---
A--,B++
Would cross to
A+-,B-+
But then motor changes have to be in a specific order, so unless they're in the optimum configuration which is cheating) it can never get to an optimum, Any advice? this is like the traveling salesman Genetic algorithm, which needed its own unique crossover and mutation. Any help appreciated.
 
Technology news on Phys.org
The paramétrization of your problem is bad, you can change it now ! By using the one you explain, the convergence of the genetic algorithm will be extremely long for multiple reason :
- random mutation change sequence leight.
- random mutation have a great probability to make a very bad individu.
- cross over is hard to write
- A small change on the entry give a very high change of the cost function.
- Angle are discrete so optimisation is combinatorial AND localy discrete (Haaaard to optimise !)

The simpler and perfect way :

for each motor (joint) create a vector, each element at index i of the vector is the value of the motor at time i. Optimise this set of vector as the term of a matrice.
T1 T2 T3 T4
Motor 1 : 0.22 0.44 1.02 0.002
Motor 2 : 0.04 0.00 2.0 8.59
Motor 3 : 3.25 4.5 4.8 20.1

with this solution mutating a solution is just adding random value to an élément. Crossing over is selecting a part of the matrix and remplace from another : Easy !
 
  • Like
Likes   Reactions: hamid91dehnavi
Thanks kroni! Was hoping you'd reply. We had this other idea to help it get to the solution faster,
assume we have population of 5 (i know its small its hypothetical). then we take top percentile, so 2
now we look for "patterns" in them, to try find what makes them good.
ie in strings
abcdabcdabcd
abbabdbabda
the pattern would be:
ab,ab,da,bd

Second question, that matrix form means that the order which the motors are activated would be the same every time, can you think of a way that we could avoid that and still get to a solution?
 
No no no ! Why there is an order to activate motors ?
In my solution, motor are all activated at the SAME TIME for each collumn of the matrix.
do you understand it ?
 
Oh, I see now, initially i thought t represented the generation at time t, but why would that make a difference?
 
Because in your solution motor order is important so this add a lot of combinaison for équivalent solution, this is more complex for the Genetic Algorithm to converge. In the matrix representation of the parameter to optimize, you don't have this order, you have only continuous value in each case, so a small variation of the parameter make a small variation of the score. In you parameterization, small variation of the parametre (A to D, or permutation) imply a great variation of the score. Genetic algorithm will have great difficulty to converge.
 
I think you need to try the both.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K