This question is with reference to C#'s Lunar Lander Example obtained in Encog repository. As the example suggests, I am using NeuralSimulatedAnnealing to train my multi-layer feedforward network (50 epoch's)
BasicNetwork network = CreateNetwork();
IMLTrain train;
train = new NeuralSimulatedAnnealing(network, new PilotScore(), 10, 2, 100);
_
public static BasicNetwork CreateNetwork() {
var pattern = new FeedForwardPattern {InputNeurons = 3};
pattern.AddHiddenLayer(50);
pattern.OutputNeurons = 1;
pattern.ActivationFunction = new ActivationTANH();
var network = (BasicNetwork) pattern.Generate();
network.Reset();
return network;
}
The example works great and neural pilot exactly learns how to land the spaceship in given conditions, however I want something more out of it!
To do that I created a class globals such as below and also modified a line in LanderSimulator class
namespace Encog.Examples.Lunar
{
class globals
{
public static int fuelConsumption { get; set; }
}
}
_
public void Turn(bool thrust){
Seconds++;
Velocity -= Gravity;
Altitude += Velocity;
if (thrust && Fuel > 0)
{
Fuel-= globals.fuelConsumption; //changed instead of Fuel--;
Velocity += Thrust;
}
Velocity = Math.Max(-TerminalVelocity, Velocity);
Velocity = Math.Min(TerminalVelocity, Velocity);
if (Altitude < 0)
Altitude = 0;
}
So now depending upon the fuelConsumption variable the fuel is consumed on each thrust. Then I tried with three different values of fuelConsumption and following were the respective best scores for individual networks:
//NETWORK 1
globals.fuelConsumption = 1;
bestScore: 7986
//NETWORK 2
globals.fuelConsumption = 5;
bestScore: 7422
//NETWORK 3
globals.fuelConsumption = 10;
bestScore: 6921
When I tested these networks on each other the results were disappointing:
- network 1 showed score of -39591 and -39661 when fuelConsumed was 5 and 10 respectively.
- network 2 showed score of -8832 and -35671 when fuelConsumed was 1 and 10 respectively.
- network 3 showed score of -24510 and -19697 when fuelConsumed was 1 and 5 respectively.
So I tried to train one single network for all three scenarios like below:
int epoch;
epoch = 1;
globals.fuelConsumption = 1;
for (int i = 0; i < 50; i++){
train.Iteration();
Console.WriteLine(@"Epoch #" + epoch + @" Score:" + train.Error);
epoch++;
}
Console.WriteLine("--------------------------------------");
epoch = 1;
globals.fuelConsumption = 5;
for (int i = 0; i < 50; i++){
train.Iteration();
Console.WriteLine(@"Epoch #" + epoch + @" Score:" + train.Error);
epoch++;
}
Console.WriteLine("--------------------------------------");
epoch = 1;
globals.fuelConsumption = 10;
for (int i = 0; i < 50; i++){
train.Iteration();
Console.WriteLine(@"Epoch #" + epoch + @" Score:" + train.Error);
epoch++;
}
Console.WriteLine(@"The score of experienced pilot is:");
network = (BasicNetwork) train.Method;
var pilot = new NeuralPilot(network, false);
globals.fuelConsumption = 1;
Console.WriteLine("@1: " + pilot.ScorePilot());
globals.fuelConsumption = 5;
Console.WriteLine("@5: " + pilot.ScorePilot());
globals.fuelConsumption = 10;
Console.WriteLine("@10: " + pilot.ScorePilot());
But results are again the same
The score of experienced pilot is:
@1: -27485
@5: -27565
@10: 7448
How do I create a neural pilot that would deliver me the best score in all three scenarios?