-
Notifications
You must be signed in to change notification settings - Fork 4
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
Refactor resource fitness functions and Lexicographic mode of GA #65
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Update the genetic operators so that they create only valid chromosomes. Remove the validity check in the schedule_builder. This allows to control the number of schedules created during the execution of the genetic algorithm through parameters population_size and generation_number. This also increases the number of individuals in offspring obtained at each iteration, which improves the quality of the genetic algorithm. - Introduce combined operators of mutation and crossover. They combine operators for order and resources to make them easier to use in genetic algorithm - Update mutation operators of resources and resource borders by replacing the uniform distribution of possible gene mutations to improve the stability of chromosome changes - Replace loops in genetic operators with numpy operations for time improvement on large instances - Introduce two-point crossover operator for order. It has higher performance on large instances - Introduce resource borders updating function. It changes the resource borders to the peak values in the schedule obtained from the chromosome. This is necessary to track current resource borders when optimizing resources - Add to resources crossover operator ability to change resource borders based on parents. This is necessary to create valid chromosomes when optimizing resources - Update the schedule_builder and Genetic Algorithm, adding the ability to run it in a two-stage mode, which implements lexicographic optimization for planning to a deadline. This approach is better than integrating the deadline into the optimization criterion because it allows one to obtain solutions that exactly satisfy the deadline. - Introduce new tests for operators, two-stage genetic algorithm and resource borders updating function
- Remove deadline from constructor of Genetic Scheduler - Remove rudimentary functionality from fitness functions. Evaluate method and evaluator attribute are removed - Extract generalized function mutate_values for resources and resource borders mutation - Remove asserts in genetic algorithm - Introduce categorical type for individuals. It is needed in genetic algorithm
- Delete try-except blocks - Add set_deadline method calling
- Update logic of fitness functions in genetic algorithm. Genetic Scheduler initialisation takes constructor of fitness object, that creates in each schedule method calling. Schedule_builder takes now fitness object - Make IndividualType uppercase
# Conflicts: # pyproject.toml
- Add condition mating_amount > 1 in mate_scheduling_order to prevent errors on small instances - Fix mistake in contractors mutation masking in mutate_resources
# Conflicts: # sampo/scheduler/genetic/operators.py
Change logic of Lexicographic mode of GA to set optimization function after reaching deadline
Timotshak
added
enhancement
New feature or request
refactor
The rewriting of existing code to improve code quality
labels
Nov 10, 2023
StannisMod
requested changes
Nov 13, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes requested
StannisMod
approved these changes
Nov 13, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fitness function for optimizization after reaching deadline