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

2 participants
@halseth
Copy link
Collaborator

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 halseth: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 halseth:autopilot-dryrun-only branch 3 times, most recently from afd0c1e to 447e522 Jan 3, 2019

@halseth halseth referenced this pull request Jan 3, 2019

Merged

Bos score enabled Autopilot #2212

6 of 6 tasks complete
@Roasbeef

This comment has been minimized.

Copy link
Member

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 halseth:autopilot-dryrun-only branch from 447e522 to ebfbda6 Jan 9, 2019

@Roasbeef Roasbeef added this to the 0.6 milestone Jan 16, 2019

@Roasbeef
Copy link
Member

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

This comment has been minimized.

@Roasbeef

Roasbeef Jan 19, 2019

Member

The var statements can be combined under a single stanza:

var (
    sum
    heuristics 
)

This comment has been minimized.

@halseth

halseth Jan 21, 2019

Author Collaborator

Done.

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

This comment has been minimized.

@Roasbeef

Roasbeef Jan 19, 2019

Member

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

This comment has been minimized.

@halseth

halseth Jan 21, 2019

Author Collaborator

Done!

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

@Roasbeef

This comment has been minimized.

Copy link
Member

Roasbeef commented Jan 23, 2019

Needs a rebase!

halseth added some commits Dec 19, 2018

autopilot/agent: protect chanState with mutex
Since we want to access the current channel state outside the main
autopilot agent goroutine, we make sure it is protected by a mutex.
config+pilot: define autopilot.heuristic
And validate the config set by the user.
autopilot/agent: add queryHeuristics
This commit adds a method queryHeuristic that will query all simple
heuristics for node scores, in addition to the current active heuristic.
autopilot/manager: add QueryHeuristics
Proxies a query request to the active agent.
lnrpc/autopilotrpc: add QueryScores API
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.
lncli: add autopilot query command
To query the autopilot heuristics for scores.

@halseth halseth force-pushed the halseth:autopilot-dryrun-only branch from b35ba57 to 5306ed5 Jan 23, 2019

@halseth

This comment has been minimized.

Copy link
Collaborator Author

halseth commented Jan 23, 2019

Rebased. PTAL @Roasbeef

@Roasbeef Roasbeef merged commit ecd5541 into lightningnetwork:master Jan 24, 2019

1 of 2 checks passed

coverage/coveralls Coverage decreased (-0.2%) to 56.104%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

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