-
Notifications
You must be signed in to change notification settings - Fork 55
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
Refactored class_optimize.py #88
Conversation
- Optimized Imports: Removed unused imports and organized them. - Refactored Code: Introduced split_individual function for clarity. - Improved Efficiency: Enhanced penalty calculation and streamlined loops. - Updated Evaluation Logic: Better handling of penalties in evaluate. - Type Hints added - fixed seed option added for automated tests - verbose comment added, default False Notes: - isfloat is only used in flask_server.py - start_hour is not used in this class
statistically proof that the new class is as good as (the same) as the old one. |
start_hour, | ||
self.prediction_hours, | ||
einspeiseverguetung_euro_pro_wh, | ||
extra_data=extra_data, | ||
) | ||
|
||
os.system("cp visualisierungsergebnisse.pdf ~/") |
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.
Result PDF path file should be configurable, maybe a method parameter or config parameter.
creator.create("FitnessMin", base.Fitness, weights=(-1.0,)) | ||
creator.create("Individual", list, fitness=creator.FitnessMin) | ||
|
||
# PARAMETER | ||
# Initialize toolbox with attributes and operations | ||
self.toolbox = base.Toolbox() |
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.
Initialization should be move to __init__
. Toolbox is used in other places as well.
verbose: bool = False, | ||
fixed_seed: Optional[int] = None, | ||
): | ||
"""Initialize the optimization problem with the required parameters.""" |
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.
Docstring can be more helpful to describe each parameter. I'm using Google Style docstrings, maybe we can discuss on using in this project.
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.
Lets discuss this in the discussion section.
Test meant for class_optimize. Will only work with PR #88 since the old class has no way to use a fixed random seed.
Test meant for class_optimize. Will only work with PR #88 since the old class has no way to use a fixed random seed.
Test meant for class_optimize. Will only work with PR #88 since the old class has no way to use a fixed random seed.
Notes: