Abstract
This paper presents an optimization method for reducing the volume of spiral bevel gears in helical swing cylinders using Python and an adaptive genetic algorithm (AGA). The traditional range and minimum values of modulus and tooth numbers in design specifications are encoded into constraints using programming languages. An adaptive genetic algorithm is applied to randomly generated populations through selection, crossover, and mutation operations to optimize the gear parameters. An elite strategy is employed to select outstanding individuals and generate new populations, which are iterated until the desired number of generations is achieved. The results demonstrate that both traditional and adaptive genetic algorithms can effectively reduce the volume of spiral bevel gear by 5.87%. Notably, the adaptive genetic algorithm exhibits significant advantages in iteration speed, providing multiple solutions that can guide practical designs, reduce computational loads, design time, and production costs.

1. Introduction
Spiral swing cylinders are innovative hydraulic actuators that convert linear piston motion into rotary motion of the output shaft, driving loads. These cylinders are renowned for their compact size, light weight, and high torque capacity, making them suitable for various engineering and port machinery applications. The spiral bevel gear, as the core transmission components, play a crucial role in ensuring efficient and stable power transmission.
In traditional designs, spiral bevel gear often employ conservative dimensions to ensure reliability, leading to unnecessary material consumption and increased costs. To address this issue, this study proposes an optimization approach using an adaptive genetic algorithm (AGA) implemented in Python. This method aims to minimize the gear volume while satisfying design constraints, thereby enhancing design efficiency and reducing production expenses.
2. Technical Specifications and Gear Structure
2.1 Technical Parameters of Spiral Swing Cylinder
The spiral swing cylinder’s technical specifications, such as torque, loads, and angles, govern the design of spiral bevel gear. Table 1 outlines the key parameters used in this study, referencing industrial specifications and research literature.
Table 1: Main Parameters of the Spiral Swing Cylinder
Parameter | Value |
---|---|
Maximum Torque (T) | 190,000 N·mm |
Radial Load | 1,850 kg |
Axial Load | 28 kg |
Maximum Working Pressure (P) | 360 MPa |
Maximum Rotation Angle | 384° |
Displacement (V) | 190,000 mL³ |
2.2 Gear Set Structure
The spiral swing cylinder employs a double-stage spiral gear set comprising inner and outer piston gears engaging with shaft and cylinder gears, respectively. This configuration ensures efficient torque transmission and stable operation.
3. Genetic Algorithm Fundamentals
Genetic algorithms (GAs) are adaptive probabilistic optimization techniques inspired by natural selection and evolutionary biology. They excel in solving complex optimization problems through selection, crossover, and mutation operations.
3.1 Basic Genetic Algorithm Model
The standard genetic algorithm (SGA) model can be mathematically represented as:
SGA=(C,E,P,M,ϕ,Γ,ψ,T)
where:
- C: Encoding method for individuals
- E: Fitness evaluation function
- P: Initial population
- M: Population size
- ϕ: Selection operator
- Γ: Crossover operator
- ψ: Mutation operator
- T: Termination condition
3.2 Adaptive Genetic Algorithm
The adaptive genetic algorithm (AGA) improves upon SGA by dynamically adjusting the crossover and mutation rates based on the fitness of individuals within the population. This enhances the algorithm’s convergence speed and global search capability.
The crossover rate (Pc) and mutation rate (Pm) are calculated as follows:
K_1 + (K_2 – K_1) \frac{f’}{f_{\text{avg}}}, & \text{if } f’ < f_{\text{avg}} \\ K_2, & \text{otherwise} \end{cases} $$
m = \begin{cases}
K_3 + (K_4 – K_3) \frac{f{\text{max}} – f’}{f_{\text{max}} – f_{\text{avg}}}, & \text{if } f’ > f_{\text{avg}} \
K_4, & \text{otherwise}
\end{cases} $$
where:
- f′: Fitness of the selected individual
- favg: Average fitness of the population
- fmax: Maximum fitness in the population
- K1,K2,K3,K4: Constants defining the crossover and mutation rate ranges
Table 2: Main Parameters of Genetic Algorithms
Algorithm Parameter | Condition | Traditional GA | Adaptive GA |
---|---|---|---|
Population Size | – | 500 | 500 |
Iterations | – | 30 | 30 |
Crossover Rate | f′<favg | 0.6 | Dynamic |
f′≥favg | 0.6 | 0.2 | |
Mutation Rate | f′>favg | 0.05 | Dynamic |
f′≤favg | 0.05 | 0.02 |
4. Encoding, Constraints, and Fitness Function
4.1 Encoding
Binary encoding is used for the spiral bevel gear parameters: tooth number (z), modulus (m), and helix angle (β). The encoding lengths are determined by the parameter ranges and precision requirements.
- Tooth number (z): Range [17, 50], 6 bits
- Modulus (m): Range [1.0, 4.0], 6 bits (to one decimal place)
- Helix angle (β): Range [20°, 44°], 7 bits (to integer degrees)
4.2 Constraints
Constraints ensure that designed gears meet mechanical requirements such as torque capacity and material strength. Key constraints include:
- Minimum shaft diameter to withstand torques
- Modulus and tooth number relationships for gear strength
- Helix angle limits
The shaft diameter (d1) constraint is given by:
d1=mz1cosβ≥1.1π[τT]16Tj
where Tj is the equivalent torque considering a safety factor and [τT] is the allowable shear stress.
4.3 Fitness Function
The fitness function is based on minimizing the total volume (V) of the spiral bevel gear:
V=4π(mz1cosβ)2b1+[4π(mz3cosβ)2−4π(mz2cosβ)2]b2+[4πd42−4π(mz3cosβ)2]b3
where b1,b2,b3 are the gear widths, and d4 is the cylinder inner diameter. The fitness function is inversely proportional to the volume:
f(xi)=V1
5. Adaptive Genetic Algorithm Implementation
The adaptive genetic algorithm is implemented in Python, following the steps outlined in Algorithm 1. The pseudocode provides a high-level overview of the optimization process.
Algorithm 1: Adaptive Genetic Algorithm for Spiral Bevel Gear Optimization
python# Pseudocode for adaptive genetic algorithm Input: tooth_range, module_range, beta_range, population_size, generations Output: optimal gear parameters and minimum volume 1. Initialize population P of size population_size 2. for each individual i in P: calculate fitness(teeth_i, module_i, beta_i) 3. for generation g in range(generations): calculate global_average_fitness(P) for each pair (parent1, parent2) in P: child = crossover_operator(parent1, parent2, crossover_rate) mutate_child(child, mutation_rate) calculate fitness(child) if child fits constraints: add child to new_population select_elite_individuals(new_population, P) update global_average_fitness(P) 4. Print optimal individual parameters and minimum volume
6. Results and Analysis
The adaptive genetic algorithm is compared with a traditional genetic algorithm in terms of optimization performance. Both algorithms aim to minimize the spiral bevel gear volume while satisfying design constraints.
Table 3: Initial and Optimized Gear Parameters
Algorithm | Generation | Tooth Number (z1) | Modulus (m) | Helix Angle (β) | Volume (cm³) | Volume Reduction (%) |
---|---|---|---|---|---|---|
Initial Design | – | 30 | 2.0 | 30° | 421,000 | – |
Traditional GA | 17 | 29 | 1.8 | 32° | 396,281 | 5.87 |
Adaptive GA | 7 | 29 | 1.8 | 32° | 396,281 | 5.87 |
7. Conclusion
This study presents an optimization method for reducing the volume of spiral bevel gear in helical swing cylinders using an adaptive genetic algorithm implemented in Python. Both traditional and adaptive genetic algorithms achieved a 5.87% reduction in gear volume. However, the adaptive genetic algorithm demonstrated superior iteration speed, reaching the global optimum in fewer generations. This method provides multiple optimal solutions, facilitating practical design decisions, reducing computational complexity, design time, and production costs. Future work could explore multi-objective optimization considering additional performance criteria such as noise reduction and efficiency improvement.