public World(DeepQLearn brain, int canvas_Width, int canvas_Height) { this.agents = new List <Agent>(); this.W = canvas_Width; this.H = canvas_Height; this.util = new Util(); this.clock = 0; // set up walls in the world this.walls = new List <Wall>(); var pad = 10; util_add_box(this.walls, pad, pad, this.W - pad * 2, this.H - pad * 2); util_add_box(this.walls, 100, 100, 200, 300); // inner walls this.walls.RemoveAt(walls.Count - 1); util_add_box(this.walls, 400, 100, 200, 300); this.walls.RemoveAt(walls.Count - 1); // set up food and poison this.items = new List <Item>(); for (var k = 0; k < 30; k++) { var x = util.randf(20, this.W - 20); var y = util.randf(20, this.H - 20); var t = util.randi(1, 3); // food or poison (1 and 2) var it = new Item(x, y, t); this.items.Add(it); } // set up food and poison this.agents = new List <Agent>(); this.agents.Add(new Agent(brain)); }
public Agent(DeepQLearn brain) { this.brain = brain; // positional information this.p = new Vec(50, 50); this.op = this.p; // old position this.angle = 0; // direction facing this.actions = new List <double[]>(); this.actions.Add(new double[] { 1, 1 }); this.actions.Add(new double[] { 0.8, 1 }); this.actions.Add(new double[] { 1, 0.8 }); this.actions.Add(new double[] { 0.5, 0 }); this.actions.Add(new double[] { 0, 0.5 }); // properties this.rad = 10; this.eyes = new List <Eye>(); for (var k = 0; k < 9; k++) { this.eyes.Add(new Eye((k - 3) * 0.25)); } this.reward_bonus = 0.0; this.digestion_signal = 0.0; // outputs on world this.rot1 = 0.0; // rotation speed of 1st wheel this.rot2 = 0.0; // rotation speed of 2nd wheel this.prevactionix = -1; }
public World(DeepQLearn brain, int canvas_Width, int canvas_Height, int num_items, bool random, bool obstruct, bool infinite) { this.agents = new List <Agent>(); this.W = canvas_Width; this.H = canvas_Height; this.num_items = num_items; this.util = new Util(); this.clock = 0; // set up walls in the world this.walls = new List <Wall>(); var pad = 10; //outer walls util_add_box(this.walls, pad, pad, this.W - pad * 2, this.H - pad * 2); // inner walls if (obstruct) { util_add_box(this.walls, 100, 100, 200, 300); this.walls.RemoveAt(walls.Count - 1); util_add_box(this.walls, 400, 100, 200, 300); this.walls.RemoveAt(walls.Count - 1); } // set up food/fail and poison/pass test cases this.items = new List <Item>(); for (var k = 0; k < num_items; k++) { double x = 0, y = 0; int t = 0; if (random) { // define random based objects x = util.randf(20, this.W - 20); y = util.randf(20, this.H - 20); t = util.randi(1, 3); // food/fail or poison/pass (1 and 2) } else { // define policy based objects x = (this.W / 35) * (k + 1) + ((k % 2 == 0) ? 50 : -50); y = (this.H / 35) * (k + 1); t = (k % 2 == 0) ? 1 : 2; // food/fail or poison/pass (1 and 2) } // add objects to environment var it = new Item(x, y, t); this.items.Add(it); } // set up food and poison this.agents = new List <Agent>(); this.agents.Add(new Agent(brain)); }
public Agent(DeepQLearn brain) { this.brain = brain; // positional information //this.position = new Vec(50, 50); //this.oldPosition = this.position; // old position this.angle = 0; // direction facing this.actions = new List <int>(); this.actions.Add(SuperHexagon.STOP); this.actions.Add(SuperHexagon.CLOCKWISE); this.actions.Add(SuperHexagon.COUNTERCLOCKWISE); //this.actions.Add(new double[] { 1, 1 }); //this.actions.Add(new double[] { 0.8, 1 }); //this.actions.Add(new double[] { 1, 0.8 }); //this.actions.Add(new double[] { 0.5, 0 }); //this.actions.Add(new double[] { 0, 0.5 }); // properties this.rad = 10; this.eyes = new List <Eye>(); //for (var k = 0; k < 9; k++) { this.eyes.Add(new Eye((k - 3) * 0.25)); } for (int k = 0; k < 6 /*maxSlots*/; k++) { this.eyes.Add(new Eye(k)); } this.reward_bonus = 0.0; this.digestion_signal = 0.0; //// outputs on world //this.rot1 = 0.0; // rotation speed of 1st wheel //this.rot2 = 0.0; // rotation speed of 2nd wheel this.prevactionix = -1; }
public QAgent(DeepQLearn brain, int canvas_W, int canvas_H) { this.w = new World(brain, canvas_W, canvas_H); }
//[NonSerialized] //Pen greenPen = new Pen(Color.LightGreen, 2); //[NonSerialized] //Pen redPen = new Pen(Color.Red, 2); //[NonSerialized] //Pen greenPen2 = new Pen(Color.LightGreen, 1); //[NonSerialized] //Pen redPen2 = new Pen(Color.Red, 1); //[NonSerialized] //Pen bluePen = new Pen(Color.Blue, 2); //[NonSerialized] //Pen blackPen = new Pen(Color.Black); public QAgent(DeepQLearn brain /*, int canvas_W, int canvas_H*/) { this.w = new World(brain /*, canvas_W, canvas_H*/); }
public QAgent(DeepQLearn brain, int canvas_W, int canvas_H, int num_items, bool random, bool obstruct, bool infinite) { this.random = random; this.infinite = infinite; this.w = new World(brain, canvas_W, canvas_H, num_items, random, obstruct, infinite); }