Loading AMIDST dependencies from a remote maven repository

Here we explain how to add the AMIDST dependencies in a maven project with Java 8 or higher. Alternatively, you might prefer following the video-tutorial in this link .

In this example, we will use a project containing only one class, though the procedure here explain could be used in any other maven project. You can check this link for getting more information about how to create a new mavenproject.

For using the AMIDST Toolbox, the pom.xlm file will be modified. First, in the Project view (located on the left) select the file pom.xml of your project and open it:

Capture of Maven project in IntelliJ and the initial pom.xml file

Capture of Maven project in IntelliJ and the initial pom.xml file

Add the AMIDST repository by including the following code to your pom:

<repositories>
<!-- AMIDST repository in github -->
<repository>
<id>amidstRepo</id> <!-- local identifier, it can be anything -->
<url>https://raw.github.com/amidst/toolbox/mvn-repo/</url>
</repository>
<!-- ... -->
</repositories>        

Then, add the dependencies of modules in AMIDST you want to use.  For each module, add an element <dependency>…</dependency> inside the labels <dependencies></dependencies>. For each one, we have to indicate the following information:

For example, for using the core-dynamic module, include the following code:

<dependencies>
<!-- Load any of the modules from AMIDST Toolbox -->
<dependency>
<groupId>eu.amidst</groupId>
<artifactId>core-dynamic</artifactId>
<version>0.4.2</version>
<scope>compile</scope>
</dependency>

<!-- ... -->
</dependencies>        

Note that for using another module, simply change the value of the element artifactId (i.e. the content between the tags <artifactId> and <artifactId>). Now you can check in the Maven Projects panel that all the dependencies have been loaded:

List of loaded dependencies

List of loaded dependencies

Note that the core-dynamic module depends on core that has been loaded as well. We recomend you to download the sources and the javadoc:

Download the JavaDoc and the source code

Download the JavaDoc and the source code

Finally, for testing purposes, we can run the code shown below that generates a random dynamic bayesian network (DBN) and prints its parameters.

import eu.amidst.dynamic.models.DynamicBayesianNetwork;
import eu.amidst.dynamic.utils.DynamicBayesianNetworkGenerator;

public class TestingAmidst {
  public static void main(String[] args) throws WrongConfigurationException {
    DynamicBayesianNetworkGenerator.setNumberOfContinuousVars(2);
    DynamicBayesianNetworkGenerator.setNumberOfDiscreteVars(5);
    DynamicBayesianNetworkGenerator.setNumberOfStates(3);

    DynamicBayesianNetwork extendedDBN = 
    DynamicBayesianNetworkGenerator.generateDynamicBayesianNetwork();    

    System.out.println(extendedDBN.toString());


  }

}

If everything goes right, the following output will be generated:

Ouput of the testing code that generates a random DBN

Ouput of the testing code that generates a random DBN