Leotask
LeoTask is a fast, flexible and reliable framework for computational research. It is a free and open-source project.
Features[edit]
- Automatic & parallel parameter space exploration
- Flexible & configuration-based result aggregation
- Programming model focusing only on the key logic
- Reliable & automatic interruption recovery
- ...
Utilities[edit]
- Dynamic & cloneable networks structures: a node, a link, a network, and a network set (within which networks can overlap with each other).
- Integration with Gnuplot
- Network generation according to common network models
- DelimitedReader: a sophisticated reader that explores CSV (Comma-separated values) files like a database
- Fast random number generator based on the Mersenne Twister algorithm
- An integrated CurveFitter from the ImageJ project
- ...
Programming Model[edit]
Every application should extend the Task class and implement the application by overriding Task's methods. The following figure shows the default method flow and time points for a task. There are 6 default built-in time points for result collection: 1) beforeTask: before the start of a task, 2) beforeRept: before starting a repeated run of a task, 3) beforeStep: before starting a step in a run, 4) afterStep: after finishing a step in a run, 5) afterRept: after finishing a repeated run of a task, 6) afterTask: after finishing a task.
Default method flow and time points for a task.
Example Application[edit]
Blow is an example application of the framework: RollDice. The application simulates to roll a dice at each step. Each dice has nSide sides, and there are nDice dices. In total it conducts nDice steps in each repeat of a task.
Code (RollDice.java):
public class RollDice extends Task {
private static final long serialVersionUID = -4612453806484156399L;
public Integer nSide; //Number of dice sides
public Integer nDice; //Number of dices to roll
public Integer sum;
public boolean prepTask() {
boolean rtn = nSide > 0 && nDice > 0;
return rtn;
}
public void beforeRept() {
super.beforeRept();
sum = 0;
}
public boolean step() {
boolean rtn = iStep <= nDice;
if (rtn) {
sum += (int) (rand.nextDouble() * nSide);
}
return rtn;
}
}
Configuration (rolldice.xml):
<Tasks>
<name val="task-rolldice"/><usage val="0.5"/><nRepeats val="5"/><checkInterval val="4"/>
<variables class="org.leores.task.app.RollDice">
<nSide val="2;4;6"/>
<nDice val="2:1:5"/>
</variables>
<statistics>
<members>
<i><info val="Fig1%plotm+@afterRept@"/><valVar val="sum;#$sum$/$nDice$#"/><parVars val="nSide;nDice"/></i>
<i><info val="Fig2%plot+@afterRept@"/><valVar val="sum"/><parVars val="nSide"/></i>
<i><info val="Fig3%plot+@afterRept@"/><valVar val="sum"/><parVars val="nDice"/></i>
</members>
</statistics>
</Tasks>
The configuration entitles (name) the tasks "task-rolldice", allocates (usage) 50% CPU cores to run the tasks, sets each task to repeat (nRepeats) 5 times, and set checkpoint files (checkInterval) to be saved very 4 tasks.
The task is set to be org.leores.task.app.RollDice. The values of RollDice's two parameters are provided. nSide has 3 values: 2, 4, and 6. nDice has 4 values:2, 3, 4, and 5. There are 12 (=3x4) combinations of parameter values in this configuration. 12 tasks each with a different combination of parameter values will be conducted in parallel. Checkpoint files will be saved when the 4th, 8th, and 12th task starts.
The configuration collects 3 statistic results: 1) sum and sum/nDice (average outcome of a roll of a dice) conditioned on (nSide, nDice) pair after each repeat of a task; 2) sum conditioned on nSide after each repeat of a task; and 3) sum conditioned on nDice after each repeat of a task.
Running this example application will generate three figures and a CSV (Comma-separated values) file containing the statistic results:
The result figures of the example application
For more detailed explanation of this example application and its results: an introduction to LeoTask.
External links[edit]
This article "Leotask" is from Wikipedia. The list of its authors can be seen in its historical. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.