Skip to content

Commit

Permalink
feat: penalty for charge discharge periods that doesn't change soc (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
enell authored May 9, 2023
1 parent 13eee2c commit fc20124
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/fitness.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,13 @@ const calculatePeriodScore = (

const fitnessFunction = (props) => (phenotype) => {
let cost = 0
let averagePrice = props.input.reduce((acc, cur) => acc + cur.importPrice, 0) / props.input.length

for (const period of allPeriodsGenerator(props, phenotype)) {
let periodScore = period.cost
if (period.activity != 0 && period.charge == 0) {
periodScore += averagePrice * period.duration / 60
}
cost -= period.cost
}

Expand Down

0 comments on commit fc20124

Please sign in to comment.