HOG2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
UnitSimulation< state, action, environment > Class Template Reference

The basic simulation class for the world. More...

#include <UnitSimulation.h>

Inheritance diagram for UnitSimulation< state, action, environment >:
Inheritance graph
[legend]
Collaboration diagram for UnitSimulation< state, action, environment >:
Collaboration graph
[legend]

Public Member Functions

 UnitSimulation (environment *se)
 
virtual ~UnitSimulation ()
 
virtual int AddUnit (Unit< state, action, environment > *u, double timeOffset=0.)
 
unsigned int GetNumUnits () const
 
Unit< state, action, environment > * GetUnit (unsigned int which)
 
unsigned int GetNumUnitGroups () const
 
int AddUnitGroup (UnitGroup< state, action, environment > *ug)
 
UnitGroup< state, action, environment > * GetUnitGroup (unsigned int which)
 
virtual void ClearAllUnits ()
 
virtual void GetPublicUnitInfo (unsigned int which, PublicUnitInfo< state, action, environment > &info) const
 
environment * GetEnvironment ()
 
void StepTime (double)
 
double GetSimulationTime () const
 
double GetTimeToNextStep () const
 
void SetStepType (tTimestep step)
 
tTimestep GetStepType () const
 
void SetPaused (bool val)
 
bool GetPaused ()
 
bool Done ()
 
void SetThinkingPenalty (double pen)
 setPenalty for thinking. More...
 
double GetThinkingPenalty ()
 getPenalty for thinking. More...
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (unsigned int whichUnit) const
 
void SetLogStats (bool val)
 
bool GetLogStats ()
 
StatCollectionGetStats ()
 
virtual SimulationInfo< state, action, environment > * GetSimulationInfo ()
 
virtual unsigned int GetCurrentUnit () const
 
- Public Member Functions inherited from SimulationInfo< state, action, environment >
virtual ~SimulationInfo ()
 

Protected Member Functions

void StepUnitTime (UnitInfo< state, action, environment > *ui, double timeStep)
 step time for a single unit. More...
 
bool MakeUnitMove (UnitInfo< state, action, environment > *theUnit, action where, double &moveCost)
 
virtual void DoPreTimestepCalc ()
 
virtual void DoTimestepCalc (double amount)
 
virtual void DoPostTimestepCalc ()
 

Protected Attributes

double penalty
 
bool paused
 
bool logStats
 
std::vector< UnitInfo< state, action, environment > * > units
 
std::vector< UnitGroup< state, action, environment > * > unitGroups
 
environment * env
 
double currTime
 
tTimestep stepType
 
StatCollection stats
 
unsigned int currentActor
 

Detailed Description

template<class state, class action, class environment>
class UnitSimulation< state, action, environment >

The basic simulation class for the world.

Definition at line 85 of file UnitSimulation.h.

Constructor & Destructor Documentation

◆ UnitSimulation()

template<class state , class action , class environment >
UnitSimulation< state, action, environment >::UnitSimulation ( environment *  se)

Definition at line 152 of file UnitSimulation.h.

References kRealTime.

◆ ~UnitSimulation()

template<class state , class action , class environment >
UnitSimulation< state, action, environment >::~UnitSimulation
virtual

Definition at line 166 of file UnitSimulation.h.

Member Function Documentation

◆ AddUnit()

template<class state , class action , class environment >
int UnitSimulation< state, action, environment >::AddUnit ( Unit< state, action, environment > *  u,
double  timeOffset = 0. 
)
virtual

◆ AddUnitGroup()

template<class state , class action , class environment >
int UnitSimulation< state, action, environment >::AddUnitGroup ( UnitGroup< state, action, environment > *  ug)

Definition at line 214 of file UnitSimulation.h.

◆ ClearAllUnits()

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::ClearAllUnits
virtual

◆ Done()

template<class state , class action , class environment >
bool UnitSimulation< state, action, environment >::Done

Definition at line 270 of file UnitSimulation.h.

◆ DoPostTimestepCalc()

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::DoPostTimestepCalc
protectedvirtual

Definition at line 359 of file UnitSimulation.h.

◆ DoPreTimestepCalc()

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::DoPreTimestepCalc
protectedvirtual

Reimplemented in EpisodicSimulation< state, action, environment >.

Definition at line 338 of file UnitSimulation.h.

◆ DoTimestepCalc()

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::DoTimestepCalc ( double  amount)
protectedvirtual

◆ GetCurrentUnit()

template<class state , class action , class environment >
virtual unsigned int UnitSimulation< state, action, environment >::GetCurrentUnit ( ) const
inlinevirtual

◆ GetEnvironment()

template<class state , class action , class environment >
environment* UnitSimulation< state, action, environment >::GetEnvironment ( )
inline

◆ GetLogStats()

template<class state , class action , class environment >
bool UnitSimulation< state, action, environment >::GetLogStats ( )
inline

◆ GetNumUnitGroups()

template<class state , class action , class environment >
unsigned int UnitSimulation< state, action, environment >::GetNumUnitGroups
virtual

Implements SimulationInfo< state, action, environment >.

Definition at line 221 of file UnitSimulation.h.

◆ GetNumUnits()

template<class state , class action , class environment >
unsigned int UnitSimulation< state, action, environment >::GetNumUnits
virtual

Implements SimulationInfo< state, action, environment >.

Definition at line 200 of file UnitSimulation.h.

◆ GetPaused()

template<class state , class action , class environment >
bool UnitSimulation< state, action, environment >::GetPaused ( )
inline

◆ GetPublicUnitInfo()

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::GetPublicUnitInfo ( unsigned int  which,
PublicUnitInfo< state, action, environment > &  info 
) const
virtual

◆ GetSimulationInfo()

template<class state , class action , class environment >
virtual SimulationInfo<state,action,environment>* UnitSimulation< state, action, environment >::GetSimulationInfo ( )
inlinevirtual

Definition at line 128 of file UnitSimulation.h.

◆ GetSimulationTime()

template<class state , class action , class environment >
double UnitSimulation< state, action, environment >::GetSimulationTime ( ) const
inlinevirtual

◆ GetStats()

template<class state , class action , class environment >
StatCollection* UnitSimulation< state, action, environment >::GetStats ( )
inlinevirtual

◆ GetStepType()

template<class state , class action , class environment >
tTimestep UnitSimulation< state, action, environment >::GetStepType ( ) const
inline

◆ GetThinkingPenalty()

template<class state , class action , class environment >
double UnitSimulation< state, action, environment >::GetThinkingPenalty ( )
inline

getPenalty for thinking.

Gets the multiplier used to penalize thinking time.

Definition at line 118 of file UnitSimulation.h.

References UnitSimulation< state, action, environment >::penalty.

◆ GetTimeToNextStep()

template<class state , class action , class environment >
double UnitSimulation< state, action, environment >::GetTimeToNextStep

Definition at line 305 of file UnitSimulation.h.

◆ GetUnit()

template<class state , class action , class environment >
Unit< state, action, environment > * UnitSimulation< state, action, environment >::GetUnit ( unsigned int  which)

Definition at line 206 of file UnitSimulation.h.

◆ GetUnitGroup()

template<class state , class action , class environment >
UnitGroup< state, action, environment > * UnitSimulation< state, action, environment >::GetUnitGroup ( unsigned int  which)

Definition at line 227 of file UnitSimulation.h.

◆ MakeUnitMove()

template<class state , class action , class environment >
bool UnitSimulation< state, action, environment >::MakeUnitMove ( UnitInfo< state, action, environment > *  theUnit,
action  where,
double &  moveCost 
)
protected

◆ OpenGLDraw() [1/2]

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::OpenGLDraw
virtual

Definition at line 487 of file UnitSimulation.h.

◆ OpenGLDraw() [2/2]

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::OpenGLDraw ( unsigned int  whichUnit) const
virtual

Definition at line 501 of file UnitSimulation.h.

◆ SetLogStats()

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::SetLogStats ( bool  val)
inline

◆ SetPaused()

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::SetPaused ( bool  val)
inline

◆ SetStepType()

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::SetStepType ( tTimestep  step)
inline

◆ SetThinkingPenalty()

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::SetThinkingPenalty ( double  pen)
inline

setPenalty for thinking.

Sets the multiplier used to penalize thinking time.

Definition at line 116 of file UnitSimulation.h.

References UnitSimulation< state, action, environment >::penalty.

◆ StepTime()

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::StepTime ( double  timeStep)

Definition at line 319 of file UnitSimulation.h.

◆ StepUnitTime()

template<class state , class action , class environment >
void UnitSimulation< state, action, environment >::StepUnitTime ( UnitInfo< state, action, environment > *  theUnit,
double  timeStep 
)
protected

Member Data Documentation

◆ currentActor

template<class state , class action , class environment >
unsigned int UnitSimulation< state, action, environment >::currentActor
mutableprotected

◆ currTime

template<class state , class action , class environment >
double UnitSimulation< state, action, environment >::currTime
protected

◆ env

template<class state , class action , class environment >
environment* UnitSimulation< state, action, environment >::env
protected

◆ logStats

template<class state , class action , class environment >
bool UnitSimulation< state, action, environment >::logStats
protected

◆ paused

template<class state , class action , class environment >
bool UnitSimulation< state, action, environment >::paused
protected

◆ penalty

template<class state , class action , class environment >
double UnitSimulation< state, action, environment >::penalty
protected

◆ stats

template<class state , class action , class environment >
StatCollection UnitSimulation< state, action, environment >::stats
protected

◆ stepType

template<class state , class action , class environment >
tTimestep UnitSimulation< state, action, environment >::stepType
protected

◆ unitGroups

template<class state , class action , class environment >
std::vector<UnitGroup<state, action, environment> *> UnitSimulation< state, action, environment >::unitGroups
protected

◆ units

template<class state , class action , class environment >
std::vector<UnitInfo<state, action, environment> *> UnitSimulation< state, action, environment >::units
protected

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