Documentation ¶
Overview ¶
Package rdbstore implements CFR storage components that keep data in a RocksDB database, rather than in memory datastructures.
These implementations are substantially slower than the corresponding in-memory components but can scale to games that do not fit in memory.
Index ¶
- type Params
- type PolicyTable
- type ReservoirBuffer
- func (b *ReservoirBuffer) AddSample(s deepcfr.Sample)
- func (b *ReservoirBuffer) Close() error
- func (b *ReservoirBuffer) GetSample(idx int) deepcfr.Sample
- func (b *ReservoirBuffer) GetSamples() []deepcfr.Sample
- func (b *ReservoirBuffer) Len() int
- func (b *ReservoirBuffer) MarshalBinary() ([]byte, error)
- func (b *ReservoirBuffer) UnmarshalBinary(buf []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Params ¶
type Params struct { Path string Options *rocksdb.Options ReadOptions *rocksdb.ReadOptions WriteOptions *rocksdb.WriteOptions }
func DefaultParams ¶
type PolicyTable ¶
type PolicyTable struct {
// contains filtered or unexported fields
}
PolicyTable is a tabular CFR policy table that keeps all node policies on disk in a LevelDB database. PolicyTable implements cfr.StrategyProfile.
It is functionally equivalent to a cfr.PolicyTable. In practice, it is significantly slower but will use constant amount of memory since all policies are kept on disk.
func New ¶
func New(params Params, discounts cfr.DiscountParams) (*PolicyTable, error)
New creates a new PolicyTable backed by a LevelDB database at the given path.
func (*PolicyTable) GetPolicy ¶
func (pt *PolicyTable) GetPolicy(node cfr.GameTreeNode) cfr.NodePolicy
GetPolicy implements cfr.StrategyProfile.
func (*PolicyTable) MarshalBinary ¶
func (pt *PolicyTable) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (*PolicyTable) UnmarshalBinary ¶
func (pt *PolicyTable) UnmarshalBinary(buf []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type ReservoirBuffer ¶
type ReservoirBuffer struct {
// contains filtered or unexported fields
}
ReservoirBuffer implements a reservoir sampling buffer in which samples are stored in a LevelDB database.
It is functionally equivalent to deepcfr.ReservoirBuffer. In practice, it will be somewhat slower but use less memory since all samples are kept on disk.
func NewReservoirBuffer ¶
func NewReservoirBuffer(params Params, maxSize int) (*ReservoirBuffer, error)
NewReservoirBuffer returns a new ReservoirBuffer with the given max number of samples, backed by a LevelDB database at the given directory path.
func (*ReservoirBuffer) AddSample ¶
func (b *ReservoirBuffer) AddSample(s deepcfr.Sample)
AddSample implements deepcfr.Buffer.
func (*ReservoirBuffer) GetSample ¶
func (b *ReservoirBuffer) GetSample(idx int) deepcfr.Sample
GetSample implements Buffer.
func (*ReservoirBuffer) GetSamples ¶
func (b *ReservoirBuffer) GetSamples() []deepcfr.Sample
GetSamples implements deepcfr.Buffer.
func (*ReservoirBuffer) MarshalBinary ¶
func (b *ReservoirBuffer) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (*ReservoirBuffer) UnmarshalBinary ¶
func (b *ReservoirBuffer) UnmarshalBinary(buf []byte) error
UnmarshalBinary implements encoding.BinaryMarshaler.