pub struct Policy { /* private fields */ }Expand description
A snapshot of the average strategy at every decision node.
Take one with Trainer::policy; it does not change as training continues.
Pass it to SolverGame’s read methods. The probabilities are normalized,
suit-symmetrized, and stored per bucket as [node][action][bucket]
(Policy::rows), so a policy can be saved and later restored with
SolverGame::policy_from_rows.
§Examples
trainer.train(100);
let policy = trainer.policy();
let saved: Vec<Vec<Vec<f64>>> = policy.rows().to_vec();
// More training does not change the snapshot.
trainer.train(100);
let restored = trainer.game().policy_from_rows(saved)?;
assert_eq!(restored, policy);
let exploitability = trainer.game().exploitability(&restored).total;
assert!(exploitability.is_finite());Implementations§
Trait Implementations§
impl StructuralPartialEq for Policy
Auto Trait Implementations§
impl Forget for Policy
impl Freeze for Policy
impl Move for Policy
impl RefUnwindSafe for Policy
impl Send for Policywhere
RawVecInner: Send,
impl Sync for Policywhere
RawVecInner: Sync,
impl Unpin for Policy
impl UnsafeUnpin for Policy
impl UnwindSafe for Policywhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more