Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodus committed Nov 29, 2023
1 parent bacba03 commit f6a9dff
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions graph-gateway/src/budgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,11 @@ impl Controller {
let error = f64::from(self.target_query_fees.0) - process_variable;
*self.error_history.current_mut() += error;

let i: f64 = self.error_history.frames().iter().sum();
let k_i = 30e3;
// let i: f64 = self.error_history.frames().iter().sum();
// let k_i = 10e3;
// self.target_query_fees.0
// * (UDecimal18::from(1) + UDecimal18::try_from(i * k_i).unwrap_or_default())
self.target_query_fees.0
* (UDecimal18::from(1) + UDecimal18::try_from(i * k_i).unwrap_or_default())
}
}

Expand Down Expand Up @@ -161,8 +162,6 @@ mod tests {
for setpoint in [10e-6, 20e-6, 50e-6] {
let setpoint = USD(UDecimal18::try_from(setpoint).unwrap());
let mut controller = Controller::new(setpoint);
test_controller(&mut controller, 0.2, tolerance);
let mut controller = Controller::new(setpoint);
test_controller(&mut controller, 0.6, tolerance);
let mut controller = Controller::new(setpoint);
test_controller(&mut controller, 0.8, tolerance);
Expand Down

0 comments on commit f6a9dff

Please sign in to comment.