Ejemplo n.º 1
0
 /// <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;
 }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
 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>();
 }
Ejemplo n.º 5
0
 public void CleanUp()
 {
     kb = null;
     sm = null;
     weights.Clear();
     weights    = null;
     mainWeight = null;
 }
Ejemplo n.º 6
0
 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();
 }
Ejemplo n.º 7
0
 void IDecisionManager.CleanUp()
 {
     knowledgeBase = null;
     opt           = null;
     prob.CleanUp();
     sensorModule = null;
     costManager.CleanUp();
     costManager = null;
 }
Ejemplo n.º 8
0
    // 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);
    }
Ejemplo n.º 9
0
 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;
     }
 }
Ejemplo n.º 10
0
    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;
        }
    }
Ejemplo n.º 11
0
    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);
    }
Ejemplo n.º 13
0
    // 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;
    }
Ejemplo n.º 14
0
    // 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);
        }
    }
Ejemplo n.º 15
0
 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;
 }
Ejemplo n.º 16
0
 public CollisionCost(KnowledgeBase kb, SensorModule sm) : base(kb, sm)
 {
 }
Ejemplo n.º 17
0
 public AltitudeCost(KnowledgeBase kb, SensorModule sm) : base(kb, sm)
 {
 }
Ejemplo n.º 18
0
 public void CleanUp()
 {
     costManager  = null;
     sensorModule = null;
     kb           = null;
 }
Ejemplo n.º 19
0
 public SimpleDecisionManager(KnowledgeBase knowledgeBase, SensorModule sensorModule)
 {
     this.knowledgeBase = knowledgeBase;
     this.sensorModule  = sensorModule;
     this.costManager   = new CostManager(knowledgeBase, sensorModule);
 }
Ejemplo n.º 20
0
 public TileDestinationCost(KnowledgeBase kb, SensorModule sm) : base(kb, sm)
 {
 }
Ejemplo n.º 21
0
 public NearnessCost(KnowledgeBase kb, SensorModule sm) : base(kb, sm)
 {
     fadingFactor = new Weight();
     weights.Add(fadingFactor);
 }
Ejemplo n.º 22
0
 public void CleanUp()
 {
     agentObject  = null;
     sensorModule = null;
 }
 // Use this for initialization
 void Start()
 {
     _sb = gameObject.GetComponent <Station>();
     _sm = gameObject.GetComponent <SensorModule>();
 }
Ejemplo n.º 24
0
 public BatteryLifeCost(KnowledgeBase kb, SensorModule sm) : base(kb, sm)
 {
 }