public NeuralNetwork(int inputSize, int[] neurons, double[] weightsLimits, TransitionFunction tf, bool useBias) { AbstractNeuralLayer[] layers = new AbstractNeuralLayer[neurons.Length]; for (int i = 0; i < neurons.Length; i++) { layers[i] = new NeuralLayer(inputSize, neurons[i], true, weightsLimits, tf, useBias); inputSize = neurons[i]; } this.layers = layers; }
public void EnableTransition(float duration, TransitionFunction function) { if (!this.open) { this.open = true; if (this.isActiveMount) { CameraFX.TransitionNow(duration, function); } } }
public static void TransitionNow(float duration, TransitionFunction function) { if (duration <= 0f) { g_trans.end = g_trans.start = float.NegativeInfinity; } else { g_trans.Set(duration, function); } }
public void GetStateTest() { var q = new States(3); var tf = new TransitionFunction() { new Transition(q[0], '1', q[1]), new Transition(q[1], '1', q[2]), new Transition(q[2], '1', q[0]) }; Assert.AreEqual(tf[q[0], '1'].Q, q[1]); Assert.AreEqual(tf[q[1], '1'].Q, q[2]); Assert.AreEqual(tf[q[2], '1'].Q, q[0]); }
private IEnumerator PlayInTransition(TransitionFunction <float> transition, float time, Action <float> changeTransparency, Runnable endFunction = null) { for (float value = 0; value <= time; value += Time.fixedDeltaTime) { var newTransparency = transition(value, 0, 1, logoFadeInTime); changeTransparency?.Invoke(newTransparency); yield return(new WaitForFixedUpdate()); } changeTransparency?.Invoke(1f); endFunction?.Invoke(); }
public static void TransitionNow(float duration, TransitionFunction function) { if (duration > 0f) { CameraFX.g_trans.Set(duration, function); } else { float single = Single.NegativeInfinity; float single1 = single; CameraFX.g_trans.start = single; CameraFX.g_trans.end = single1; } }
public NeuralLayer(int inputSize, int neuronsSize, bool randomWeights, double[] randomWeightsLimits, TransitionFunction tf, bool useBias) { neurons = new Neuron[neuronsSize]; for (int j = 0; j < neuronsSize; j++) { double[] weights = new double[inputSize]; neurons[j] = new Neuron(weights, 0, tf); if (randomWeights) { neurons[j].RandomFill(randomWeightsLimits, useBias); } } }
public void EnableTransitionSpeed(float metersPerSecond, TransitionFunction function) { if (!this.open) { Vector3 vector; this.open = true; if (this.isActiveMount && MountedCamera.GetPoint(out vector)) { float num = Vector3.Distance(this.camera.worldToCameraMatrix.MultiplyPoint(Vector3.zero), vector); if (num != 0f) { CameraFX.TransitionNow(num / metersPerSecond, function); } } } }
public override bool IsDeterministic(bool verbose = false) { //return false if either: a) any state has multiple transitions on a single symbol //b) any state has < |Σ| transitions (then either it's missing a transition..or more, by the pigeonhole principle - then we've got a)) //c) any epsilon moves if (TransitionFunction.Any(s => s.Value.Count > 1)) { if (verbose) { Console.WriteLine("Not deterministic - multiple states per (State, Symbol)!"); } return(false); } if (TransitionFunction.Any(s => s.Key.Symbol == Symbols.Epsilon)) { if (verbose) { Console.WriteLine("Not deterministic - has epsilon moves!"); } return(false); } if (TransitionFunction.Keys.Count != (States.Count * Alphabet.Count)) { if (verbose) { Console.WriteLine("Not deterministic - not enough transitions!"); } return(false); } //we can assume that the transition function is valid (no invalid states/symbols), so next we just need to check that every (state, symbol) pair is represented foreach (var transition in TransitionFunction.Keys.GroupBy(k => k.State)) { if (transition.Select(s => s.Symbol).Count() != Alphabet.Count) { if (verbose) { Console.WriteLine("Alphabet has {0} symbols, but found {1} symbols to transition on!", Alphabet.Count, transition.Select(s => s.Symbol).Count()); } return(false); } } return(true); }
private void linkLabel7_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (listBox7.SelectedIndex >= 0 && listBox8.SelectedIndex >= 0 && comboBox1.SelectedIndex >= 0) { try { var newTransFunc = new TransitionFunction(new State(listBox7.SelectedItem.ToString()), new State(listBox8.SelectedItem.ToString()), Convert.ToChar(comboBox1.SelectedItem.ToString())); listBox9.Items.Add(newTransFunc); Transitions.Add(newTransFunc); } catch (Exception exception) { ConsoleWriter.Failure(exception.Message); } } }
public void EnableTransitionSpeed(float metersPerSecond, TransitionFunction function) { Vector3 vector3; if (!this.open) { this.open = true; if (this.isActiveMount && MountedCamera.GetPoint(out vector3)) { Matrix4x4 matrix4x4 = this.camera.worldToCameraMatrix; float single = Vector3.Distance(matrix4x4.MultiplyPoint(Vector3.zero), vector3); if (single != 0f) { CameraFX.TransitionNow(single / metersPerSecond, function); } } } }
private IEnumerator PlayTransitionCoroutine <T>(TransitionFunction <T> transition, float time, T startValue, T targetValue, Action <T> ApplyTransition, Supplier <bool> exitPredicate) { if (ApplyTransition == null) { yield break; } for (float value = 0; value <= time; value += Time.fixedDeltaTime) { if (exitPredicate != null && exitPredicate()) { yield break; } var intermediateValue = transition(value, startValue, targetValue, time); ApplyTransition(intermediateValue); yield return(new WaitForFixedUpdate()); } ApplyTransition(transition(time, startValue, targetValue, time)); }
public HashSet <State> GetStatesAccessibleWithAnyInput(State state) { HashSet <State> states = new HashSet <State>(); //first add any epsilon states (this is recursive) states.UnionWith(GetStatesAccessibleFrom(state, Symbols.Epsilon)); var allTransitions = TransitionFunction.Where((k, v) => k.Key.State == state); if (allTransitions.Count() == 0) { return(states); } else { foreach (HashSet <State> accessibleStates in allTransitions.Select((k, v) => k.Value)) { states.UnionWith(accessibleStates); } } return(states); }
public static Vector4 Evaluate(this TransitionFunction f, float t, Vector4 a, Vector4 b) { switch (f) { case TransitionFunction.Linear: return(Linear(t, a, b)); case TransitionFunction.Round: return(Round(t, a, b)); case TransitionFunction.Floor: return(Floor(t, a, b)); case TransitionFunction.Ceil: return(Ceil(t, a, b)); case TransitionFunction.Spline: return(Spline(t, a, b)); } throw new ArgumentOutOfRangeException("v", "Attempted use of unrecognized TransitionFunction enum value"); }
public void EvenZeroesTest() { var q = new States(2); var f = new AcceptingStates(q[0]); var tf = new TransitionFunction() { new Transition(q[0], '1', q[0]), new Transition(q[0], '0', q[1]), new Transition(q[1], '0', q[0]), new Transition(q[1], '1', q[1]) }; var m = new FiniteAutomaton(q, Alphabet.Binary, tf, q[0], f); Assert.True(m.Run("1111")); Assert.True(m.Run("1100")); Assert.True(m.Run("10101")); Assert.True(m.Run("00")); Assert.True(m.Run("10111111110")); Assert.False(m.Run("101")); Assert.False(m.Run("000")); Assert.False(m.Run("11111011111")); }
public static Matrix4x4G Evaluate(this TransitionFunction <Matrix4x4G> v, double t) { return(v.f.Evaluate(t, v.a, v.b)); }
public static double Evaluate(this TransitionFunction <double> v, float t) { return(v.f.Evaluate(t, v.a, v.b)); }
public CSSPrimitiveValue(TransitionFunction transition) : this(UnitType.Transition, transition) { }
private void Init(double[] weights, double bias, TransitionFunction function) { Bias = bias; Weights = weights; TransitionFunction = function; }
protected bool Equals(TransitionFunction other) { return(m_inputstate.Name == other.m_inputstate.Name && m_outputstate.Name == other.m_outputstate.Name && m_inputsymbol == other.m_inputsymbol); }
public static Vector4 Evaluate(this TransitionFunction <Vector4> v, float t) { return(v.f.Evaluate(t, v.a, v.b)); }
public static Quaternion Evaluate(this TransitionFunction <Quaternion> v, float t) { return(v.f.Evaluate(t, v.a, v.b)); }
public static Matrix4x4 Evaluate(this TransitionFunction <Matrix4x4> v, float t) { return(v.f.Evaluate(t, v.a, v.b)); }
public static Color Evaluate(this TransitionFunction <Color> v, float t) { return(v.f.Evaluate(t, v.a, v.b)); }
public static float Evaluate(this TransitionFunction <float> v, float t) { return(v.f.Evaluate(t, v.a, v.b)); }
protected bool Equals(TransitionFunction other) { return m_inputstate.Name == other.m_inputstate.Name && m_outputstate.Name == other.m_outputstate.Name && m_inputsymbol == other.m_inputsymbol; }
public static float Evaluate(this TransitionFunction f, float t) { return(f.Evaluate(t, ((float)0f), ((float)1f))); }
public void Set(float duration, TransitionFunction func) { this.start = CameraFX.CameraTransitionData.timeSource; this.lastTime = this.start; this.end = this.start + duration; this.view = this.lastView; this.proj = this.lastProj; this.func = func; }
public static double Evaluate(this TransitionFunction f, double t) { return(f.Evaluate(t, ((double)0.0), ((double)1.0))); }
public TransitionFunctionTest() { function = new TransitionFunction <int, int>((state, action) => state / action); }
public Neuron(double[] weights, double bias, TransitionFunction function) { Init(weights, bias, function); }
public static QuaternionG Evaluate(this TransitionFunction <QuaternionG> v, double t) { return(v.f.Evaluate(t, v.a, v.b)); }
public void PlayTransition <T>(TransitionFunction <T> transition, float time, T startValue, T targetValue, Action <T> ApplyTransition, Supplier <bool> exitPredicate = null) { StartCoroutine(PlayTransitionCoroutine <T>(transition, time, startValue, targetValue, ApplyTransition, exitPredicate)); }
public static Vector3G Evaluate(this TransitionFunction <Vector3G> v, double t) { return(v.f.Evaluate(t, v.a, v.b)); }
public IAsyncStateConfiguration <TSpecificState, TMachineState, TMachineEvent, TGeneratedEvent> TransitionWithEvent <TSpecificEvent>(TransitionFunction <TSpecificState, TSpecificEvent, TMachineState, TGeneratedEvent> transitionFunction) where TSpecificEvent : TMachineEvent { this.dispatch.AddEntry(new SimpleDispatchEntry <TransitionFunction <TMachineState, TMachineEvent, TMachineState, TGeneratedEvent> >( typeof(TSpecificEvent), (TMachineState s, TMachineEvent e) => { var specificState = (TSpecificState)s; return(transitionFunction(specificState, (TSpecificEvent)e)); })); return(this); }