# How to configure the environment

The 4 steps of the platform configuration can be modified independently. We present here the 2 first steps related to the environment: Topology and elements on the map.

In Dedale, there are three types of environments: manually designed, imported from openStreetMap or generated ones. All of them can be distributed (or not) among computers. Environment characteristics are currently defined in 3 files :

1. map-topology : defines nodes and edges
2. map-elements : defines the position and caracteristics of the elements on the map
3. ConfigurationFile.java : gives the path of the two previous files to the program

## 1. Map topology

A topological map is defined as a set of nodes and undirected edges, each one with a unique identifier. You can use one of the map available in the resources folder, generate one using our available generators, import a topology based on OpenStreetMap or define your own.

All our 2D maps are following the DGS File Format Specification. As illustrated bellow :

• the two first line of a topological map file describes the type of graph to load, and mustn’t be changed in this project,
• Then, the an and ae respectivly correspond to the nodes and edges of the graph.

Here is an elementary example with 4 nodes (an) and 4 edges (ae).

DGS004
null 0 0
an 0	label: 0
an 1	label: 1
an 2    label: 2
an 3	label: 3
ae e2	0 1
ae e3	2 3
ae e4   1 2
ae e5   1 3

• an 0 label:0 : Is a node with Id 0 and label 0. In this project, the label and the Id must stay equals.
• ae e2 0 1 : Corresponds to a non-directed edge with Id e1, between node 0 and 1.

## 2. Elements on the map

If you decide to load a topology, you have to choose the elements that will be on the map :gold, diamond and/or well. For the 2 first elements, you have to indicate the safe position (nodeId), the value of the treasure and its openning criteria (required strength and Lockpicking expertise). Regarding the well, only the location is needed. This file is available in the resources folder.

mapname:MultiTypesV2
gold:82:95:0:0
gold:96:24:1:2
gold:42:60:1:1
gold:66:46:2:0
gold:112:10:2:3
diamonds:14:24:0:0
diamonds:19:41:1:0
well:111


## 3. Platform and generated environment configuration

configurationFile.java, available in the princ package

This file contains two set of parameters.

• Platform configuration

By default, the platform is not distributed, use a main container with 4 containers and the agent in charge of the environment and of the agents deployment is the gatekeeper “GK”.

   //Distributed or not, and is the current computer in charge of the main-container
public static boolean PLATFORMisDISTRIBUTED= false;
public static boolean COMPUTERisMAIN= true;

//network configuration
public static String PLATFORM_HOSTNAME="127.0.0.1";
public static String PLATFORM_ID="Ithaq";
public static Integer PLATFORM_PORT=8888;

//List of containers to be created on the current computer
public static String LOCAL_CONTAINER_NAME=PLATFORM_ID+"_"+"container1";
public static String LOCAL_CONTAINER2_NAME=PLATFORM_ID+"_"+"container2";
public static String LOCAL_CONTAINER3_NAME=PLATFORM_ID+"_"+"container3";
public static String LOCAL_CONTAINER4_NAME=PLATFORM_ID+"_"+"container4";

//Name of the agent in charge of the environment's E/S
public static String DEFAULT_GATEKEEPER_NAME="GK";

• Environment configuration

If you want an autogenerated map, you will set instance-topology and instance-configuration elements to null, otherwise you will gives here the references to the two files designed above. If your environment is autogenerated, you can set several parameters : the size of the environement, the occurence of gold/diamond/well and the type of graph (grid or dogoronev).

   // Type of environment to use (only one is publicly available: graphs)
public static EnvironmentType ENVIRONMENT_TYPE=EnvironmentType.GS;

/*************************************************************
An environment needs a topology, the configuration of the elements on the map,
and the characteristics of the agents.
**************************************************/

//When the environment is generated, only the last one is not null
public static String INSTANCE_TOPOLOGY=null;
public static String INSTANCE_CONFIGURATION_ELEMENTS=null;
public static String INSTANCE_CONFIGURATION_ENTITIES="resources/monoAgent-entities";
//public static String INSTANCE_TOPOLOGY="resources/map2018-topology";
//public static String INSTANCE_CONFIGURATION_ELEMENTS="resources/map2018-elements";
//public static String INSTANCE_CONFIGURATION_ENTITIES="resources/map2018-entities";

//Parameter used to generate the environment
public static Integer ENVIRONMENT_SIZE=10;
public static boolean ENVIRONMENTisGRID=true;//Grid env, or dogoronev one
public static boolean ACTIVE_WELL=false;// occurence of wells on the map
public static boolean ACTIVE_GOLD=true;// occurence of gold
public static boolean ACTIVE_DIAMOND=true; //occurence of diamond

public static final Integer DEFAULT_DETECTION_RADIUS = 1;//Distance from which the wumpus can be perceived trough its stech


You now have an environement configurated as you want it. Its time to configure and deploy the agents that will evoluate on the map.

Here is a video tutorial illustrating all these steps