pub struct DqnConfig<Q>where
    Q: SubModel<Output = Tensor>,
    Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,{
    pub device: Option<Device>,
    /* private fields */
}
Expand description

Configuration of Dqn agent.

Fields§

§device: Option<Device>

Implementations§

source§

impl<Q> DqnConfig<Q>where Q: SubModel<Output = Tensor>, Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,

source

pub fn soft_update_interval(self, v: usize) -> Self

Sets soft update interval.

source

pub fn n_updates_per_opt(self, v: usize) -> Self

Sets the numper of parameter update steps per optimization step.

source

pub fn min_transitions_warmup(self, v: usize) -> Self

Interval before starting optimization.

source

pub fn batch_size(self, v: usize) -> Self

Batch size.

source

pub fn discount_factor(self, v: f64) -> Self

Discount factor.

source

pub fn tau(self, v: f64) -> Self

Soft update coefficient.

source

pub fn explorer(self, v: DqnExplorer) -> Self

Explorer.

source

pub fn model_config(self, model_config: DqnModelConfig<Q::Config>) -> Self

Sets the configuration of the model.

source

pub fn out_dim(self, out_dim: i64) -> Self

Sets the output dimention of the dqn model of the DQN agent.

source

pub fn clip_reward(self, clip_reward: Option<f64>) -> Self

Reward clipping.

source

pub fn double_dqn(self, double_dqn: bool) -> Self

Double DQN

source

pub fn clip_td_err(self, clip_td_err: Option<(f64, f64)>) -> Self

TD-error clipping.

source

pub fn device(self, device: Device) -> Self

Device.

source

pub fn load(path: impl AsRef<Path>) -> Result<Self>

Loads DqnConfig from YAML file.

source

pub fn save(&self, path: impl AsRef<Path>) -> Result<()>

Saves DqnConfig.

Trait Implementations§

source§

impl<Q> Clone for DqnConfig<Q>where Q: SubModel<Output = Tensor>, Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Q> Debug for DqnConfig<Q>where Q: SubModel<Output = Tensor> + Debug, Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Q> Default for DqnConfig<Q>where Q: SubModel<Output = Tensor>, Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,

source§

fn default() -> Self

Constructs DQN builder with default parameters.

source§

impl<'de, Q> Deserialize<'de> for DqnConfig<Q>where Q: SubModel<Output = Tensor>, Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<Q> PartialEq<DqnConfig<Q>> for DqnConfig<Q>where Q: SubModel<Output = Tensor> + PartialEq, Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone + PartialEq,

source§

fn eq(&self, other: &DqnConfig<Q>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Q> Serialize for DqnConfig<Q>where Q: SubModel<Output = Tensor>, Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<Q> StructuralPartialEq for DqnConfig<Q>where Q: SubModel<Output = Tensor>, Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,

Auto Trait Implementations§

§

impl<Q> RefUnwindSafe for DqnConfig<Q>where Q: RefUnwindSafe, <Q as SubModel>::Config: RefUnwindSafe,

§

impl<Q> Send for DqnConfig<Q>where Q: Send, <Q as SubModel>::Config: Send,

§

impl<Q> Sync for DqnConfig<Q>where Q: Sync, <Q as SubModel>::Config: Sync,

§

impl<Q> Unpin for DqnConfig<Q>where Q: Unpin, <Q as SubModel>::Config: Unpin,

§

impl<Q> UnwindSafe for DqnConfig<Q>where Q: UnwindSafe, <Q as SubModel>::Config: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,