giacomelli / GeneticSharp

GeneticSharp is a fast, extensible, multi-platform and multithreading C# Genetic Algorithm library that simplifies the development of applications using Genetic Algorithms (GAs).
MIT License
1.26k stars 330 forks source link

Need implementation help #111

Open TomBoudniatski opened 1 year ago

TomBoudniatski commented 1 year ago

Hey, I'm trying to figure out how to work with GA for the first time, I read the documentations and played around with some examples but none of them gave me similar example for what I was originally looking for.

I'm trying to implement a GA solution for a problem where I have a few random parking spaces groups, each space is represented by a simple 2D rectangle, so basically it's a few random groups of adjacent rectangles.

My goal is to place Lighting Fixtures which represented by a point (the center of the lighting fixture), each fixture has an effective lighting radius, mandatory minimum distance from any other fixture, the goal is to solve this using minimum fixtures.

here you can see the parking spaces (black), the fixtures(red), distance from the edge (orange), distance between fixtures(green) Visual

I was hoping someone more experienced could point me to the right example code from which I can learn and draw conclusions about how to right my own algorithm.

Thanks!

TomBoud commented 1 year ago

In order to solve this problem I decided to scale it down first, I'm trying to make sure the Lighting Fixtures are able to "find" the individual parking spaces and illuminate as much area as possible for each parking space.

I was able to generate random parking spaces using the Blazor App TSP solution example: image

Here is what I came up so far, hope this can give some more context. ParkingGA.zip

I'm looking for a way to create the Evaluation functions, I guess it should be the overlapping area of the rectangle (parking space) and the circle (Lighting Fixture) which has an effective lighting radius on the parking space.

I'm also not sure I did the ParkingChromosome.cs correctly, any suggestions ?