Class Composition

java.lang.Object
jline.lang.lal.Composition

public class Composition extends Object
A collection of agents with atomic synchronizations (Python builder.Composition). Its parts are hand-declared Agents and embedded LINE models (a Network, Environment, LayeredNetwork, MarkovProcess, MarkovChain or Workflow), mixed freely; an embedded model contributes one agent per node, whose actions are named by action(java.lang.Object, jline.lang.constant.EventType). Agent changes are reflected on the next call to getStruct(); no derived matrices are cached, and refresh() re-reads embedded models after they change.
  • Constructor Details

    • Composition

      public Composition(Agent... agents)
      Composition named LAL. Agents are optional here; a composition with no part is refused when its model is compiled.
    • Composition

      public Composition(List<Agent> agents)
    • Composition

      public Composition(String name, Agent... agents)
      Named composition; the name is that of the owned LINE network.
    • Composition

      public Composition(String name, List<Agent> agents)
    • Composition

      public Composition(Object... parts)
      Composition of mixed parts: Agents and LINE model objects, each of the latter embedded as by add(Object). A leading string names the composition.
  • Method Details

    • getAgents

      public List<Agent> getAgents()
    • getNetwork

      public Network getNetwork()
      The LINE network owned by the composition (named after it).
    • getEmbedded

      public Map<String,EmbeddedPart> getEmbedded()
      The embedded LINE models, by part name.
    • add

      public Composition add(Object model)
      add(Object, String, Integer) with no prefix and no cutoff.
    • add

      public Composition add(Object model, String prefix, Integer cutoff)
      Embed a LINE model; each of its nodes becomes an agent of the composition. model is a Network, MarkovProcess, MarkovChain, Workflow, Environment or LayeredNetwork, a LAL Agent, or another composition (nested). Node actions are then named by action(java.lang.Object, jline.lang.constant.EventType). prefix names the embedded part (required when two parts would share node names); cutoff bounds open classes as in SolverCTMC. The model must be Markovian (LINE:unsupported:NonMarkovian otherwise).
      Parameters:
      prefix - part name, or null
      cutoff - open-class cutoff, or null
    • hide

      public Composition hide(Object... actions)
      Make actions internal: they still occur, but leave the action tables. Each action is named as in getAvgAct: a label string, an ActionRef, a NodeRef, or an Object[] tuple {node, EventType[, jobclass]}; an open class hides the whole family.
    • setReward

      public Composition setReward(String name, ToDoubleFunction<StateView> fn)
      Declare a state reward fn(view), read back with the solvers' getAvgReward(). view.get(agent) is an agent's local state; view.node(part, node) is the state row of a node of an embedded model.
    • refresh

      public Composition refresh()
      Re-read every embedded LINE model after it was changed.
    • action

      public NodeRef action(Object node, EventType event)
    • action

      public NodeRef action(Object node, EventType event, Object jobclass)
    • action

      public NodeRef action(Object node, EventType event, Object jobclass, String mode, String part)
      Return a reference to a node action of an embedded LINE model.
      Parameters:
      node - the LINE node object or its name
      event - the event type (ARV, DEP, PHASE, READ, ENABLE, FIRE, PRE, POST, RENEGE, RETRY, SWITCH, FAILURE, REPAIR, STAGE)
      jobclass - a class object or name, or null to match every class
      mode - a Petri-net mode name for ENABLE/FIRE, or null
      part - the embedded part name, required when several models are embedded
    • getSyncs

      public List<Sync> getSyncs()
    • getMinSyncs

      public List<MinSync> getMinSyncs()
    • getExtSyncs

      public List<ExtSync> getExtSyncs()
      Node-key synchronizations with hand passives.
    • synchronize

      public Composition synchronize(ActionRef active, ActionRef... passives)
      Synchronize one active action with one or more passive actions of hand agents.
    • synchronize

      public Composition synchronize(Object active, Object... passives)
      Synchronize one active action with one or more passive ones:
      • synchronize(agent.action(a), other.action(p), ...): hand agents;
      • synchronize(agent.action(a), comp.action(node, EventType.ARV, cls)): the hand action injects an arrival of an open class at the node;
      • synchronize(comp.action(node, event, cls), agent.action(p), ...): the hand passives join every network event carrying that node key, and block it while they are disabled.
    • synchronizeMin

      public Composition synchronizeMin(ActionRef... actives)
      Minimum synchronization of two or more active actions with no passive partners.
    • synchronizeMin

      public Composition synchronizeMin(List<ActionRef> actives, List<ActionRef> passives)
      Synchronize active actions at the minimum enabled total rate. Each participant's enabled transition is sampled proportionally to its local rate or passive weight; any disabled participant blocks the event. The first active action names the event. Node actions of embedded models are refused: a minimum would retime LINE's own event.
    • getModel

      public LalModel getModel()
      Immutable model snapshot of the current parts and synchronizations (Python _model).
    • getStruct

      public LalCompiled getStruct()
      Return finite CTMC states, generator and labelled event matrices.
    • fromString

      public static Composition fromString(String source)
      Parse a LAL declaration into a programmatic composition.
    • fromFile

      public static Composition fromFile(String path) throws IOException
      Load a LAL declaration from a UTF-8 text file.
      Throws:
      IOException
    • getSourceStateSpace

      public Matrix getSourceStateSpace()
    • getSourceEventOrder

      public List<String> getSourceEventOrder()
    • getSourceSync

      public List<?> getSourceSync()
    • getSourceTruncated

      public Boolean getSourceTruncated()
    • setSourceTruncated

      public void setSourceTruncated(Boolean v)
      Mark the composition as a truncated source (Python source_truncated attribute).
    • setSourceStateSpace

      public void setSourceStateSpace(Matrix v)
      Record the state space of a flattened LINE CTMC (Python source_state_space attribute).
    • setSourceEventOrder

      public void setSourceEventOrder(List<String> v)
      Record the filter order of a flattened LINE CTMC (Python source_event_order attribute).
    • setSourceSync

      public void setSourceSync(List<?> v)
      Record the LINE synchronisations aligned with the filters (Python source_sync attribute).
    • isLowered

      public boolean isLowered()
      True when SolverMAM lowered this composition from embedded LINE networks.
    • getLoweredLabels

      public Map<String,String> getLoweredLabels()
      Lowered agent.action to node-event label map, empty when not lowered.
    • getLoweredSource

      public Composition getLoweredSource()
      The composition this one was lowered from, or null.