-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from danyoungday/ci
Fixing Github actions to perform CI
- Loading branch information
Showing
35 changed files
with
179 additions
and
52 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
max-line-length = 120 | ||
exclude = inputSpecs.py |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ suggestion-mode=yes | |
|
||
good-names=X,F,X0 | ||
|
||
fail-under=9.8 | ||
fail-under=9.6 |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
""" | ||
Abstract crossover class to be inherited. | ||
""" | ||
from abc import ABC, abstractmethod | ||
|
||
from evolution.candidate import Candidate | ||
from evolution.mutation.mutation import Mutation | ||
|
||
|
||
class Crossover(ABC): | ||
""" | ||
Abstract class for crossover operations. | ||
""" | ||
def __init__(self, mutator: Mutation=None): | ||
def __init__(self, mutator: Mutation = None): | ||
self.mutator = mutator | ||
|
||
@abstractmethod | ||
def crossover(self, cand_id: str, parent1: Candidate, parent2: Candidate) -> list[Candidate]: | ||
""" | ||
Crosses over 2 parents to create offspring. Returns a list so we can return multiple if needed. | ||
""" | ||
raise NotImplementedError | ||
raise NotImplementedError |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
""" | ||
Implementation of the AverageCostOutcome class. | ||
""" | ||
import pandas as pd | ||
|
||
from evolution.outcomes.outcome import Outcome | ||
|
||
|
||
class AverageCostOutcome(Outcome): | ||
""" | ||
Average cost after decision point year. | ||
""" | ||
def process_outcomes(self, _, outcomes_df: pd.DataFrame) -> float: | ||
""" | ||
Returns the average cost from 2025 onwards. | ||
""" | ||
cost_col = outcomes_df["Adjusted cost of energy per GJ"] | ||
cost = cost_col.iloc[2025-1990:].mean() | ||
return cost | ||
return cost |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
""" | ||
Basic enroads outcome | ||
""" | ||
import pandas as pd | ||
|
||
from evolution.outcomes.outcome import Outcome | ||
|
||
|
||
class EnroadsOutcome(Outcome): | ||
""" | ||
Just checks the final year of an enroads outcome column. | ||
""" | ||
def __init__(self, outcome: str): | ||
self.outcome = outcome | ||
|
||
def process_outcomes(self, _, outcomes_df: pd.DataFrame) -> float: | ||
""" | ||
Simple case where we return the specified outcome in 2100. | ||
""" | ||
return outcomes_df[self.outcome].iloc[-1] | ||
return outcomes_df[self.outcome].iloc[-1] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
""" | ||
Max cost outcome implementation. | ||
""" | ||
import pandas as pd | ||
|
||
from evolution.outcomes.outcome import Outcome | ||
|
||
|
||
class MaxCostOutcome(Outcome): | ||
""" | ||
Gets the max cost over the entire range of years. | ||
""" | ||
def process_outcomes(self, _, outcomes_df: pd.DataFrame) -> float: | ||
""" | ||
Returns the max cost of energy. | ||
""" | ||
cost_col = outcomes_df["Adjusted cost of energy per GJ"] | ||
cost = cost_col.max() | ||
return cost | ||
return cost |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
""" | ||
Near cost outcome implementation. | ||
""" | ||
import pandas as pd | ||
|
||
from evolution.outcomes.outcome import Outcome | ||
|
||
|
||
class NearCostOutcome(Outcome): | ||
""" | ||
Gets the average cost over the next 10 years. | ||
""" | ||
def process_outcomes(self, _, outcomes_df: pd.DataFrame) -> float: | ||
""" | ||
Returns the average cost of energy over the next 10 years. | ||
""" | ||
cost_col = outcomes_df["Adjusted cost of energy per GJ"] | ||
cost = cost_col.iloc[2025-1990:2035-1990].mean() | ||
return cost | ||
return cost |
Oops, something went wrong.