Struct Budget
pub struct Budget {
pub max_trials: Option<u64>,
pub max_fidelity_units: Option<u64>,
pub deadline_millis: Option<u64>,
}Expand description
What a study is allowed to spend.
Every field is optional; None means unbounded. Budgets are enforced at
ask time and exposed to objectives through
TrialCtx::budget, because an RL run
legitimately needs to know how many environment steps it may use (the
budget).
Fields§
§max_trials: Option<u64>Maximum number of trials to create.
max_fidelity_units: Option<u64>Cooperative maximum total fidelity, in the study’s ResourceUnit,
summed over durable trial reports.
The gate is evaluated from a storage snapshot before new work starts. Already-running trials may therefore carry the durable total past this value when multiple handles execute concurrently. Use it as a stop signal, not as an atomic cross-process reservation.
The overshoot is bounded, not unknown. Admission stops the instant the
durable total reaches the limit, so everything above it is work that was
already in flight: with P handles running concurrently and a per-trial
charge of at most F units, the total can exceed the limit by at most
P * F. A single handle therefore overshoots by at most the one trial
that crossed the line.
A hard atomic reservation was considered and deliberately not built: it would need an owning cross-process protocol to reserve and settle units before every evaluation, and this budget stops a search rather than metering a paid resource, so the bound above is what the contract owes.
deadline_millis: Option<u64>Wall-clock deadline, in the study clock’s milliseconds. Compared
against a Clock; never read from the OS here.
Implementations§
§impl Budget
impl Budget
pub const fn unbounded() -> Self
pub const fn unbounded() -> Self
An unbounded budget.
pub const fn with_fidelity_units(self, units: u64) -> Self
pub const fn with_fidelity_units(self, units: u64) -> Self
Sets the cooperative fidelity budget.
This is an ask-time stop signal based on durable reports, not an atomic reservation. Concurrent in-flight trials can overshoot it.
pub const fn with_deadline_millis(self, millis: u64) -> Self
pub const fn with_deadline_millis(self, millis: u64) -> Self
Sets the deadline, in the study clock’s milliseconds.
pub const fn is_unbounded(&self) -> bool
pub const fn is_unbounded(&self) -> bool
true if nothing is limited.