Electromagnetic Field Optimization

Example:


from bejoor.physics_based import ElectromagneticFieldOptimization

def sphere_function(sol):
    return sum(x**2 for x in sol)

solution_vector = [{"type": "float", "lower_bound": -5.12, "upper_bound": 5.12}] * 7

efo = ElectromagneticFieldOptimization(objective_function=sphere_function, solution_vector_size=7,
                           solution_vector=solution_vector, optimization_side="min",
                           charge_intensity=1, population_size=30, epochs=50)
efo.run()

print(f'Best Global Objective Value: {efo.global_best_objective_value}')
print(f'Best Global Solution: {efo.global_best_solution}')

Parameters:

  • objective_function: Objective function needs to be optimized.
  • solution_vector_size: Vector size of the candidate solutions.
  • solution_vector: A vector which determines the types of each variable in solution vectors.
  • optimization_side: Determines maximize or minimize the objective function.
  • target_objective_value: Target Objective value.
  • target_objective_lower_bound: Target Objective lower bound.
  • target_objective_upper_bound: Target Objective upper bound.
  • population_size: Number of individuals in the population.
  • epochs: Number of generations to run the algorithm.
  • charge_intensity: Intensity of the electrical charge.

BibTeX citation to the algorithm


@article{abedinpourshotorban2016electromagnetic,
  title={Electromagnetic field optimization: a physics-inspired metaheuristic optimization algorithm},
  author={Abedinpourshotorban, Hosein and Shamsuddin, Siti Mariyam and Beheshti, Zahra and Jawawi, Dayang NA},
  journal={Swarm and Evolutionary Computation},
  volume={26},
  pages={8--22},
  year={2016},
  publisher={Elsevier}
}