/// <summary> /// Construct the object. /// </summary> public SimpleDecisionProblem(KnowledgeBase kb, CostManager cm, SensorModule sm, int MaxIterations) : base(MaxIterations) { this.kb = kb; this.costManager = cm; this.sensorModule = sm; }
private void cmdDecoderEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (grdModulesView.SelectedRowsCount <= 0) { MessageBox.Show("You must select the object you want to edit.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DataRowView rowView = grdModulesView.GetRow(grdModulesView.GetSelectedRows()[0]) as DataRowView; if (rowView == null) { return; } SensorModule decoder = this.Manager.GetByID((Int64)rowView[0]); if (decoder == null) { return; } FrmSensorEditor form = new FrmSensorEditor(this.Settings, decoder); form.ShowDialog(this); if (form.DialogResult == System.Windows.Forms.DialogResult.OK) { ListDecoders(); } }
public Cost(KnowledgeBase kb, SensorModule sm) { weights = new ArrayList(); mainWeight = new Weight(); weights.Add(mainWeight); this.sm = sm; this.kb = kb; }
// Use this for initialization void Start() { _es = gameObject.GetComponent <SensorModule>(); _h = gameObject.GetComponent <HealthModule>(); _st = gameObject.GetComponent <Stats>(); _agent = gameObject.GetComponent <MoveComponent>(); _GDB = GameObject.FindGameObjectWithTag("MainUI").GetComponent <GlobalDB>(); }
public void CleanUp() { kb = null; sm = null; weights.Clear(); weights = null; mainWeight = null; }
public SwarmOpsDecisionManager(KnowledgeBase knowledgeBase, SensorModule sensorModule) { this.knowledgeBase = knowledgeBase; this.sensorModule = sensorModule; this.costManager = new CostManager(knowledgeBase, sensorModule); this.prob = new SimpleDecisionProblem(knowledgeBase, costManager, sensorModule, MAX_OPTIMIZATION_ITERATIONS); this.opt = new DE(this.prob); Globals.Random = new RandomOps.MersenneTwister(); }
void IDecisionManager.CleanUp() { knowledgeBase = null; opt = null; prob.CleanUp(); sensorModule = null; costManager.CleanUp(); costManager = null; }
// Use this for initialization void Start() { WorldStateManager.currentAgents.Add(this); // Debug.Log ("ID = " + ID); knowledgeBase = new KnowledgeBase(this); this.sModule = new SensorModule(this); decisionManager = new SwarmOpsDecisionManager(knowledgeBase, sensorModule); flightController = new NewFlightController(this.gameObject, this.sensorModule); }
public NewFlightController(GameObject agentObject, SensorModule sensorModule) { this.agentObject = agentObject; this.sensorModule = sensorModule; if (perturbDynamicsVel) { MAX_VELOCITY += (float)(rand.NextDouble() - .5) * perturbStdVel; } if (perturbDynamicsAcc) { acclScale += (float)(rand.NextDouble() - .5) * perturbStdAcc * Vector3.one; } }
void Start() { _st = gameObject.GetComponent <Stats> (); _es = gameObject.GetComponent <SensorModule> (); _GDB = GameObject.FindGameObjectWithTag("MainUI").GetComponent <GlobalDB>(); _AS = gameObject.GetComponent <ActiveState> (); _agent = gameObject.GetComponent <MoveComponent> (); Reaction = Random.Range(3, 5); if (!_st.miner) { BattleShip = true; } }
public CostManager(KnowledgeBase knowledgeBase, SensorModule sm) { ArrayList desiredCosts = new ArrayList(); constraints = new ArrayList(); System.Object[] args = new System.Object[] { (System.Object)knowledgeBase, (System.Object)sm }; int weightIndex = 0; foreach (System.Type costType in WorldStateManager.GetListOfCostsToUse()) { // Debug.Log("Cost: " + costType.ToString()); if (costType.ToString() == "CollisionCost") { // Hack collisions are constraints not costs. Debug.Log("Adding collision constraint!!" + costType.ToString()); Cost collisionConstraint = new CollisionCost(knowledgeBase, sm); int numConstraintWeights = (int)CollisionCost.GetNumberWeights(); ArrayList localConstraintWeights = collisionConstraint.GetAllWeights(); for (int i = 0; i < numConstraintWeights; i++) { ((Weight)localConstraintWeights [i]).weightValue = TrialRunner.GetSingletonInstance().GetTrialWeightValueAt(weightIndex++); } collisionConstraint.GetAllWeights(); constraints.Add(collisionConstraint); } else { Cost c = (Cost)System.Activator.CreateInstance(costType, args); c.SetName(costType.ToString()); desiredCosts.Add(c); //Get the weights to test from the trial runner and set them // TODO: make this much better coded int numWeights = (int)costType.GetMethod("GetNumberWeights", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public).Invoke(null, null); // Debug.Log(numWeights); ArrayList localWeights = c.GetAllWeights(); for (int i = 0; i < numWeights; i++) { ((Weight)localWeights [i]).weightValue = TrialRunner.GetSingletonInstance().GetTrialWeightValueAt(weightIndex++); } } } costs = desiredCosts; }
// Use this for initialization void Start() { ShildModel = gameObject.GetComponentInChildren <Forcefield>().gameObject; ProtectPosition = new Vector2[12]; radius = new List <float>(); _GDB = GameObject.FindGameObjectWithTag("MainUI").GetComponent <GlobalDB>(); _es = gameObject.GetComponent <SensorModule>(); if (Ship) { _st = gameObject.GetComponent <Stats>(); _as = gameObject.GetComponent <ActiveState>(); } if (Station) { _sb = gameObject.GetComponent <Station>(); } timer = Random.Range(0.01f, 10); }
// Use this for initialization void Awake() { _sbsm = gameObject.GetComponent <SensorModule>(); _sbotv = gameObject.GetComponent <ObjectTypeVisible>(); GameObject SenObj = Instantiate(SensorsLine, gameObject.transform.position, gameObject.transform.rotation); SensorsLine = SenObj; _scr = SenObj.GetComponent <CircleRenderer>(); _sespa = SenObj.GetComponent <EnterSelectPlaneActive>(); GameObject WepObj = Instantiate(WeaponLine, gameObject.transform.position, gameObject.transform.rotation); WeaponLine = WepObj; _wcr = WepObj.GetComponent <CircleRenderer>(); _wespa = WepObj.GetComponent <EnterSelectPlaneActive>(); _sespa.Owner = gameObject; _wespa.Owner = gameObject; }
// Use this for initialization void Awake() { if (gameObject.GetComponent <ObjectTypeVisible>()) { _otv = gameObject.GetComponent <ObjectTypeVisible>(); } _HP = gameObject.GetComponent <HealthModule>(); if (!NonPhysicalMovement) { _agent = gameObject.GetComponent <MoveComponent>(); } GameObject SenObj = Instantiate(SensorsLine, gameObject.transform.position, gameObject.transform.rotation); SensorsLine = SenObj; _scr = SenObj.GetComponent <CircleRenderer>(); _sespa = SenObj.GetComponent <EnterSelectPlaneActive>(); GameObject WepObj = Instantiate(WeaponLine, gameObject.transform.position, gameObject.transform.rotation); WeaponLine = WepObj; _wcr = WepObj.GetComponent <CircleRenderer>(); _wespa = WepObj.GetComponent <EnterSelectPlaneActive>(); _sespa.Owner = gameObject; _wespa.Owner = gameObject; _es = gameObject.GetComponent <SensorModule>(); if (StartLocation == null) { targetVector = transform.position; } else { _agent.Movement(StartLocation.transform.position); } }
public void CleanUp() { if (flightController != null) { flightController.CleanUp(); } if (knowledgeBase != null) { knowledgeBase.CleanUp(); } if (sModule != null) { sModule.CleanUp(); } if (decisionManager != null) { decisionManager.CleanUp(); } flightController = null; knowledgeBase = null; sModule = null; decisionManager = null; }
public CollisionCost(KnowledgeBase kb, SensorModule sm) : base(kb, sm) { }
public AltitudeCost(KnowledgeBase kb, SensorModule sm) : base(kb, sm) { }
public void CleanUp() { costManager = null; sensorModule = null; kb = null; }
public SimpleDecisionManager(KnowledgeBase knowledgeBase, SensorModule sensorModule) { this.knowledgeBase = knowledgeBase; this.sensorModule = sensorModule; this.costManager = new CostManager(knowledgeBase, sensorModule); }
public TileDestinationCost(KnowledgeBase kb, SensorModule sm) : base(kb, sm) { }
public NearnessCost(KnowledgeBase kb, SensorModule sm) : base(kb, sm) { fadingFactor = new Weight(); weights.Add(fadingFactor); }
public void CleanUp() { agentObject = null; sensorModule = null; }
// Use this for initialization void Start() { _sb = gameObject.GetComponent <Station>(); _sm = gameObject.GetComponent <SensorModule>(); }
public BatteryLifeCost(KnowledgeBase kb, SensorModule sm) : base(kb, sm) { }