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

[Autopilot] Add heuristic dry-run option #2350

Merged
merged 9 commits into from Jan 24, 2019

Conversation

@halseth
Copy link
Collaborator

@halseth halseth commented Dec 19, 2018

This PR adds a new configuration option --autopilot.heuristic that lets the user set the heuristics to use during operation. Several heuristics can be set and weighted, making it possible to use a combination of different heuristics to open channels. Example:

lnd --autopilot.heuristic=externalscore:0.4 --autopilot.heuristic=preferential:0.6

The default value is, as before, --autopilot.heuristic=preferential:1.0

It also adds a new RPC to the autopilot subserver, called QueryScores, that essentially works as a dry-run of the possible heuristics. It will query the available heuristics with the current channel graph, returning the scoring given. The weighted, active heuristic will also be queried.

A commandlncli autopilot query is added to hit the new RPC.

Builds on #2341
Builds on #2405

@halseth halseth force-pushed the autopilot-dryrun-only branch from fbd3539 to 7c60f98 Dec 19, 2018
@Roasbeef Roasbeef added this to In progress in High Priority via automation Dec 21, 2018
@halseth halseth force-pushed the autopilot-dryrun-only branch 3 times, most recently from afd0c1e to 447e522 Jan 3, 2019
@halseth halseth mentioned this pull request Jan 3, 2019
6 tasks
@Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Jan 9, 2019

Very straight forward diff! No major comments other than it'll be staged once its parent PRs are merged. Really looking forward to twiddling with additional scoring heuristics to expand the default set once this is in.

@halseth halseth force-pushed the autopilot-dryrun-only branch from 447e522 to ebfbda6 Jan 9, 2019
@Roasbeef Roasbeef added this to the 0.6 milestone Jan 16, 2019
Copy link
Member

@Roasbeef Roasbeef left a comment

Forgot to make these comments, but they're really just nits.

pilot.go Outdated

// We'll go through the config and make sure all the heuristics exists,
// and that the sum of their weights is 1.0.
var sum float64
Copy link
Member

@Roasbeef Roasbeef Jan 19, 2019

The var statements can be combined under a single stanza:

var (
    sum
    heuristics 
)

Copy link
Collaborator Author

@halseth halseth Jan 21, 2019

Done.

pilot.go Outdated
var heuristics []*autopilot.WeightedHeuristic
outer:
for name, weight := range cfg.Heuristic {
for _, a := range autopilot.AvailableHeuristics {
Copy link
Member

@Roasbeef Roasbeef Jan 19, 2019

Not that there's a massive performance impact, but this could be made a map to avoid the loop check here.

Copy link
Collaborator Author

@halseth halseth Jan 21, 2019

Done!

@halseth halseth force-pushed the autopilot-dryrun-only branch 4 times, most recently from 9c9b201 to fa527b3 Jan 21, 2019
@Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Jan 23, 2019

Needs a rebase!

halseth added 9 commits Jan 23, 2019
And validate the config set by the user.
Since we want to access the current channel state outside the main
autopilot agent goroutine, we make sure it is protected by a mutex.
This commit adds a method queryHeuristic that will query all simple
heuristics for node scores, in addition to the current active heuristic.
Proxies a query request to the active agent.
Adds a new lnrpc API that lets the caller get ("dry run") the scores
that would be given to a set of node by the available autopilot
heuristics.
To query the autopilot heuristics for scores.
@halseth halseth force-pushed the autopilot-dryrun-only branch from b35ba57 to 5306ed5 Jan 23, 2019
@halseth
Copy link
Collaborator Author

@halseth halseth commented Jan 23, 2019

Rebased. PTAL @Roasbeef

@Roasbeef Roasbeef merged commit ecd5541 into lightningnetwork:master Jan 24, 2019
1 of 2 checks passed
High Priority automation moved this from In progress to Done Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
High Priority
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants