This repository implements a genetic algorithm (GA) to optimize trajectory planning using control parameters (gamma and beta). The algorithm evolves these parameters over multiple generations to find an optimal control strategy for a given dynamic system.
- Binary Encoding & Gray Code Conversion: Parameters are encoded in binary and converted to Gray code for efficient crossover.
- Fitness Evaluation via an ODE System: The fitness function is computed by simulating trajectories using Euler's method.
- Genetic Operators: Selection, crossover, and mutation are applied to evolve the control parameters.
- Visualization: Generates trajectory plots and evolution graphs for control parameters.
Run the main script to execute the genetic algorithm:
python source_code.py
This will simulate the evolutionary process and output the optimized trajectory.
You can modify key parameters in the script:
POP_SIZE
: Population sizeMAX_GEN
: Maximum number of generationsMUTATION_RATE
: Mutation probabilityMAX_TIME
: Time constraint for execution
- Trajectory Plots: Shows the evolution of the optimal trajectory.
- Parameter Evolution Graphs: Visualizes how gamma and beta change over generations.
Feel free to submit issues or pull requests to improve this project!
This project is licensed under the MIT License.