Example #1
0
 /// <inheritdoc />
 /// <summary>
 ///     Creates the maze navigation world, omitting the maze niche grid, maximum distance to the target (required for
 ///     fitness-based evaluations), and number of bridging applications.
 /// </summary>
 /// <param name="walls">The walls in the maze environemnt.</param>
 /// <param name="navigatorLocation">The starting location of the maze navigator.</param>
 /// <param name="goalLocation">The location of the goal (target).</param>
 /// <param name="minSuccessDistance">The minimum distance from the target for the trial to be considered a success.</param>
 /// <param name="maxTimeSteps">The maximum number of time steps to run a given trial.</param>
 /// <param name="behaviorCharacterization">The behavior characterization for a navigator.</param>
 public MazeNavigationWorld(List <Wall> walls, DoublePoint navigatorLocation, DoublePoint goalLocation,
                            int minSuccessDistance, int maxTimeSteps, IBehaviorCharacterization behaviorCharacterization)
     : this(
         walls, navigatorLocation, goalLocation, minSuccessDistance, 0, maxTimeSteps, 0,
         behaviorCharacterization)
 {
 }
Example #2
0
 /// <summary>
 ///     Constructs a new maze navigation world with a null behavior characterization reference and using the first maze
 ///     configuration in the collection of maze configurations.
 /// </summary>
 /// <param name="behaviorCharacterization">
 ///     The way in which an agents behavior is characterized (i.e. end point,
 ///     trajectory, etc.).
 /// </param>
 /// <returns>A constructed maze navigation world ready for evaluation.</returns>
 public MazeNavigationWorld <TTrialInfo> CreateMazeNavigationWorld(
     IBehaviorCharacterization behaviorCharacterization = null)
 {
     return(new MazeNavigationWorld <TTrialInfo>(_mazeConfigurations[_currentHashKeys[0]].Walls,
                                                 _mazeConfigurations[_currentHashKeys[0]].NavigatorLocation,
                                                 _mazeConfigurations[_currentHashKeys[0]].GoalLocation, _minSuccessDistance, _maxDistanceToTarget,
                                                 _mazeConfigurations[_currentHashKeys[0]].MaxSimulationTimesteps, behaviorCharacterization));
 }
 public void setBehavioralCharacterization(string behaviorName)
 {
     if (behaviorName == null || behaviorName.Equals("null"))
     {
         return;
     }
     behaviorCharacterization = BehaviorCharacterizationFactory.getBehaviorCharacterization(behaviorName);
     behaviorCharacterization.reset();
 }
Example #4
0
        /// <summary>
        ///     Constructs a new maze navigation world using the maze at the specified index and a given behavior characterization.
        /// </summary>
        /// <param name="hashCodeIndex">The index of the maze configuration to use in the maze navigation world.</param>
        /// <param name="behaviorCharacterization">
        ///     The way in which an agents behavior is characterized (i.e. end point,
        ///     trajectory, etc.).
        /// </param>
        /// <returns>A constructed maze navigation world ready for evaluation.</returns>
        public MazeNavigationWorld <TTrialInfo> CreateMazeNavigationWorld(int hashCodeIndex,
                                                                          IBehaviorCharacterization behaviorCharacterization)
        {
            // Get the maze configuration corresponding to the hash code at the given hash index
            MazeConfiguration mazeConfig = _mazeConfigurations[_currentHashKeys[hashCodeIndex]];

            // Create maze navigation world and return
            return(new MazeNavigationWorld <TTrialInfo>(mazeConfig.Walls, mazeConfig.NavigatorLocation,
                                                        mazeConfig.GoalLocation, _minSuccessDistance, _maxDistanceToTarget, mazeConfig.MaxSimulationTimesteps,
                                                        behaviorCharacterization));
        }
Example #5
0
        /// <summary>
        ///     Constructs a new maze navigation world using the given maze structure and behavior characterization.
        /// </summary>
        /// <param name="mazeStructure">The maze structure to convert into a maze configuration.</param>
        /// <param name="behaviorCharacterization">
        ///     The way in which an agents behavior is characterized (i.e. end point,
        ///     trajectory, etc.).
        /// </param>
        /// <returns>A constructed maze navigation world ready for evaluation.</returns>
        public MazeNavigationWorld <TTrialInfo> CreateMazeNavigationWorld(MazeStructure mazeStructure,
                                                                          IBehaviorCharacterization behaviorCharacterization)
        {
            // Build the single maze configuration
            var mazeConfig = new MazeConfiguration(ExtractMazeWalls(mazeStructure.Walls),
                                                   ExtractStartEndPoint(mazeStructure.StartLocation), ExtractStartEndPoint(mazeStructure.TargetLocation),
                                                   mazeStructure.MaxTimesteps);

            // Create maze navigation world and return
            return(new MazeNavigationWorld <TTrialInfo>(mazeConfig.Walls, mazeConfig.NavigatorLocation,
                                                        mazeConfig.GoalLocation, _minSuccessDistance, _maxDistanceToTarget, mazeConfig.MaxSimulationTimesteps,
                                                        behaviorCharacterization));
        }
Example #6
0
        /// <summary>
        ///     Creates the maze navigation world (environment) given the experiment parameters.
        /// </summary>
        /// <param name="walls">The walls in the maze environment.</param>
        /// <param name="navigatorLocation">The starting location of the maze navigator.</param>
        /// <param name="goalLocation">The location of the goal (target).</param>
        /// <param name="minSuccessDistance">The minimum distance from the target for the trial to be considered a success.</param>
        /// <param name="maxDistanceToTarget">The maximum distance from the target possible.</param>
        /// <param name="maxTimeSteps">The maximum number of time steps to run a given trial.</param>
        /// <param name="numBridgingApplications">The number of times to apply bridging during a given trial.</param>
        /// <param name="behaviorCharacterization">The behavior characterization for a navigator.</param>
        private MazeNavigationWorld(List <Wall> walls, DoublePoint navigatorLocation,
                                    DoublePoint goalLocation,
                                    int minSuccessDistance,
                                    int maxDistanceToTarget, int maxTimeSteps,
                                    int numBridgingApplications,
                                    IBehaviorCharacterization behaviorCharacterization = null)
        {
            _walls                    = walls;
            _goalLocation             = goalLocation;
            _minSuccessDistance       = minSuccessDistance;
            _maxDistanceToTarget      = maxDistanceToTarget;
            _maxTimesteps             = maxTimeSteps;
            _behaviorCharacterization = behaviorCharacterization;
            _numBridgingApplications  = numBridgingApplications;

            // Instantiate the navigator
            _navigator = new MazeNavigator(navigatorLocation);
        }
        public override void Initialize(string name, XmlElement xmlConfig)
        {
            base.Initialize(name, xmlConfig);

            // Read in the behavior characterization
            _behaviorCharacterization =
                BehaviorCharacterizationUtil.GenerateBehaviorCharacterization(
                    BehaviorCharacterizationUtil.ConvertStringToBehavioralCharacterization(
                        XmlUtils.TryGetValueAsString(xmlConfig, "BehaviorCharacterization")));

            // Read in the novelty archive parameters
            _archiveAdditionThreshold = XmlUtils.GetValueAsDouble(xmlConfig, "ArchiveAdditionThreshold");
            _archiveThresholdDecreaseMultiplier = XmlUtils.GetValueAsDouble(xmlConfig,
                "ArchiveThresholdDecreaseMultiplier");
            _archiveThresholdIncreaseMultiplier = XmlUtils.GetValueAsDouble(xmlConfig,
                "ArchiveThresholdIncreaseMultiplier");
            _maxGenerationalArchiveAddition = XmlUtils.GetValueAsInt(xmlConfig, "MaxGenerationalArchiveAddition");
            _maxGenerationsWithoutArchiveAddition = XmlUtils.GetValueAsInt(xmlConfig, "MaxGenerationsWithoutArchiveAddition");

            // Read in nearest neighbors for behavior distance calculations
            _nearestNeighbors = XmlUtils.GetValueAsInt(xmlConfig, "NearestNeighbors");
        }
        public override void Initialize(string name, XmlElement xmlConfig)
        {
            base.Initialize(name, xmlConfig);

            // Read in the behavior characterization
            _behaviorCharacterization = ExperimentUtils.ReadBehaviorCharacterization(xmlConfig);

            // Read in the novelty archive parameters
            ExperimentUtils.ReadNoveltyParameters(xmlConfig, out _archiveAdditionThreshold,
                out _archiveThresholdDecreaseMultiplier, out _archiveThresholdIncreaseMultiplier,
                out _maxGenerationArchiveAddition, out _maxGenerationsWithoutArchiveAddition);

            // Read in nearest neighbors for behavior distance calculations
            _nearestNeighbors = XmlUtils.GetValueAsInt(xmlConfig, "NearestNeighbors");

            // Read in steady-state specific parameters
            _batchSize = XmlUtils.GetValueAsInt(xmlConfig, "OffspringBatchSize");
            _populationEvaluationFrequency = XmlUtils.GetValueAsInt(xmlConfig, "PopulationEvaluationFrequency");

            // Read in log file path/name
            _generationalLogFile = XmlUtils.TryGetValueAsString(xmlConfig, "GenerationalLogFile");
        }
        public void setupBehaviorCharazterization(string behavior)
        {
            foreach (Type t in this.GetType().Assembly.GetTypes())
            {
                if (t.GetInterface("IBehaviorCharacterization", true) != null)
                {
                    behaviorComboBox.Items.Add(t.Name);
                }
            }

            bc = BehaviorCharacterizationFactory.getBehaviorCharacterization(behavior);
            if (bc != null)
            {
                for (int j = 0; j < behaviorComboBox.Items.Count; j++)
                {
                    if (behaviorComboBox.Items[j].ToString().Equals(bc.name))
                    {
                        behaviorComboBox.SelectedIndex = j;
                        break;
                    }
                }
            }
            fillTexBehaviorTextBox();
        }
		public void setBehavioralCharacterization(string behaviorName)
		{
            if (behaviorName == null || behaviorName.Equals("null")) return;
			behaviorCharacterization = BehaviorCharacterizationFactory.getBehaviorCharacterization(behaviorName);
			behaviorCharacterization.reset();
		}
 private void behaviorComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     bc = BehaviorCharacterizationFactory.getBehaviorCharacterization(behaviorComboBox.SelectedItem.ToString());
     fillTexBehaviorTextBox();
     Invalidate();
 }
        public void setupBehaviorCharazterization(string behavior)
        {
            foreach (Type t in this.GetType().Assembly.GetTypes())
            {
                if (t.GetInterface("IBehaviorCharacterization", true) != null)
                    behaviorComboBox.Items.Add(t.Name);
            }

            bc = BehaviorCharacterizationFactory.getBehaviorCharacterization(behavior);
            if (bc != null)
            {
                for (int j = 0; j < behaviorComboBox.Items.Count; j++)
                    if (behaviorComboBox.Items[j].ToString().Equals(bc.name))
                    {
                        behaviorComboBox.SelectedIndex = j;
                        break;
                    }
            }
            fillTexBehaviorTextBox();
        }
 private void behaviorComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     bc = BehaviorCharacterizationFactory.getBehaviorCharacterization(behaviorComboBox.SelectedItem.ToString());
     fillTexBehaviorTextBox();
     Invalidate();
 }