few more questions:
1. Is it possible to exit model simulation run (BATCH RUN MODE )
based some other user-defined property/condition other than the number
of ticks , which I specify through spark-pl source code or other-
wise .
2. Can I execute batch runs in background or kill all graphics
windows, because I have a scenario where I will be required to run
more than 1 simulation, although I can kill other gui windows but the
main model window still hangs around, which as my batches runs
increase (~500-750)can be a serious performance issue.
In other words in some cases where I am using the SPARK I don't need
to see the model looks or is doing, I just want the output of some
data field, and with higher number of batch runs it seems rather time
consuming.
3. Is it possible to run/execute scripts or managed code from SPARK.
--- Even though this is not an immediate concern to me. I was just
curious about interoperability.
thank you all for your help
regards
Rupen
2. There is no way to completely turn off graphics now. In fact, it is
very simple to implement, and I'll add this feature soon.
3. SPARK-PL is not the only way of writing SPARK models. The most
flexible way is to use Java directly. There is no proper documentation
about programming SPARK models in Java, so it is not as easy as in
SPARK-PL. Using Java, it is possible to do much more than in SPARK-PL.
I'm working on a new version of SPARK-PL where it will be possible to
extend it by writing new commands directly in Java.
Best,
Alexey
Can you elaborate on the following
>on a new version of SPARK-PL where it will be possible to
>extend it by writing **new commands** directly in Java.
these "new commands" are in what context of extensibility?
thank you
regards
Rupen
All functionality of SPARK-PL is based on commands. If you want to
move an agent you call the command 'move' (or 'move-at'). If you want
to count the number of agents at some location you call the command
'agents-at'. And so on. The SPARK-PL translator converts each SPARK-PL
command into some Java code, and then a Java compiler is invoked to
obtain executable byte code. Whenever you write something like
to do-something
end
in SPARK-PL, you define a new command. But you are limited here and
can use only predefined SPARK-PL commands. You cannot write a command
which calls an external Java function (for some statistical
computations, for example). I'm planning to introduce a mechanism
which will allow calling native Java functions from SPARK-PL.
Alexey
When you say "You cannot write a command which calls an external Java
function (for some statistical computations, for example)"..
Do you mean this scenario : where in **Java source code that I have
written (without the need of *translating step) for a SPARK model, I
ADD some more bit of code with has nothing to do with SPARK framework/
model , runs some independent logic/code based on data values/
variables that currently being modified in SPARK simulation process --
and then use it to
a. store those values to file
b. or call another program
so the "SPARK Simulation Engine" complain about it?
I hope I am not being vague; But was curious because I observed that :
In the source codes of (toyInfection) SPARK model, you include/import
the JAVA System libraries such as util.ArrayList ; the simulation
engine doesn't complain about it. I was just wondering if I can
similarly use some other constructs (or perhaps functions) from JAVA
library-> if thats possible then it should be okay to execute
independent code.
regards
Rupen
Initially, Toy Infection Model was implemented for SPARK in Java.
There was no SPARK-PL at that time. Later, when SPARK-PL was
implemented, I translated this model into SPARK-PL but I left the
existing Java code inside SPARK-PL files for comparison reasons. If
you look at any source code file of Toy Infection Model, then you will
find that the SPARK-PL code and the Java code are separated by the
following combination of symbols @#$#@#$#@. This combination of
symbols means the end of file for SPARK-PL translator, so it is not
reading anything after these symbols (alternatively, it is possible to
write ***end***). Right now, there is no straightforward way to use
Java inside SPARK-PL.
Alexey