private void DoStep1(byte itemIndex) { StateSymbolPair from = tmInstance.CurrentStateSymbolPair; IList <StateSymbolDirectionTriple> to = delta[from]; TMInstance.MoveToNextConfiguration(to[itemIndex], tmInstance); }
public static void MoveToNextConfiguration( StateSymbolDirectionTriple to, TMInstance instance) { instance.state = to.State; switch (to.Direction) { case TMDirection.L: { instance.CurrentSymbol = to.Symbol; instance.cellIndex -= to.Shift; break; } case TMDirection.R: { instance.CurrentSymbol = to.Symbol; instance.cellIndex += to.Shift; break; } case TMDirection.S: { instance.CurrentSymbol = to.Symbol; break; } } }
public DetermStepsEmulator( Dictionary <StateSymbolPair, List <StateSymbolDirectionTriple> > delta, TMInstance tmInstance) { this.delta = delta; this.tmInstance = tmInstance; }
public override void PrepareTapeFwd(int[] input, TMInstance instance) { instance.SetTapeSymbol(0, delimiter0); instance.SetTapeSymbol(FrameStart1(input.Length), delimiter1); instance.SetTapeSymbol(FrameStart2(input.Length), delimiter2); instance.SetTapeSymbol(FrameStart3(input.Length), delimiter3); instance.SetTapeSymbol(FrameEnd4(input.Length), delimiter4); }
private void DoStep1() { StateSymbolPair from = tmInstance.CurrentStateSymbolPair; IList <StateSymbolDirectionTriple> to = delta[from]; Ensure.That(to).SizeIs(1); TMInstance.MoveToNextConfiguration(to[0], tmInstance); }
public TMInstance(TMInstance other) { owner = other.owner; Level = other.Level + 1; tape = new TapeArray(other.tape); cellIndex = other.cellIndex; state = other.state; }
public void ExtractTConsistSeq() { log.Info("MExistsAcceptingPath.Compute: path"); tapeSegContext.TapeSegTConsistPath.Remove(tapeSegContext.TapeSegTConsistPath.Last()); tapeSegContext.TapeSegTConsistPath.ForEach(s => { log.InfoFormat("node = {0}", s.ToString()); }); List <KeyValuePair <long, ComputationStep> > pathCompSteps = tapeSegContext.TapeSegTConsistPath.ConvertAll(uId => new KeyValuePair <long, ComputationStep>(uId, meapContext.TArbSeqCFG.IdToNodeInfoMap[uId].CompStep)); pathCompSteps.ForEach(s => { log.InfoFormat( "id = {0}, comp.step = {1}", s.Key.ToString(), s.Value); }); TMInstance tmInstance = new ( meapContext.MEAPSharedContext.MNP, meapContext.MEAPSharedContext.Input ); meapContext.MEAPSharedContext.MNP.PrepareTapeFwd( meapContext.MEAPSharedContext.Input, tmInstance); foreach (KeyValuePair <long, ComputationStep> compStepPair in pathCompSteps) { ComputationStep compStep = compStepPair.Value; TMInstance.MoveToNextConfiguration( new StateSymbolDirectionTriple ( state: compStep.qNext, symbol: compStep.sNext, direction: compStep.m, shift: compStep.Shift ), tmInstance); if (tmInstance.IsInFinalState()) { break; } } tapeSegContext.TapeSegOutput = meapContext.MEAPSharedContext.MNP.GetOutput( tmInstance, meapContext.mu, (uint)meapContext.MEAPSharedContext.Input.Length); }
public override void PrepareTapeFwd(int[] input, TMInstance instance) { int frameLength = FrameLength(input.Length); long frameStart1 = 1 + frameLength; long frameStart2 = 1 + (2 * frameLength); long frameStart3 = 1 + (3 * frameLength); long frameEnd4 = 1 + (4 * frameLength); instance.SetTapeSymbol(frameStart1, delimiter1); instance.SetTapeSymbol(frameStart2, delimiter2); instance.SetTapeSymbol(frameStart3, delimiter3); instance.SetTapeSymbol(frameEnd4, delimiter4); IDebugOptions debugOptions = configuration.Get<IDebugOptions>(); }
public override int[] GetOutput(TMInstance tmInstance, ulong mu, ulong n) { return(tmInstance.GetTapeSubstr(GetLTapeBound(mu, n), GetRTapeBound(mu, n))); }