Crossover help for Genetic algorithm

  • Thread starter Thread starter Superposed_Cat
  • Start date Start date
  • Tags Tags
    Algorithm
AI Thread Summary
The discussion centers on developing a robot that learns to walk using a genetic algorithm (GA). The original GA approach faced challenges due to unrealistic physics in simulations, prompting a reevaluation of the crossover method. The proposed crossover strategy involves selectively combining positive and negative motor adjustments to avoid drastic changes between generations. However, concerns arise about the order of motor changes, which could hinder optimization.A key suggestion is to restructure the problem by representing each motor's angles as vectors in a matrix, allowing for easier mutation and crossover. This method enables simultaneous activation of motors, simplifying the optimization process and reducing the complexity of convergence. The discussion also explores identifying patterns in successful motor configurations to enhance learning efficiency. Overall, the conversation emphasizes the need for a more effective parameterization to improve the GA's performance in evolving the robot's walking capabilities.
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 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

Back
Top