-
-
Notifications
You must be signed in to change notification settings - Fork 7
Description
A preliminary test indicates that using 1.6*log(ppm+1)+log(uncertainty_unit_cost) as the cost function works pretty well for feature engineering. This has a nice implication on runtime. As with proper feature engineering one can prune in an educated way. Note that the min costflow solver here is constantly below 0.1 seconds!
Features were motivated by this diagram:
where a combined cost of 8 corresponds to pruning everything but the 20% cheapest channels (cheap as in low combined cost) as indicted by this addation to the prepare_min_cost_flow_solver indicates:
if self._prune_network:
neighbor = False
if channel.src ==src or channel.dest == dest:
neighbor = True
routing_cost = channel.linearized_integer_routing_unit_cost()
uncertainty_cost = channel.linearized_integer_uncertainty_unit_cost()
if neighbor == (False and 1.6*log(routing_cost+1) + log(uncertainty_cost))/2 > 8:
break
Here is a log of a run where the min cost flow problem is solved on the pruned network with the regular cost function (linearized_integer_uncertainty_cost + my*linearized_integer_routing_cost) and mu=1
Round number: 1
Try to deliver 29091333 satoshi:
Statistics about 29 candidate onions:
successful attempts:
--------------------
p = 78.46% amt: 192000 sats hops: 2 ppm: 1342
p = 52.80% amt: 1200000 sats hops: 2 ppm: 2572
p = 78.58% amt: 177822 sats hops: 2 ppm: 1415
p = 69.33% amt: 400000 sats hops: 2 ppm: 1382
p = 76.00% amt: 200000 sats hops: 2 ppm: 1382
p = 77.95% amt: 220000 sats hops: 3 ppm: 1439
p = 73.92% amt: 194200 sats hops: 3 ppm: 1362
p = 99.69% amt: 4329 sats hops: 3 ppm: 1757
p = 49.07% amt: 1214012 sats hops: 3 ppm: 1465
p = 27.37% amt: 2674502 sats hops: 3 ppm: 1537
p = 50.33% amt: 400000 sats hops: 4 ppm: 1562
p = 46.22% amt: 3000000 sats hops: 4 ppm: 1410
p = 38.17% amt: 145043 sats hops: 4 ppm: 1378
p = 26.31% amt: 648823 sats hops: 4 ppm: 1466
p = 20.79% amt: 1400000 sats hops: 5 ppm: 1375
p = 21.55% amt: 3200000 sats hops: 5 ppm: 1362
p = 18.59% amt: 1520569 sats hops: 5 ppm: 1352
p = 17.39% amt: 565988 sats hops: 5 ppm: 1451
p = 30.51% amt: 500000 sats hops: 5 ppm: 1344
failed attempts:
----------------
p = 64.00% amt: 1000000 sats hops: 2 ppm: 1360
p = 72.00% amt: 200000 sats hops: 2 ppm: 1357
p = 76.60% amt: 200000 sats hops: 3 ppm: 1548
p = 48.09% amt: 600000 sats hops: 3 ppm: 1548
p = 46.47% amt: 825478 sats hops: 3 ppm: 1486
p = 49.20% amt: 2453124 sats hops: 3 ppm: 1365
p = 35.01% amt: 2000000 sats hops: 3 ppm: 1567
p = 23.38% amt: 2000000 sats hops: 5 ppm: 1460
p = 10.11% amt: 1775443 sats hops: 6 ppm: 1361
p = 45.20% amt: 180000 sats hops: 6 ppm: 1347
Attempt Summary:
=================
Tried to deliver 29091333 sats
expected to deliver 10573496 sats (36.35%)
actually deliverd 17857288 sats (61.38%)
deviation: 1.69
planned_fee: 42911.104 sat
paid fees: 26748.241 sat
Runtime of flow computation: 0.09 sec
================================================================
Round number: 2
Try to deliver 11234045 satoshi:
Statistics about 10 candidate onions:
successful attempts:
--------------------
p = 65.99% amt: 740000 sats hops: 3 ppm: 1381
p = 70.60% amt: 2076764 sats hops: 4 ppm: 1417
p = 51.08% amt: 1870235 sats hops: 4 ppm: 1466
p = 33.32% amt: 1423236 sats hops: 5 ppm: 1360
p = 58.33% amt: 84619 sats hops: 5 ppm: 1378
p = 42.70% amt: 488031 sats hops: 9 ppm: 1359
failed attempts:
----------------
p = 74.67% amt: 399134 sats hops: 3 ppm: 1757
p = 84.86% amt: 825478 sats hops: 3 ppm: 1836
p = 34.33% amt: 2355557 sats hops: 3 ppm: 1537
p = 28.37% amt: 970991 sats hops: 4 ppm: 1378
Attempt Summary:
=================
Tried to deliver 11234045 sats
expected to deliver 5724478 sats (50.96%)
actually deliverd 6682885 sats (59.49%)
deviation: 1.17
planned_fee: 16607.774 sat
paid fees: 9427.854 sat
Runtime of flow computation: 0.10 sec
================================================================
Round number: 3
Try to deliver 4551160 satoshi:
Statistics about 16 candidate onions:
successful attempts:
--------------------
p = 78.72% amt: 153600 sats hops: 2 ppm: 1341
p = 76.73% amt: 360000 sats hops: 2 ppm: 2572
p = 78.84% amt: 142257 sats hops: 2 ppm: 1415
p = 76.63% amt: 160000 sats hops: 2 ppm: 1382
p = 78.27% amt: 176000 sats hops: 3 ppm: 1439
p = 73.21% amt: 300000 sats hops: 3 ppm: 1460
p = 90.20% amt: 52822 sats hops: 3 ppm: 1362
p = 97.89% amt: 25478 sats hops: 3 ppm: 1487
p = 74.75% amt: 400000 sats hops: 4 ppm: 1436
p = 70.53% amt: 240000 sats hops: 5 ppm: 1375
p = 72.77% amt: 400000 sats hops: 5 ppm: 1359
p = 46.36% amt: 472297 sats hops: 9 ppm: 1359
failed attempts:
----------------
p = 77.32% amt: 194198 sats hops: 3 ppm: 1537
p = 60.40% amt: 320000 sats hops: 4 ppm: 1562
p = 41.05% amt: 724412 sats hops: 5 ppm: 1378
p = 31.23% amt: 430096 sats hops: 10 ppm: 1368
Attempt Summary:
=================
Tried to deliver 4551160 sats
expected to deliver 2815353 sats (61.86%)
actually deliverd 2882454 sats (63.33%)
deviation: 1.02
planned_fee: 6832.375 sat
paid fees: 4446.099 sat
Runtime of flow computation: 0.09 sec
================================================================
Round number: 4
Try to deliver 1668706 satoshi:
Statistics about 5 candidate onions:
successful attempts:
--------------------
p = 78.59% amt: 140800 sats hops: 3 ppm: 1438
p = 93.77% amt: 194198 sats hops: 4 ppm: 1378
p = 73.87% amt: 240000 sats hops: 5 ppm: 1361
p = 37.17% amt: 901708 sats hops: 10 ppm: 1366
failed attempts:
----------------
p = 72.08% amt: 192000 sats hops: 5 ppm: 1375
Attempt Summary:
=================
Tried to deliver 1668706 sats
expected to deliver 943618 sats (56.55%)
actually deliverd 1476706 sats (88.49%)
deviation: 1.56
planned_fee: 2293.679 sat
paid fees: 2029.679 sat
Runtime of flow computation: 0.09 sec
================================================================
Round number: 5
Try to deliver 192000 satoshi:
Statistics about 1 candidate onions:
successful attempts:
--------------------
p = 88.00% amt: 192000 sats hops: 2 ppm: 1382
Attempt Summary:
=================
Tried to deliver 192000 sats
expected to deliver 168960 sats (88.00%)
actually deliverd 192000 sats (100.00%)
deviation: 1.14
planned_fee: 265.344 sat
paid fees: 265.344 sat
Runtime of flow computation: 0.05 sec
================================================================
SUMMARY:
========
Rounds of mcf-computations: 5
Number of onions sent: 61
Number of failed onions: 19
Failure rate: 31.15%
total runtime (including inefficient memory managment): 3.945 sec
Learnt entropy: 79.93 bits
Fees for successfull delivery: 42917.217 sat --> 1475 ppm
used mu: 1
