Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing heuristics #821

Merged
merged 86 commits into from Feb 22, 2019

Conversation

Projects
None yet
2 participants
@araspitzu
Copy link
Member

araspitzu commented Jan 15, 2019

Add heuristics to the cost function of the path finding algorithm, and the ability to tune them by prioritizing for certain types. This enables the initiator of the payment (via SendPayment) to search for routes optimized for reliability or timeout where the reliability of a channel is obtained considering its age and capacity, with the assumption that older and larger channel are more reliable. Note that it is possible to specify the factor(s) by which we want consider each optimization, the ratios: WeightRatios parameter allows to specify a floating point value for each optimization heuristic, for example:

  • WeightRatios(cltvDeltaFactor = 0, ageFactor = 0.5, capacityFactor = 0.5) will consider equally the age and capacity of a channel but won't consider its CLTV delta.
  • WeightRatios(cltvDeltaFactor = 0, ageFactor = 0, capacityFactor = 0) will not consider heuristics optimization at all thus falling back to the previous behavior, cost optimized.
  • WeightRatios(cltvDeltaFactor = 1, ageFactor = 0, capacityFactor = 0) will find the route with the smallest possible cltv, thus minimizing the timeout in case of payment failure.

Optimization ratios can be specified at payment time or via the configuration file, by default they're all set to 0 in order to search for the route with the cheapest fees. Note that this can be combined with the existing bounded-search parameters such as the fee-threshold-sat to ask the router to find heuristics-optimized routes within the given constraints.

araspitzu added some commits Jan 14, 2019

@araspitzu

This comment has been minimized.

Copy link
Member Author

araspitzu commented Jan 16, 2019

This supersedes #792

araspitzu added some commits Jan 18, 2019

Merge branch 'master' into routing_heuristics
# Conflicts:
#	eclair-core/src/main/scala/fr/acinq/eclair/router/Graph.scala
#	eclair-core/src/main/scala/fr/acinq/eclair/router/Router.scala
#	eclair-core/src/test/scala/fr/acinq/eclair/router/RouteCalculationSpec.scala

@araspitzu araspitzu force-pushed the routing_heuristics branch from e73c1ec to ee5490e Jan 22, 2019

Merge branch 'master' of github.com:ACINQ/eclair into routing_heuristics
# Conflicts:
#	eclair-core/src/main/resources/reference.conf
#	eclair-core/src/main/scala/fr/acinq/eclair/router/Router.scala

@araspitzu araspitzu force-pushed the routing_heuristics branch from d013fbf to dfc1772 Jan 23, 2019

araspitzu added some commits Jan 23, 2019

@araspitzu araspitzu changed the title [WIP] Routing heuristics Routing heuristics Jan 24, 2019

@araspitzu araspitzu force-pushed the routing_heuristics branch from b47bcf6 to abd2bdb Jan 28, 2019

araspitzu added some commits Feb 8, 2019

Merge branch 'master' into route_fast_searching
# Conflicts:
#	eclair-core/src/main/resources/reference.conf
#	eclair-core/src/main/scala/fr/acinq/eclair/NodeParams.scala
#	eclair-core/src/test/scala/fr/acinq/eclair/TestConstants.scala
Merge branch 'route_fast_searching' into routing_heuristics
# Conflicts:
#	eclair-core/src/main/scala/fr/acinq/eclair/router/Graph.scala
#	eclair-core/src/main/scala/fr/acinq/eclair/router/Router.scala
Merge branch 'master' into routing_heuristics
# Conflicts:
#	eclair-core/src/main/resources/reference.conf
#	eclair-core/src/main/scala/fr/acinq/eclair/NodeParams.scala
#	eclair-core/src/main/scala/fr/acinq/eclair/payment/PaymentLifecycle.scala
#	eclair-core/src/main/scala/fr/acinq/eclair/router/Graph.scala
#	eclair-core/src/main/scala/fr/acinq/eclair/router/Router.scala
#	eclair-core/src/test/scala/fr/acinq/eclair/TestConstants.scala
#	eclair-core/src/test/scala/fr/acinq/eclair/router/RouteCalculationSpec.scala
Merge branch 'master' into routing_heuristics
# Conflicts:
#	eclair-core/src/main/scala/fr/acinq/eclair/router/Graph.scala
#	eclair-core/src/test/scala/fr/acinq/eclair/router/RouteCalculationSpec.scala
@araspitzu

This comment has been minimized.

Copy link
Member Author

araspitzu commented Feb 20, 2019

These changes have no significant performance impact, below a benchmark on a routing table from 29/01/2019 (~23k channels).

 Run complete. Total time: 00:07:24 (routing_heuristic: b1bf584) - Bounded search, no randomization, max-route-length=7, cost-optimized

Benchmark                                   Mode  Cnt  Score   Error  Units
GraphBenchmark.findPath                     avgt    2  0.001           s/op   
GraphBenchmark.findPathWithExtraChannels    avgt    2  0.004           s/op
GraphBenchmark.findPathWithIgnoredChannels  avgt    2  0.032           s/op
GraphBenchmark.routerLoadingTime            avgt    2  5.320           s/op

@araspitzu araspitzu requested review from sstone and pm47 Feb 21, 2019

araspitzu added some commits Feb 21, 2019

@sstone

sstone approved these changes Feb 22, 2019

@sstone sstone merged commit fe31f2d into master Feb 22, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@sstone sstone deleted the routing_heuristics branch Mar 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.