Fleet  0.0.9
Inference in the LOT
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
VirtualMachinePool< VirtualMachineState_t > Class Template Reference

#include <VirtualMachinePool.h>

Inheritance diagram for VirtualMachinePool< VirtualMachineState_t >:
Inheritance graph
[legend]
Collaboration diagram for VirtualMachinePool< VirtualMachineState_t >:
Collaboration graph
[legend]

Public Types

typedef VirtualMachineState_t::output_t output_t
 
typedef VirtualMachineState_t::input_t input_t
 

Public Member Functions

 VirtualMachinePool ()
 
virtual ~VirtualMachinePool ()
 
virtual void clear ()
 Remove everything and reset my values. More...
 
bool wouldIadd (double lp)
 Returns true if I would add something with this lp, given my MAX_STEPS and the stack. This lets us speed up by checking if we would add before copying/constructing a VMS. More...
 
void push (VirtualMachineState_t *o)
 Add the VirtualMachineState_t o to this pool (but again checking if I'd add) More...
 
template<typename T >
bool copy_increment_push (const VirtualMachineState_t *x, T v, double lpinc)
 This is an important opimization where we will make a copy of x, push v into it's stack, and increment its lp by lpinc only if it will be added to the queue, which we check in the pool here. This saves us from having to use the VirtualMachineState constructor (e.g. making a copy, which is expensive if we are copying all the stacks) if the copy won't actually be added to the queue. More...
 
template<typename T >
bool increment_push (VirtualMachineState_t *s, T v, double lpinc)
 Same as copy_increment_push, but does not make a copy – just add. More...
 
DiscreteDistribution< output_trun ()
 This runs and adds up the probability mass for everything, returning a dictionary outcomes->log_probabilities. This is the main running loop, which pops frmo the top of our queue, runs, and continues until we've done enough or all. Note that objects lower than min_lp are not ever pushed onto the queue. More...
 
std::vector< VirtualMachineState_t > run_vms ()
 Run but return a vector of completed virtual machines instead of marginalizing outputs. You might want this if you needed to separate execution paths, or wanted to access runtime counts. This also can get joint distributions on outputs by running a VirtualMachineState multiple times. More...
 

Public Attributes

unsigned long total_vms_steps
 
double worst_lp
 
unsigned long total_instruction_count
 
std::priority_queue< VirtualMachineState_t *, std::vector< VirtualMachineState_t * >, VirtualMachinePool::compare_VirtualMachineState_t_prt > Q
 

Additional Inherited Members

- Static Public Attributes inherited from VirtualMachineControl
static unsigned long MAX_RECURSE = 64
 
static unsigned long MAX_RUN_PROGRAM = 10000
 
static unsigned long MAX_STEPS = 512
 
static unsigned long MAX_OUTPUTS = 512
 
static double MIN_LP = -10
 

Detailed Description

template<typename VirtualMachineState_t>
class VirtualMachinePool< VirtualMachineState_t >

Author
piantado
Date
02/02/20

Member Typedef Documentation

◆ input_t

template<typename VirtualMachineState_t>
typedef VirtualMachineState_t::input_t VirtualMachinePool< VirtualMachineState_t >::input_t

◆ output_t

template<typename VirtualMachineState_t>
typedef VirtualMachineState_t::output_t VirtualMachinePool< VirtualMachineState_t >::output_t

Constructor & Destructor Documentation

◆ VirtualMachinePool()

template<typename VirtualMachineState_t>
VirtualMachinePool< VirtualMachineState_t >::VirtualMachinePool ( )
inline

◆ ~VirtualMachinePool()

template<typename VirtualMachineState_t>
virtual VirtualMachinePool< VirtualMachineState_t >::~VirtualMachinePool ( )
inlinevirtual

Member Function Documentation

◆ clear()

template<typename VirtualMachineState_t>
virtual void VirtualMachinePool< VirtualMachineState_t >::clear ( )
inlinevirtual

Remove everything and reset my values.

◆ copy_increment_push()

template<typename VirtualMachineState_t>
template<typename T >
bool VirtualMachinePool< VirtualMachineState_t >::copy_increment_push ( const VirtualMachineState_t *  x,
v,
double  lpinc 
)
inline

This is an important opimization where we will make a copy of x, push v into it's stack, and increment its lp by lpinc only if it will be added to the queue, which we check in the pool here. This saves us from having to use the VirtualMachineState constructor (e.g. making a copy, which is expensive if we are copying all the stacks) if the copy won't actually be added to the queue.

Parameters
x
v
lpinc
Returns

◆ increment_push()

template<typename VirtualMachineState_t>
template<typename T >
bool VirtualMachinePool< VirtualMachineState_t >::increment_push ( VirtualMachineState_t *  s,
v,
double  lpinc 
)
inline

Same as copy_increment_push, but does not make a copy – just add.

Parameters
s
v
lpinc
Returns

◆ push()

template<typename VirtualMachineState_t>
void VirtualMachinePool< VirtualMachineState_t >::push ( VirtualMachineState_t *  o)
inline

Add the VirtualMachineState_t o to this pool (but again checking if I'd add)

Parameters
o

◆ run()

template<typename VirtualMachineState_t>
DiscreteDistribution<output_t> VirtualMachinePool< VirtualMachineState_t >::run ( )
inline

This runs and adds up the probability mass for everything, returning a dictionary outcomes->log_probabilities. This is the main running loop, which pops frmo the top of our queue, runs, and continues until we've done enough or all. Note that objects lower than min_lp are not ever pushed onto the queue.

Parameters
dispatcher
loader
Returns

HMM Do we want to count these too? I guess since its called "total"....

◆ run_vms()

template<typename VirtualMachineState_t>
std::vector<VirtualMachineState_t> VirtualMachinePool< VirtualMachineState_t >::run_vms ( )
inline

Run but return a vector of completed virtual machines instead of marginalizing outputs. You might want this if you needed to separate execution paths, or wanted to access runtime counts. This also can get joint distributions on outputs by running a VirtualMachineState multiple times.

Parameters
loader
Returns

◆ wouldIadd()

template<typename VirtualMachineState_t>
bool VirtualMachinePool< VirtualMachineState_t >::wouldIadd ( double  lp)
inline

Returns true if I would add something with this lp, given my MAX_STEPS and the stack. This lets us speed up by checking if we would add before copying/constructing a VMS.

Parameters
lp
Returns

Member Data Documentation

◆ Q

template<typename VirtualMachineState_t>
std::priority_queue<VirtualMachineState_t*, std::vector<VirtualMachineState_t*>, VirtualMachinePool::compare_VirtualMachineState_t_prt> VirtualMachinePool< VirtualMachineState_t >::Q

◆ total_instruction_count

template<typename VirtualMachineState_t>
unsigned long VirtualMachinePool< VirtualMachineState_t >::total_instruction_count

◆ total_vms_steps

template<typename VirtualMachineState_t>
unsigned long VirtualMachinePool< VirtualMachineState_t >::total_vms_steps

◆ worst_lp

template<typename VirtualMachineState_t>
double VirtualMachinePool< VirtualMachineState_t >::worst_lp

The documentation for this class was generated from the following file: