Crystal AI  1.0.0
Crystal Namespace Reference

Classes

class  ActionBase
 Base class for non-generic T:Crystal.IActions. All actions should derive either from this class or its generic version T:Crystal.ActionBase`1. More...
 
class  ActionCollection
 AI Actions collection. More...
 
class  ActionSequence
 An AI action that is comprised of one or more other actions, which are executed in order. More...
 
class  AiCollection
 An AiCollection is a container of all AI building blocks necessary for the construction of utility AI instances. More...
 
class  AiCollectionConstructor
 A convenience static class to create the collection hierarchy required by AiCollection.
 
class  AiConstructor
 A convenience class used to streamline the process of creating a utility AI. More...
 
class  AiTransition
 AiTransition is an T:Crystal.IAction that when executed triggers a selection of an action in another AI. More...
 
class  ArrayExtensions
 Array extensions.
 
class  Behaviour
 An AI behaviour is a set of T:Crystal.IOptions. The behaviour itself is a composite consideration and therefore, unless this is the only behaviour in a T:Crystal.IUtilityAi, it will be selected only if its considerations "win" against competing behaviours in the AI. More...
 
class  BehaviourCollection
 A collection of T:Crystal.IBehaviours. More...
 
class  BehaviourTransition
 BehaviourTransition is an T:Crystal.IAction which when executed triggers the selection of an T:Crystal.IAction using a linked T:Crystal.IBehaviour. More...
 
class  Chebyshev
 Calculates the Chebyshev measure https://en.wikipedia.org/wiki/Chebyshev_distance. More...
 
class  CircularBuffer
 A circular buffer https://en.wikipedia.org/wiki/Circular_buffer. More...
 
class  CommandStream
 The CommandStream processes a given fraction of the AI events on every loop. More...
 
class  CompositeConsideration
 An aggregate of considerations. Although it is possible to create fully functioning AIs using only T:Crystal.IConsiderations, this class allows for such considerations to be combined. This is quite useful as it can reduce the complexity of individual considerations allowing them to be seen as building blocks. More...
 
class  CompositeEvaluator
 The CompositeEvaluator class allows the composition, or combination, of one or more T:Crystal.IEvaluators whose domain of definition does not overlap! Note that addition of an T:Crystal.IEvaluator that has a domain of definition that is covered (even in part) by another T:Crystal.IEvaluator already added to the CompositeEvaluator, will not be added and will have no effect in the evaluation process. More...
 
class  ConsiderationBase
 Base class for considerations. More...
 
class  ConsiderationCollection
 A collection of T:Crystal.IConsiderations and T:Crystal.ICompositeConsiderations More...
 
class  ConsiderationConstructor
 A helper class for creating T:Crystal.CompositeConsiderations.
 
class  ConstantUtilityOption
 This option always returns the same utility irrespective of the context.

See also
T:Crystal.Option
More...
 
class  ConstrainedChebyshev
 Calculates the Chebyshev measure https://en.wikipedia.org/wiki/Chebyshev_distance for all elements whose P:Crystal.Utility.Combined is above the set lower bound. More...
 
class  ConstrainedWeightedMetrics
 Calculates a constrained version of the l-p weighted metrics https://en.wikipedia.org/wiki/Lp_space. More...
 
class  CrMath
 Math helper functions.
 
class  CrTime
 A wrapper for the UnityEngine.Time class. This is necessary for unit tests without the Unity runtime.
 
class  DecisionMaker
 The decision maker, every agent will have one or more of these to execute different AIs. More...
 
class  DecisionMakerBase
 The decision maker, every agent will have one or more of these to execute different AIs. More...
 
class  DeferredCommand
 DeferredCommand is a command whose execution is delegated to a future time and/or executes repeatedly. More...
 
class  DictionaryExtensions
 Dictionary extensions.
 
class  EnumerableExtensions
 IEnumerable extensions.
 
class  EvaluatorBase
 EvaluatorBase serves as a base class for all evaluators, i.e. functions with arbitrary domain of definition and a range equal to any sub-interval of [0,1]. More...
 
interface  IAction
 AI Actions Interface. This is the "bottom-line" in that all decision making eventually leads to the execution of a class that implements this interface. More...
 
interface  IActionCollection
 A collection of T:Crystal.IActions. More...
 
interface  IAiCollection
 Interface for AiCollections. AiCollections contain the building blocks for spawning concrete AI instances. An AiCollection also contains all sub-collections used in its composition. More...
 
interface  IAiPrototype
 Interface to all AiPrototypes. More...
 
interface  IBehaviour
 Interface to Behaviours. More...
 
interface  IBehaviourCollection
 Interface for BehaviourCollections. A behaviour collection contains behaviours and all sub-collections required for these behaviours. Namely, options, considerations and actions. More...
 
interface  ICircularBuffer
 Circular buffer interface. More...
 
interface  ICompositeConsideration
 Interface for considerations that themselves calculate a Utility based on the Utility of T:Crystal.IConsiderations. T:Crystal.IOption and T:Crystal.IBehaviour derive from this interface. More...
 
interface  IConsideration
 Interface to a consideration. More...
 
interface  IConsiderationCollection
 Interface for a collection that contains T:Crystal.IConsiderations and T:Crystal.ICompositeConsiderations. More...
 
interface  IContext
 The context interface enables the communication and sharing of information between the agent and the AI. More...
 
interface  IContextProvider
 Interface for context provider responsible for supplying the T:Crystal.IContext implementing context instances. More...
 
interface  IDecisionMaker
 Interface for the decision maker. The only responsibility of the decision maker is to manage its associated AI. More...
 
interface  IDeferredCommandHandle
 Interface to represent items added to the load balancer, which allows a number of operations to be called. More...
 
interface  IEvaluator
 Utility evaluator interface. More...
 
interface  IMeasure
 The measure interface. Note this refers to the mathematical measure https://en.wikipedia.org/wiki/Measure_(mathematics) More...
 
class  Interval
 Represents an interval of the form [a, b] or (a, b) or any combination of exclusive and inclusive end points. More...
 
class  IntervalExtensions
 T:Crystal.Interval extensions.
 
interface  IOption
 Decision related options interface. More...
 
interface  IOptionCollection
 Interface to a collection containing T:Crystal.IOptions. More...
 
interface  IPriorityQueue
 Priority queue interface. More...
 
interface  IScheduler
 AI Scheduler interface. More...
 
interface  ISelector
 Interface for Selectors. Selectors are functions that accept a vector of T:Crystal.Utilitys and return an index that corresponds to the selected T:Crystal.Utility. More...
 
interface  ITransition
 Interface to Transitions. A transition is an T:Crystal.IAction that transfers control to a behaviour or another AI. More...
 
interface  IUtilityAi
 Interface for all utility based AIs. More...
 
class  LinearEvaluator
 The LinearEvaluator returns a normalized utility value based on a linear function. Powerfor an interactive plot. More...
 
class  MaxUtilitySelector
 This selector returns the index of the T:Crystal.Utility whose P:Crystal.Utility.Combined value is highest compared to any T:Crystal.Utility in the supplied T:System.Collections.Generic.ICollection. More...
 
class  MinEqualMaxException
 Minimum equal max exception. More...
 
class  MinGreaterThanMaxException
 Minimum greater than max exception. More...
 
class  MovingAverage
 Uses a circular buffer to adaptively calculate the moving average of the contained elements. More...
 
class  MultiplicativePseudoMeasure
 Calculates a multiplicative pseudo-measure, namely, this class calculates the product of P:Crystal.Utility.Combined in T:System.Collections.ICollection. More...
 
class  Option
 Normally this option class should serve all the "option" related needs of an AI. More...
 
class  OptionCollection
 A collection of AI T:Crystal.IOptions. More...
 
class  OptionConstructor
 T:Crystal.IOption constructor convenience class.
 
class  Pcg
 PCG (Permuted Congruential Generator) is a C# port from C the base PCG generator presented in "PCG: A Family of Simple Fast Space-Efficient Statistically Good Algorithms for Random Number Generation" by Melissa E. O'Neill. The code follows closely the one made available by O'Neill at her site: http://www.pcg-random.org/download.html To understand how exactly this generator works read this: http://www.pcg-random.org/pdf/toms-oneill-pcg-family-v1.02.pdf More...
 
class  PcgExtended
 PCG (Permuted Congruential Generator) Extended is a C# port from C++ of a part of the extended PCG family of generators presented in "PCG: A Family of Simple Fast Space-Efficient Statistically Good Algorithms for Random Number Generation" by Melissa E. O'Neill. The code follows closely the one made available by O'Neill at her site: http://www.pcg-random.org/using-pcg-cpp.html To understand how exactly this generator works read this: http://www.pcg-random.org/pdf/toms-oneill-pcg-family-v1.02.pdf its a fun read, enjoy! The most important difference between this version and PCG is that the generators produced by this class can have extremely large periods (extremely!) and have configurable k-dimensional equidistribution. All this at a very small speed penalty! (Upto 1024-dimensionally equidistributed generators perform faster than System.Random, at least on the machines I have access to). Fun fact, the period of PCG Extended for _table_mask = 14 is 2^(524352) which is more than 10^(157846). To put this in context, the number particles in the known Universe is about 10^(80 to 81ish) if we also count photons that number goes up (with a lot of effort) to 10^(90ish). Now, there are estimates that say that visible matter (counting photons, energy-matter same thing...) accounts for 5% of the matter in the visible Universe, so if these estimates are correct the total visible+invisible particles/(energy particles) in the visible Universe would approximately be 10^(91). That means that this generator has a period that is 157755 orders of magnitude larger than the number of all particles in the visible Universe... Also, if the universe had an equal number of particles (to the period of PCG 14), that would mean that its mean density (at its current volume) would be so high that the entire Universe would collapse unto its weight into a black hole. More...
 
class  PcgSeed
 Random number generator seed helper class.
 
struct  Pointf
 Represents a point in 2D space. More...
 
class  PowerEvaluator
 The PowerEvaluator returns a normalized utility based on a power function that has effectively 1 parameter ( 0 leq p le 10000 ) bounded by the box defined by PtA and PtB with PtA.x being strictly less than PtB.x! Powerfor an interactive plot. More...
 
class  PriorityQueue
 Priority queue. More...
 
class  PriorityQueueNode
 Priority queue node. More...
 
class  QueuedCommand
 
class  RandomSelector
 This selector returns a random T:Crystal.Utility from the supplied T:System.Collections.ICollection. More...
 
class  ReaderWriterLockSlimExtensions
 ReaderWriterLockSlim extensions.
 
class  Scheduler
 The AI Scheduler class distributes the execution of the think and update methods of the contained AIs in time to avoid excessive lag spikes. More...
 
class  SequentialSelector
 This selector returns all indices in sequence from the given T:System.Collections.ICollection of T:Crystal.Utility. The assumption here is that every time the collection size is the same. If that is not the case, then the count is reset and starts from 0. More...
 
class  SigmoidEvaluator
 The SigmoidEvaluator returns a normalized utility based on a sigmoid function that has effectively 1 parameter ( -0.99999f leq k leq 0.99999f ) bounded by the box defined by PtA and PtB with PtA.x being strictly less than PtB.x! Parametrized Sigmoidfor an interactive plot. More...
 
class  ThreadSafePriorityQueue
 Thread safe priority queue. More...
 
struct  Utility
 This struct is used throughout Crystal AI to communicate the utility (or usefulness) of a particular option, consideration or behaviour. More...
 
class  UtilityAi
 The Utility AI. More...
 
class  UtilityExtensions
 Crystal T:Crystal.Utility extensions.
 
class  ValueTypeExtensions
 Crystal extensions for value types.
 
class  WeightedMetrics
 Calculates the l-p weighted metrics https://en.wikipedia.org/wiki/Lp_space. More...
 
class  WeightedRandomSelector
 This selector uses roulette wheel selection of the top P:Crystal.WeightedRandomSelector.Proportion percent utilities in the given T:System.Collections.ICollection of utilities. More...
 

Enumerations

enum  ActionStatus { ActionStatus.Failure = 0, ActionStatus.Success = 1, ActionStatus.Running = 2, ActionStatus.Idle = 3 }
 AI Action execution status. More...
 
enum  DecisionMakerState { DecisionMakerState.Stopped, DecisionMakerState.Running, DecisionMakerState.Paused }
 Represents the state of a T:Crystal.DecisionMakerBase More...
 
enum  IntervalType { IntervalType.Open, IntervalType.Closed }
 An interval could be open and closed or combination of both at either end. More...
 

Functions

delegate void CommandAction ()
 This delegate is used for the process in DeferredCommand More...
 

Enumeration Type Documentation

enum Crystal.ActionStatus
strong

AI Action execution status.

Enumerator
Failure 

AI Action failed to execute.

Success 

The AI Action executed successfully.

Running 

The AI Action is still running.

Idle 

The AI is... idle. This is the initial state of all actions. Actions never enter this state again after the first execution.

Represents the state of a T:Crystal.DecisionMakerBase

Enumerator
Stopped 

The associated AI is not running.

Running 

The associated AI is running.

Paused 

The associated AI is paused.

enum Crystal.IntervalType
strong

An interval could be open and closed or combination of both at either end.

Enumerator
Open 

Represents an open bound.

Closed 

Represents a closed bound.

Function Documentation

delegate void Crystal.CommandAction ( )

This delegate is used for the process in DeferredCommand