All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.cschen1205.navigator.minefield.MineFieldSimulatorQLambda Maven / Gradle / Ivy

package com.github.cschen1205.navigator.minefield;

import com.github.cschen1205.falcon.FalconConfig;
import com.github.cschen1205.navigator.minefield.agents.FalconNavAgent;
import com.github.cschen1205.navigator.minefield.agents.TDFalconNavAgent;

/**
 * Created by cschen1205 on 10/1/2015 0001.
 */
public class MineFieldSimulatorQLambda extends MineFieldSimulator {

    public MineFieldSimulatorQLambda(MineFieldSimulatorConfig config, FalconConfig falconConfig){
        super(config, falconConfig);
    }

    @Override
    protected FalconNavAgent createAgent(int agentId){
        int numSonarInput = config.numSonarInput;
        int numAVSonarInput = config.numAVSonarInput;
        int numBearingInput = config.numBearingInput;
        int numRangeInput = config.numRangeInput;

        TDFalconNavAgent newAgent = new TDFalconNavAgent(falconConfig, agentId, numSonarInput, numAVSonarInput, numBearingInput, numRangeInput);
        newAgent.useImmediateRewardAsQ = false;
        newAgent.enableEligibilityTrace();

        if(config.isImmediateRewardProvided()){
            newAgent.setQGamma(0.5);
        } else {
            newAgent.setQGamma(0.9);
        }

        return newAgent;
    }

    public static void main(String[] args){
        MineFieldSimulatorConfig config = new MineFieldSimulatorConfig();
        config.setImmediateRewardProvided(false);
        config.setNumAgents(1);

        FalconConfig falconConfig = new FalconConfig();
        falconConfig.numAction = FalconNavAgent.numAction;
        falconConfig.numState = config.numState();
        falconConfig.numReward = 2;

        MineFieldSimulatorQLambda simulator = new MineFieldSimulatorQLambda(config, falconConfig);
        simulator.runSims();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy