Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resume GA when instantiated using a population with GenerationsNumber > 0 #119

Closed
elpht opened this issue Mar 17, 2024 · 3 comments
Closed

Comments

@elpht
Copy link
Contributor

elpht commented Mar 17, 2024

I'm working on a GA that takes quite long to calculate the fitness of each chromosome due to the nature of the problem. Therefore, after generation ran I serialize the population (custom serializable population that I implemented) so that it's possible to resume later the algorithm even if the computer where it runs has to be switched off.

So far I managed to overcome all problems I found except one: when I instantiate a GA using a deserialized population and try to resume, the field m_stopwatch isn't initialized, thus causing an exception.

Well, I could also have my own GA implementation, copying the one provided by the library and fixing the initialization of the Stopwatch, but I thought it would be pretty straightforward to modify the existing implementation to allow resuming the GA instance without being previously started. Would you see it senseful?

@giacomelli
Copy link
Owner

giacomelli commented Mar 18, 2024

It would be useful. You can just make a pull request with your fix, I'll review it (please check our contributing page before)

Or you can try to use a custom population with your deserialized genes like this one: #9 (comment)

elpht pushed a commit to elpht/GeneticSharp that referenced this issue Mar 18, 2024
…g algorithms using a population that is not in the first generation
elpht pushed a commit to elpht/GeneticSharp that referenced this issue Mar 18, 2024
…g algorithms using a population that is not in the first generation
elpht pushed a commit to elpht/GeneticSharp that referenced this issue Mar 18, 2024
…g algorithms using a population that is not in the first generation
giacomelli pushed a commit that referenced this issue Mar 21, 2024
…ms using a population that is not in the first generation (#120)

Co-authored-by: elpht <[email protected]>
@giacomelli
Copy link
Owner

Closed by PR #120

@elpht
Copy link
Contributor Author

elpht commented Dec 31, 2024

Hi @giacomelli, do you have any plans for releasing a new version including this fix in the near future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants