Skip to content

Commit

Permalink
Better lsp penalty curves
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Dec 29, 2014
1 parent 339b41b commit 11da8e0
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tradecalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def genSubValues(key):
yield key(tr)
longestNameLen = max(genSubValues(key=lambda tr: len(tr.name())))

text = self.str() + ":\n"
text = self.str()
if detail >= 1:
text += " (score: {:f})".format(self.score)
text += "\n"
if detail > 1:
if detail > 2:
text += self.summary() + "\n"
Expand Down Expand Up @@ -519,11 +522,14 @@ def getBestHops(self, routes, restrictTo=None):
# This will amortize for the start/end stations
score = trade.gainCr
if lsPenalty:
supercruiseKls = dstStation.lsFromStar / 1000
penalty = lsPenalty * supercruiseKls
if supercruiseKls > 4:
boost = supercruiseKls / 250
penalty *= boost
# Only want 1dp
cruiseKls = int(dstStation.lsFromStar / 100) / 10
# Produce a curve that favors distances under 1kls
# positively, starts to penalize distances over 1k,
# and after 4kls starts to penalize aggresively
# http://goo.gl/Otj2XP
penalty = ((cruiseKls ** 2) - cruiseKls) / 3
penalty *= lsPenalty
score *= (1 - penalty)
dstID = dstStation.ID
try:
Expand Down

0 comments on commit 11da8e0

Please sign in to comment.