internal McmcSim( EstimationDesign estimationDesign, Simulation simulation, ISimData simData, Arr <ChainState> chainStates ) { RequireNotNull(estimationDesign); RequireNotNull(simulation); RequireNotNull(simData); RequireTrue(chainStates.IsEmpty || chainStates.Count == estimationDesign.Chains); _estimationDesign = estimationDesign; _simulation = simulation; _simData = simData; ChainStates = chainStates; _proposalLoopWaitInterval = _simData .GetExecutionInterval(_simulation) .Match(t => t.ms * 2, 200); _updateBatchThreshold = 2 * estimationDesign.Chains; _defaultInput = simulation.SimConfig.SimInput; var parameters = _defaultInput.SimParameters; _invariants = _estimationDesign.Priors .Filter(mp => mp.Distribution.DistributionType == DistributionType.Invariant) .Map(mp => parameters.GetParameter(mp.Name).With(mp.Distribution.Mean)); _targetParameters = _estimationDesign.Priors .Filter(mp => mp.Distribution.DistributionType != DistributionType.Invariant) .Map(mp => parameters.GetParameter(mp.Name)); }
public static void appendNotify(ISimData[] array, ISimData target) { for (int i = 0; i < array.Length; ++i) { if (array[i] == null) { array[i] = target; return; } } Debug.Log("not enough space for notify."); }
void surroundingCheck(Vector3 pos, InserterData inserterData, Inserter inserter) { // inserter check // generator to belt // belt to storage // generator to storage // assembler to storage // generator to assembler // get inserter's surrounding Vector3[] offsets = new Vector3[4] { Vector3.left, Vector3.right, Vector3.forward, Vector3.back }; RaycastHit hit; ISimData[] adjacentTypes = new ISimData[4]; for (int i = 0; i < 4; ++i) { if (Physics.Raycast(pos + offsets[i] + Vector3.up * 2f, Vector3.down, out hit, 2f, LayerMask.GetMask("Default"))) { ISimView simData = hit.collider.GetComponent <ISimView>(); adjacentTypes[i] = simData.getTarget(); } } for (int i = 0; i < 4; ++i) { ProducerData generator = adjacentTypes[i] as ProducerData; if (generator != null) { BeltData belt = adjacentTypes[(i + 2) % 4] as BeltData; if (belt != null) { } inserterData.expectedItemId = generator.itemId; inserterData.source = generator; inserterData.target = belt; inserterData.targetPos = 0f; inserterData.source = (ISimData)generator; inserterData.target = (ISimData)belt; inserterData.targetPos = 0f; inserter.head = generator.ToString(); if (belt != null) { inserter.head = belt.ToString(); } } } }
public void addNotify(ISimData target, float relativePos) { //SimDataUtility.appendNotify(notifyArray, target); bool added = false; for (int i = 0; i < notifyArray.Length; ++i) { if (notifyArray[i] == null) { notifyArray[i] = target; notifyPositions[i] = relativePos; added = true; break; } } if (added == false) { Debug.Log("not enough space for notify."); } }
public void addNotify(ISimData target, float relativePos) { }
public static void addInserterToBelt(ISimData belt, ISimData inserter, float relativePos) { belt.addNotify(inserter, relativePos); inserter.addNotify(belt, 0f); }
public void addNotify(ISimData target, float relativePos) { SimDataUtility.appendNotify(notifyArray, target); }
public static void addPair(ISimData v0, ISimData v1) { v0.addNotify(v1, 0f); v1.addNotify(v0, 0f); }
public void addNotify(ISimData target) { SimDataUtility.appendNotify(notifyArray, target); }