Class LQN2JAVA
LayeredNetwork and solves it with SolverLN.
Port of matlab/src/io/LQN2JAVA.m. The output is a class TestSolver<NAME> in package
jline.examples whose main declares the processors, tasks, entries and activities
(with bindings, synchronous and asynchronous calls and replies), then the activity precedences grouped
as MATLAB groups them (serial, loop, or-fork, and-fork, or-join, and-join), and finally runs
SolverLN.getEnsembleAvg().
Think times and host demands are written as MATLAB's javaDist writes them: each law by its own
constructor and parameters (Weibull as (shape, scale), Erlang as (rate, phases), HyperExp in its scalar or
vector form, PH/APH/MAP/ME/RAP as matrices), numbers through jnum (4.0, shortest round-trip
spelling otherwise), and only an unrecognised class as APH.fitMeanAndSCV with a warning.
Differences from the MATLAB text, each made so the output compiles and rebuilds the same model:
the import block lists the same packages in another order; a call mean, loop count or or-fork
probability that MATLAB's %g would round is printed in full; the class name drops every
character a Java identifier cannot hold, not only spaces.
Precedences are read from each task's declared ActivityPrecedence list rather than
reconstructed from sn.graph: the reconstruction loses a loop whose count is at most 1 and,
after the first and-fork, carries the previous fork's branches into the next one. Output order within
each group is the MATLAB order (by activity index; joins by descending index of the joined activity).
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringThe class name MATLAB derives from the model name, reduced to a valid Java identifier.static Stringgenerate(LayeredNetwork model) Returns the generated program for a model named aftermodel.getName().static Stringgenerate(LayeredNetwork model, String modelName) Returns the generated program.static voidwrite(LayeredNetwork model, String modelName, PrintStream out) Writes the generated program to a stream (e.g.static voidwrite(LayeredNetwork model, String modelName, Writer out) Writes the generated program to a writer, which is flushed but not closed.static voidwrite(LayeredNetwork model, String modelName, String filename) Writes the generated program tofilename, overwriting it.
-
Method Details
-
generate
Returns the generated program for a model named aftermodel.getName(). -
generate
Returns the generated program. -
write
Writes the generated program to a stream (e.g.System.out), which is flushed but not closed. -
write
Writes the generated program to a writer, which is flushed but not closed. -
write
Writes the generated program tofilename, overwriting it. -
className
The class name MATLAB derives from the model name, reduced to a valid Java identifier.
-