eyeonus / Trade-Dangerous

Mozilla Public License 2.0
96 stars 31 forks source link

A General List of Potential Issues #143

Open ultimatespirit opened 2 months ago

ultimatespirit commented 2 months ago

Wanted to list out some things I ran into that may or may not be issues (could just be error on my part with options):

The really long part

This brings me to the main thing that prompted me to finally report the above along with this (normally I'd have tried to fix them first). I'm not entirely sure the router is actually optimising correctly. As a test of its behaviour I went to two different stations, compiling .price file information using EDMC along the way, and put the stations into the in-game comparison mode. I also consulted inara to double check the data was being sent / it agreed.

The two stations in question were "7 Andromedae/Papin City" and "Howard/Serling Station". As given by my price files (generate from landing on them) there was, for example, Cobalt at 2740 credits each in Serling Station, and Cobalt being purchased at Papin City for 18,964 credits each. So around a 16k profit per ton one way. For the return journey Papin City sold Basic Medicines at 328 credits each and Serling bought at 913 each, or just under a 600 cr/ton profit. As far as I could tell from the documentation, the --gain-per-ton parameter has no default, presumably allowing arbitrarily low values / 0 profit legs to exist. The two stations are 10.32ly away from each other and have around an aggregate profit of 16.8k cr/ton from a direct path.

Inara confirmed this simple trade route as well. trade.py however... can't find it. I confirmed I had imported the data correctly and trade.py market ... correctly ouputs the right info per commodity. And no matter what permutation of the below command I tried, I couldn't manage to get it to display that trade route as viable. And not because it wasn't the most efficient, the output being given were trade routes with a profit per ton average of 9k or lower involving multiple jumps each. The cost analysis function seems to be a bit iffy in how it's weighing things, or profit legs that are below around 1000 get forcibly rejected (I haven't seen evidence of it making a 0 profit or sub 1k profit route), even if gpt gets set to 0, or it has something to do with supply / demand heuristics as serling station did have relatively low supply (still above 1000 though).

$ ./trade.py run --from "7 andromedae/papin city" --credits 70m --capacity 192 --ly-per 15.39 --routes 3 --hops 3 --to "7 andromedae/papin city" --progress --fc N --age 2 -J -vv --empty-ly 20.24 --via "howard/serling station" --shorten --gpt 0
* Hop   1: .........1 origins 
* Hop   2: ........24 origins .. 15,360-792,768cr gain, 80-4,129cr/ton
NOTE: Pruned 23 origins too far from any end stations
* Hop   3: ........39 origins .. 392,064-3,250,752cr gain, 1,021-8,465cr/ton
./trade.py: Error: No routes were found which matched your 'via' selections.
Possible causes:
- No profitable runs or routes meet your criteria,
- Missing Systems or Stations along the route (see "local -vv"),
- Missing price data (see "market -vv" or "update -h"),

I tried without --via (only gets 9k or less), with --loop instead of the --to hack there, with more / less hops, with/without --shorten, with/without --gpt / different values of gpt, with differing values of --age... more or less anything I could think of I tried here. No matter what it seemed incapable of acknowledging this route existed, and considering many of the routes it was finding for --from "7 andromedae/papin city" --loop were outright below 50% the efficiency of this simple hop in credits alone, let alone jumps, it seemed a bit odd how it was unable to find a much larger local maximum.

For what it's worth, trade.py trade ... does correctly output the individual profitable items for the two stations, but I was more interested in testing that trade.py run ... did find my added data + could find a simple maxima like that, it seems unexpected that it can't find it. And I know some of the setting combos I tried were able to output two station loops, so I don't think it's that I had specified it somehow to exclude such trips...

Oh, by the way, this combo triggers an assert:

$ ./trade.py run --from "7 andromedae/papin city" --credits 70m --capacity 192 --ly-per 15.39 --routes 3 --hops 2 --to "7 andromedae/papin city" --progress --fc N --age 2 -J -vv --empty-ly 20.24 --via "howard/serling station" --shorten
* Hop   1: .........1 origins 
Traceback (most recent call last):
  File "...Trade-Dangerous/./trade.py", line 44, in <module>
    cli.main(sys.argv)
  File "...Trade-Dangerous/tradedangerous/cli.py", line 66, in main
    trade(argv)
  File "...Trade-Dangerous/tradedangerous/cli.py", line 121, in trade
    results = cmdenv.run(tdb)
              ^^^^^^^^^^^^^^^
  File "...Trade-Dangerous/tradedangerous/commands/commandenv.py", line 84, in run
    return self._cmd.run(results, self, tdb)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...Trade-Dangerous/tradedangerous/commands/run_cmd.py", line 1261, in run
    newRoutes = calc.getBestHops(routes, restrictTo = restrictTo)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...Trade-Dangerous/tradedangerous/tradecalc.py", line 855, in getBestHops
    assert not restrictTo or isinstance(restrictTo, set)
AssertionError

Seems to specifically be --shorten with --hops 2.