Skip to content

Commit

Permalink
Merged kfsone/tradedangerous into master
Browse files Browse the repository at this point in the history
  • Loading branch information
maddavo committed Jan 20, 2015
2 parents 5d6633a + 5533274 commit d0c976c
Show file tree
Hide file tree
Showing 13 changed files with 830 additions and 89 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ data/TradeDangerous.db
data/TradeDangerous.db-journal
data/TradeDangerous.prices
data/*.stamp
data/extra-stars.txt
*.prices
*.suo
*.pyperf
Expand Down
10 changes: 9 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014
==============================================================================

[wip]
. (kfsone) '--ls-max' will now also unknown (0) distances,
. (kfsone) Added '--max-routes' for setting an absolute max on how many
of the top routes we use after the first hop,
. (kfsone) Added 'submit-distances' tool for submitting EDStarCoordinator
star data.
. (kfsone) Added '--prune-score' and '--prune-hops' to run; these let
you discard routes that are under-performing early on which
can make calculating longer runs more efficient.
. (kfsone) Added "--progress" to "run" to show the current hop,
. (kfsone) "run" and TradeCalc are much smarter about which hops
they will consider when using --max-age, --blackmarket, etc.
(big perf win)

. (kfsone) Renamed "misc/edstarquery.py" to "misc/edsc.py"
- Added misc.edsc.StarSubmission
- Renamed misc.edsc.EDStarQuery to misc.edsc.StarQuery
- Changed "submit-distances" to use "StarSubmission"

v6.7.0 Jan 17 2015
. (kfsone) ".prices" import automatically creates local placeholders
Expand Down
26 changes: 18 additions & 8 deletions commands/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@
metavar='N',
type=int,
),
ParseArgument('--max-routes',
help='At the end of each hop, limit the number of routes '
'that continue to the next round to the top N '
'highest scoring',
default=0,
metavar='N',
type=int,
dest='maxRoutes',
),
ParseArgument('--checklist',
help='Provide a checklist flow for the route.',
action='store_true',
Expand Down Expand Up @@ -403,7 +412,7 @@ def checkStationSuitability(cmdenv, station, src=None):
))
return False
mls = cmdenv.maxLs
if mls and station.lsFromStar > mls:
if mls and (station.lsFromStar <= 0 or station.lsFromStar > mls):
if src and src != "--from":
raise CommandLineError(
"{} station {} does not meet max-ls "
Expand All @@ -415,7 +424,7 @@ def checkStationSuitability(cmdenv, station, src=None):
if maxAge and station.dataAge > maxAge:
if src and src != "--from":
raise CommandLineError(
"{} station {} does not meet --max-age "
"{} station {} does not meet --age "
"requirement.".format(
src, station.name(),
))
Expand All @@ -425,8 +434,6 @@ def checkStationSuitability(cmdenv, station, src=None):
def filterStationSet(src, cmdenv, stnSet):
if not stnSet:
return stnSet
bm, mps = cmdenv.blackMarket, cmdenv.maxPadSize
mls = cmdenv.maxLs
for place in stnSet:
if not isinstance(place, Station):
continue
Expand Down Expand Up @@ -613,8 +620,8 @@ def validateRunArguments(tdb, cmdenv):
if cmdenv.pruneScores and cmdenv.pruneHops:
if cmdenv.pruneScores > 100:
raise CommandLineError("--prune-score value percentage exceed 100.")
if cmdenv.pruneHops < 3:
raise CommandLineError("--prune-hops must 3 or more.")
if cmdenv.pruneHops < 2:
raise CommandLineError("--prune-hops must 2 or more.")
else:
cmdenv.pruneScores = cmdenv.pruneHops = 0

Expand Down Expand Up @@ -710,17 +717,20 @@ def run(results, cmdenv, tdb):
elif len(viaSet) > cmdenv.adhocHops:
restrictTo = viaSet

if cmdenv.maxRoutes and hopNo >= 1:
routes = routes[:cmdenv.maxRoutes]

if pruneMod and hopNo + 1 >= cmdenv.pruneHops and len(routes) > 10:
routes.sort()
bestScore, worstScore = routes[0].score, routes[-1].score
threshold = bestScore * pruneMod
oldLen = len(routes)
while routes[-1].score < threshold:
routes.pop()
cmdenv.NOTE("Pruned {} routes", oldLen - len(routes))
cmdenv.NOTE("Pruned {} origins", oldLen - len(routes))

if cmdenv.progress:
print("* Hop {:3n}: {:.>10n} routes".format(hopNo+1, len(routes)))
print("* Hop {:3n}: {:.>10n} origins".format(hopNo+1, len(routes)))
elif cmdenv.debug:
cmdenv.DEBUG0("Hop {}...", hopNo+1)

Expand Down
6 changes: 5 additions & 1 deletion corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
}

stations = {
"171 G. AQUARII/ELCANO OOCK": "Elcano Dock",
"21 DRACO/ROBERTS PORT": DELETED,
"37 XI BOOTIS/SCHIRRA PLANT": "Schirba Plant",
"51 AQUILAE/COKEHUB": "Coke Hub",
Expand Down Expand Up @@ -46,11 +47,11 @@
"GCRV 4654/HERZEFELD LANDING": "Herzfeld Landing",
"GROOMBRIDGE 1618/FRANKUN RING": "Franklin Ring",
"HDS 1879/HEDIN ORBITAL": DELETED,
"HIP 110483/VALIGURSKY ORBITAE": "Valigursky Orbital",
"HIP 4907/EDISON PLATFORM": DELETED,
"HR 5451/MACDONALO HUB": "MacDonald Hub",
"HR 5451/MACOONALD HUB": "MacDonald Hub",
"HR 5451/MACOONALO HUB": "MacDonald Hub",
"HIP 110483/VALIGURSKY ORBITAE": "Valigursky Orbital",
"JAWOLA/SUTCLIFFEPLATFORM": "Sutcliffe Platform",
"KANOS/LEE STATION": DELETED,
"LEESTI/GEORGELUCAS": "George Lucas",
Expand Down Expand Up @@ -79,6 +80,9 @@
"ORERVE/WATSON SATION": "Watson Station",
"PANGLUYA/BRADBURYWORKS": "Bradbury Works",
"PERENDI/SHEPHERD INSTALLATION": DELETED,
"PRIVA/DUGAN OOCK": "Dugan Dock",
"PRIVA/OUGAN DOCK": "Dugan Dock",
"PRIVA/OUGAN OOCK": "Dugan Dock",
"RAHU/LEBEDEV BEACON": DELETED,
"RHO CANCRI/HAMILTON R,SERVE": "Hamilton Reserve",
"RHO CANCRI/HAMILTON R�SERVE": "Hamilton Reserve",
Expand Down
6 changes: 6 additions & 0 deletions data/ShipVendor.csv
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,12 @@ unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id
'THIANSI','Worlidge Port','Type 6'
'THIANSI','Worlidge Port','Type 9'
'THIANSI','Worlidge Port','Viper'
'THIIN','Euler Orbital','Asp'
'THIIN','Euler Orbital','Eagle'
'THIIN','Euler Orbital','Hauler'
'THIIN','Euler Orbital','Sidewinder'
'THIIN','Euler Orbital','Type 6'
'THIIN','Euler Orbital','Type 7'
'VOLKHAB','Vernadsky Dock','Adder'
'VOLKHAB','Vernadsky Dock','Anaconda'
'VOLKHAB','Vernadsky Dock','Asp'
Expand Down
Loading

0 comments on commit d0c976c

Please sign in to comment.