public DiscreteTimeMarkovChain(ModelCapacity modelCapacity) { var modelSize = modelCapacity.DeriveModelByteSize(_sizeOfState, _sizeOfTransition); StateLabeling = new LabelVector(); ProbabilityMatrix = new SparseDoubleMatrix(modelSize.NumberOfStates + 1, modelSize.NumberOfTransitions); // one additional row for row of initial distribution }
public MarkovDecisionProcess(ModelCapacity modelCapacity) { var modelSize = modelCapacity.DeriveModelByteSize(_sizeOfState, _sizeOfTransition); StateLabeling = new LabelVector(); var numbersOfTransitionsPerState = ((double)modelSize.NumberOfTransitions) / modelSize.NumberOfStates; var numbersOfDistributionsPerState = (long)Math.Ceiling(Math.Sqrt(numbersOfTransitionsPerState)); var numberOfDistributions = modelSize.NumberOfStates * numbersOfDistributionsPerState; RowsWithDistributions = new SparseDoubleMatrix(numberOfDistributions, modelSize.NumberOfTransitions); // need for every distribution one row StateToRowsL = new int[modelSize.NumberOfStates + 1]; // one additional row for initial distributions StateToRowsRowCount = new int[modelSize.NumberOfStates + 1]; // one additional row for initial distributions SetRowOfStateEntriesToInvalid(); }
public NestedMarkovDecisionProcess(ModelCapacity modelCapacity) { var modelSize = modelCapacity.DeriveModelByteSize(StateSize, TransitionSize); StateLabeling = new LabelVector(); States = (int)modelSize.NumberOfStates; _maxNumberOfContinuationGraphElements = modelSize.NumberOfTransitions * 10L; _maxNumberOfContinuationGraphElements = Math.Max(_maxNumberOfContinuationGraphElements, 1024); Requires.InRange(_maxNumberOfContinuationGraphElements, nameof(_maxNumberOfContinuationGraphElements), 1024, Int64.MaxValue - 1); _stateToRootOfContinuationGraphBuffer.Resize(States * sizeof(long), zeroMemory: false); _stateToRootOfContinuationGraphMemory = (long *)_stateToRootOfContinuationGraphBuffer.Pointer; _continuationGraphBuffer.Resize((long)_maxNumberOfContinuationGraphElements * sizeof(ContinuationGraphElement), zeroMemory: false); _continuationGraph = (ContinuationGraphElement *)_continuationGraphBuffer.Pointer; MemoryBuffer.SetAllBitsMemoryWithInitblk.ClearWithMinus1(_stateToRootOfContinuationGraphMemory, States); }