added crossover file and updated mutation file#28
Open
Meowwwwwwwwwwwwwwwwwwwww wants to merge 4 commits intomainfrom
Open
added crossover file and updated mutation file#28Meowwwwwwwwwwwwwwwwwwwww wants to merge 4 commits intomainfrom
Meowwwwwwwwwwwwwwwwwwwww wants to merge 4 commits intomainfrom
Conversation
Samples/Mutation_Files/mutation.py
Outdated
| mutated_sections = [] | ||
|
|
||
| for section in schedule.keys(): | ||
| if self.mutate_time_slots_in_section(schedule, section): |
Collaborator
There was a problem hiding this comment.
Please traverse according to the correct chromosome structure.
| if len(section_list) < 2: | ||
| print(f"Not enough time slots to mutate in section '{section}'.") | ||
| class Mutation: | ||
| def mutate_time_slots_in_section(self, schedule, section): |
Collaborator
There was a problem hiding this comment.
This function should return the mutated chromosome.
|
|
||
| Returns: | ||
| bool: True if mutation was performed, False otherwise. | ||
| """ |
Collaborator
There was a problem hiding this comment.
It looks like the mutation rate is missing here. Could you please add it?
| mutated_sections = mutate_all_sections(schedule) | ||
| # Create an instance of the Mutation class with a mutation rate of 100% | ||
| mutation_rate = 1.0 | ||
| mutator = Mutation(mutation_rate=mutation_rate) |
Collaborator
There was a problem hiding this comment.
Please use randomized mutation rate
TechLead-War
requested changes
Nov 24, 2024
| @@ -1,97 +1,151 @@ | |||
| import random | |||
Collaborator
There was a problem hiding this comment.
Why we have mutation2.py with same code as of mutation.py
| class ScheduleCrossover: | ||
| def __init__(self): | ||
| # schedules for week1 and week2 | ||
| self.week1 = { |
Collaborator
There was a problem hiding this comment.
Import from samples.
| } | ||
|
|
||
| self.new_offspring = None # Will hold the result after crossover | ||
|
|
Collaborator
There was a problem hiding this comment.
- Add error handling to check if a crossover_day exists in both weeks:
- Validate the schedule structure before performing the crossover.(If the structure of week1 or week2 changes,the program could crash ).
| # Example weekly schedule | ||
| weekly_schedule = { | ||
| "Monday": { | ||
| "A": [ |
Collaborator
There was a problem hiding this comment.
import chromosomes from samples
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
updated crossover function and updated mutation file