79d2a6ce4ce21f21e895184c76f47fd2f21205e5
[ldk-java] / c_sharp / src / org / ldk / structs / ProbabilisticScoringDecayParameters.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * Parameters for configuring [`ProbabilisticScorer`].
11  * 
12  * Used to configure decay parameters that are static throughout the lifetime of the scorer.
13  * these decay parameters affect the score of the channel penalty and are not changed on a
14  * per-route penalty cost call.
15  */
16 public class ProbabilisticScoringDecayParameters : CommonBase {
17         internal ProbabilisticScoringDecayParameters(object _dummy, long ptr) : base(ptr) { }
18         ~ProbabilisticScoringDecayParameters() {
19                 if (ptr != 0) { bindings.ProbabilisticScoringDecayParameters_free(ptr); }
20         }
21
22         /**
23          * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
24          * tracking can simply live on with increasingly stale data. Instead, when a channel has not
25          * seen a liquidity estimate update for this amount of time, the historical datapoints are
26          * decayed by half.
27          * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`]
28          * 
29          * Note that after 16 or more half lives all historical data will be completely gone.
30          * 
31          * Default value: 14 days
32          * 
33          * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime::historical_estimated_channel_liquidity_probabilities
34          */
35         public long get_historical_no_updates_half_life() {
36                 long ret = bindings.ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(this.ptr);
37                 GC.KeepAlive(this);
38                 return ret;
39         }
40
41         /**
42          * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
43          * tracking can simply live on with increasingly stale data. Instead, when a channel has not
44          * seen a liquidity estimate update for this amount of time, the historical datapoints are
45          * decayed by half.
46          * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`]
47          * 
48          * Note that after 16 or more half lives all historical data will be completely gone.
49          * 
50          * Default value: 14 days
51          * 
52          * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime::historical_estimated_channel_liquidity_probabilities
53          */
54         public void set_historical_no_updates_half_life(long val) {
55                 bindings.ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(this.ptr, val);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
62          * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
63          * the available liquidity is halved and the upper-bound moves half-way to the channel's total
64          * capacity.
65          * 
66          * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
67          * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
68          * struct documentation for more info on the way the liquidity bounds are used.
69          * 
70          * For example, if the channel's capacity is 1 million sats, and the current upper and lower
71          * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
72          * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
73          * 
74          * Default value: 6 hours
75          * 
76          * # Note
77          * 
78          * When built with the `no-std` feature, time will never elapse. Therefore, the channel
79          * liquidity knowledge will never decay except when the bounds cross.
80          */
81         public long get_liquidity_offset_half_life() {
82                 long ret = bindings.ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(this.ptr);
83                 GC.KeepAlive(this);
84                 return ret;
85         }
86
87         /**
88          * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
89          * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
90          * the available liquidity is halved and the upper-bound moves half-way to the channel's total
91          * capacity.
92          * 
93          * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
94          * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
95          * struct documentation for more info on the way the liquidity bounds are used.
96          * 
97          * For example, if the channel's capacity is 1 million sats, and the current upper and lower
98          * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
99          * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
100          * 
101          * Default value: 6 hours
102          * 
103          * # Note
104          * 
105          * When built with the `no-std` feature, time will never elapse. Therefore, the channel
106          * liquidity knowledge will never decay except when the bounds cross.
107          */
108         public void set_liquidity_offset_half_life(long val) {
109                 bindings.ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(this.ptr, val);
110                 GC.KeepAlive(this);
111                 GC.KeepAlive(val);
112         }
113
114         /**
115          * Constructs a new ProbabilisticScoringDecayParameters given each field
116          */
117         public static ProbabilisticScoringDecayParameters of(long historical_no_updates_half_life_arg, long liquidity_offset_half_life_arg) {
118                 long ret = bindings.ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
119                 GC.KeepAlive(historical_no_updates_half_life_arg);
120                 GC.KeepAlive(liquidity_offset_half_life_arg);
121                 if (ret >= 0 && ret <= 4096) { return null; }
122                 org.ldk.structs.ProbabilisticScoringDecayParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ProbabilisticScoringDecayParameters(null, ret); }
123                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
124                 return ret_hu_conv;
125         }
126
127         internal long clone_ptr() {
128                 long ret = bindings.ProbabilisticScoringDecayParameters_clone_ptr(this.ptr);
129                 GC.KeepAlive(this);
130                 return ret;
131         }
132
133         /**
134          * Creates a copy of the ProbabilisticScoringDecayParameters
135          */
136         public ProbabilisticScoringDecayParameters clone() {
137                 long ret = bindings.ProbabilisticScoringDecayParameters_clone(this.ptr);
138                 GC.KeepAlive(this);
139                 if (ret >= 0 && ret <= 4096) { return null; }
140                 org.ldk.structs.ProbabilisticScoringDecayParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ProbabilisticScoringDecayParameters(null, ret); }
141                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
142                 return ret_hu_conv;
143         }
144
145         /**
146          * Creates a "default" ProbabilisticScoringDecayParameters. See struct and individual field documentaiton for details on which values are used.
147          */
148         public static ProbabilisticScoringDecayParameters with_default() {
149                 long ret = bindings.ProbabilisticScoringDecayParameters_default();
150                 if (ret >= 0 && ret <= 4096) { return null; }
151                 org.ldk.structs.ProbabilisticScoringDecayParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ProbabilisticScoringDecayParameters(null, ret); }
152                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
153                 return ret_hu_conv;
154         }
155
156 }
157 } } }