public LtmdpToNmdpTests(ITestOutputHelper output) { Output = new TestTraceOutput(output); _transitionBuffer.Resize(TransitionCapacity * sizeof(LtmdpTransition), zeroMemory: false); _transitions = (LtmdpTransition *)_transitionBuffer.Pointer; _stepGraph = new LtmdpStepGraph(); _choiceResolver = new LtmdpChoiceResolver(_stepGraph); }
public LtmdpTestBuilder() { _transitionBuffer.Resize(TransitionCapacity * sizeof(LtmdpTransition), zeroMemory: false); _transitions = (LtmdpTransition *)_transitionBuffer.Pointer; StepGraph = new LtmdpStepGraph(); _choiceResolver = new LtmdpChoiceResolver(StepGraph, true); Ltmdp = new LabeledTransitionMarkovDecisionProcess(StateCapacity, TransitionCapacity); LtmdpBuilder = new LabeledTransitionMarkovDecisionProcess.LtmdpBuilderDuringTraversal(Ltmdp); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="temporalStateStorage">A storage where temporal states can be saved to.</param> /// <param name="capacity">The maximum number of successors that can be cached.</param> /// <param name="formulas">The formulas that should be checked for all successor states.</param> public LtmdpCachedLabeledStates(TemporaryStateStorage temporalStateStorage, long capacity, LtmdpStepGraph ltmdpStepGraph, params Func <bool>[] formulas) { Requires.NotNull(temporalStateStorage, nameof(temporalStateStorage)); Requires.NotNull(formulas, nameof(formulas)); Requires.That(formulas.Length < 32, "At most 32 formulas are supported."); Requires.That(capacity <= (1 << 30), nameof(capacity), $"Maximum supported capacity is {1 << 30}."); _temporalStateStorage = temporalStateStorage; _formulas = formulas; _capacity = capacity; LtmdpStepGraph = ltmdpStepGraph; _transitionsWithContinuationIdBuffer.Resize(capacity * sizeof(LtmdpTransition), zeroMemory: false); _transitionsWithContinuationIdMemory = (LtmdpTransition *)_transitionsWithContinuationIdBuffer.Pointer; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="model">The model the successors are computed for.</param> /// <param name="capacity">The maximum number of successors that can be cached.</param> /// <param name="formulas">The formulas that should be checked for all successor states.</param> public LtmdpCachedLabeledStates(ExecutableModel <TExecutableModel> model, long capacity, LtmdpStepGraph ltmdpStepGraph, params Func <bool>[] formulas) { Requires.NotNull(model, nameof(model)); Requires.NotNull(formulas, nameof(formulas)); Requires.That(formulas.Length < 32, "At most 32 formulas are supported."); Requires.That(capacity <= (1 << 30), nameof(capacity), $"Maximum supported capacity is {1 << 30}."); _stateVectorSize = model.StateVectorSize; _formulas = formulas; _capacity = capacity; LtmdpStepGraph = ltmdpStepGraph; _transitionsWithContinuationIdBuffer.Resize(capacity * sizeof(LtmdpTransition), zeroMemory: false); _transitionsWithContinuationIdMemory = (LtmdpTransition *)_transitionsWithContinuationIdBuffer.Pointer; _targetStateBuffer.Resize(capacity * model.StateVectorSize, zeroMemory: true); _targetStateMemory = _targetStateBuffer.Pointer; }
private void CheckIfTransitionIsValid(LtmdpTransition *transition) { Assert.That(TransitionFlags.IsValid(transition->Flags), "Attempted to add an invalid transition."); }