NSGA-II icon indicating copy to clipboard operation
NSGA-II copied to clipboard

Questions about soft and hard constraints

Open sgirardin opened this issue 4 years ago • 4 comments

Hi @onclave, we are doing a roster optimization project using GA for our lecture. We have found your project, which is very interesting. But we would like to add some hard and soft constraints to influence the fitness results, unfortunately, we haven't found that concept in the code (but is stated in the research paper). Where would you add these Constraints, in Service.calculateFitness or Service.decodeGeneticCode or do you have a more enlightened idea with your eventual knowledge of the C code base?

If you want we will do a Pull request with our changes on your codebase.

Thanks for the response.

sgirardin avatar May 02 '20 18:05 sgirardin

Hello @sgirardin it’s great that you found this repository useful. So, yes, by default you could just implement you own method to calculate the fitness of every chromosome by changing / implementing the Service#calculateFitness() method. You can directly provide your constraints there.

You can also share with me how you intend to put these constraints around the calculated fitness values and I can directly make it part of the repository too.

One thing is that this codebase was intended to be a POC for NSGA-II for my own research. But since it is gaining traction, I am already working on converting this repository into a package for easier use, while keeping the POC part intact since it is easier to teach the algorithm to others this way. I’m almost done converting it to a usable package. You can share how you intend to put the constraints and I can include it right away. Otherwise the repository is also welcome to pull requests.

onclave avatar May 03 '20 09:05 onclave

Hi @onclave

thanks for your quick response. We have just chosen our Objective functions and the constraints (hard or soft) we want to enforce. We still need to generate our sets (train service and train drivers) accordingly. As soon as we have a clearer vision on the needed modifications I'll let you know with pleasure.

Thanks Simon

sgirardin avatar May 11 '20 19:05 sgirardin

Hello @sgirardin

I've pushed an update to the repository which brings major changes to it. I've converted into a fully working package with much more flexibility and customisability in terms of usage. I'm still in the process of publishing to maven central, but you can take a look into the documentation and getting started. While there is more work to do on the documentation, the getting started section shall help you a lot. Do let me know if you need more help.

onclave avatar May 12 '20 17:05 onclave

Hi @onclave I'm still looking at your changes seems very nice. The documentation seems complete. I'll let you if it's the case :-). I'll start working on our project and let you know if something may interest you.

sgirardin avatar May 17 '20 15:05 sgirardin