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 :
- map-topology : defines nodes and edges
- map-elements : defines the position and characteristics of the elements on the map
- 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 3 available generators, import a topology based on OpenStreetMap or define your own.
All our 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 respectively 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 (if any) :gold, diamonds 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 should have a value other than 0. Note that the detection radius is not used currently, this parameter anticipates a future release. This file is available in the resources folder.
[
{
"elementName":"gold",
"initialLocation":"82",
"detectionRadius":0,
"quantity":95,
"lockPickingExpertise":1,
"strengthExpertise":2
}
]
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";
- 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 environment, the occurrence of gold/diamond/well and the type of topolgy you want for your graph (Grid, Dogoronev or Barabàsi).
// Type of environment to use (only one is publicly available: graphs)
public static EnvironmentType ENVIRONMENT_TYPE=EnvironmentType.GS;
//The environment is either manually designed (MANUAL), or generated with a specific generator (GRID,BARABASI,DOROGOVTSEV)
public static GeneratorType GENERATOR_TYPE=GeneratorType.MANUAL;
//The GateKeeper is in charge of the Platform and of the agents within, do not change its name.
public static String DEFAULT_GATEKEEPER_NAME="GK";
/*************************************************************
* When the environment is loaded, we need :
* - a) a topology,
* - b) the configuration of the elements on the map,
**************************************************/
// a) topology
//public static String INSTANCE_TOPOLOGY=null;
public static String INSTANCE_TOPOLOGY="resources/topology/map2020-topologyExam1-tree.dgs";
// b) elements available on the map, if any
// If the environment is loaded but you do not want to define elements on the map
public static String INSTANCE_CONFIGURATION_ELEMENTS="resources/distributedExploration/emptyMap";
// otherwise
//public static String INSTANCE_CONFIGURATION_ELEMENTS="resources/treasureHunt/map2018-elements.json";
//public static String INSTANCE_CONFIGURATION_ELEMENTS="resources/interlocking/mapInterlocking2-elements.json";
/************************************
*
* When the environment is generated
*
***********************************/
//Size of the generated environment, mandatory
public static Integer ENVIRONMENT_SIZE=10;
// Parameters required for some generators (see dedale.gitlab.io)
public static Integer OPTIONAL_ADDITIONAL_ENVGENERATOR_PARAM1=1;//used by the BARABASI_ALBERT generator to know the number of childs
public static Integer[] GENERATOR_PARAMETERS= {ENVIRONMENT_SIZE,OPTIONAL_ADDITIONAL_ENVGENERATOR_PARAM1};
// Wumpus proximity detection radius on generated map (expected to disappear on the next release)
public static final Integer DEFAULT_DETECTION_RADIUS = 1;
//Agents communication radius if not specified
public static Integer DEFAULT_COMMUNICATION_REACH=3;
// Elements to add on the generated map
public static boolean ACTIVE_WELL=false;
public static boolean ACTIVE_GOLD=true;
public static boolean ACTIVE_DIAMOND=false;
/************************************
************************************
*
* Agents characteristics
*
************************************/
//public static String INSTANCE_CONFIGURATION_ENTITIES="resources/agentExplo";
//public static String INSTANCE_CONFIGURATION_ENTITIES="resources/agentExplo-2";
public static String INSTANCE_CONFIGURATION_ENTITIES="resources/agentExploCoop-2.json";
//public static String INSTANCE_CONFIGURATION_ENTITIES="resources/agentKeyboardControlled";
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