Contract that must be fulfilled such that an algorithm can be run in
Net2Plan.
New algorithms can be implemented as Java classes (.class/.jar files) with
a given signature. Integration of algorithms simply requires saving them in any
directory of the computer, although it is a good practice to store them in the
\workspace directory.
Important: When algorithms are implemented as Java
.class files,
the full path to the class must follow the package name of the class, in order
to successfully load the algorithm. For example, if we create an algorithm
named
testAlgorithm in the package
test.myAlgorithms, the full
path to the class must be like
...{any}.../test/myAlgorithms/testAlgorithm.class}.
For
.jar files there is not any restriction on the full path,
they can be stored at any folder.
In order to improve the user experience, kernel is able to catch any exception
thrown by algorithms. Those exceptions are introduced in a Java error console
(see 'Help file' for more information). For example, exceptions allow users to
check if their algorithms are well-programmed (i.e. no null-pointers), thus in
the error console they got a full trace of the error (files, line numbers...).
However, when input parameters are wrong or an error within the algorithm is
returned (i.e. an optimization problem is unable to find feasible solutions),
we recommend to throw exceptions using the
com.net2plan.interfaces.networkDesign.Net2PlanException class,
since it allows users to see the error in a small dialog in which the only
information is the error message (i.e. "A feasible solution was not found")
instead of the full error trace in the error console (i.e.
RuntimeException: A feasible solution was not found (MyAlgorithm.java:35), ...).