Giter Club home page Giter Club logo

alchemist's Introduction

Alchemist logo Alchemist logo

Alchemist is a simulator for pervasive, aggregate, and nature-inspired computing.

The simulator is documented following the DIVIO Documentation system, we suggest visiting the Alchemist website, which contains all the project information.

CI/CD Javadocs CII Best Practices GitHub language count GitHub top language Lines of Code GitHub code size in bytes GitHub repo size Maven Central GitHub contributors ktlint Codacy Badge Codecov Code Climate maintainability Code Climate maintainability Code Climate maintainability codebeat badge CodeFactor Quality Gate Status Bugs Code Smells Duplicated Lines (%) Maintainability Rating Reliability Rating Security Rating Technical Debt Vulnerabilities

Note for academics

The Alchemist simulator license obliges those who use this software for an academic publication to provide proper attribution. This should be to the paper introducing Alchemist:

Pianini, D., Montagna, S., & Viroli, M. (2013). Chemical-oriented simulation of computational systems with ALCHEMIST. Journal of Simulation, 7(3), 202–215. https://doi.org/10.1057/jos.2012.27

A BibTeX entry for LaTeX users is:

@article{alchemist,
  doi = {10.1057/jos.2012.27},
  url = {https://doi.org/10.1057/jos.2012.27},
  year = {2013},
  month = aug,
  publisher = {Informa {UK} Limited},
  volume = {7},
  number = {3},
  pages = {202--215},
  author = {D Pianini and S Montagna and M Viroli},
  title = {Chemical-oriented simulation of computational systems with {ALCHEMIST}},
  journal = {Journal of Simulation}
}

Contributors

alchemist's People

Contributors

alessandro-marcantoni avatar andrea-acampora avatar angelofilaseta avatar anitvam avatar aplacuzzi avatar cric96 avatar danysk avatar den-gr avatar dependabot[bot] avatar elisacasadio avatar fedpet avatar fpradelli avatar ggraffieti avatar giuluck avatar gscaparrotti avatar kaikikm avatar kelvin-olaiya avatar kntronov avatar mazzio97 avatar metaphori avatar niccomlt avatar nicolasfara avatar paagamelo avatar renovate-bot avatar renovate[bot] avatar s-furi avatar semantic-release-bot avatar vuksaa avatar w4bo avatar zimbrando avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

alchemist's Issues

Enhancing simulation effects

I think it might be useful introducing a new effect, by default, to highlight the devices whose computation has changed recently.

For instance:

device1 output sequence:  0 1 0 
// computation changed during the last two rounds, highlight this device somehow (e.g., with a wide yellow circle)
device2 output sequence:  0 0 0 
// this device was stable during the last two rounds, don't highlight this device

Inherit molecules in multiple displacements

Instead of duplicating YAML code

displacements:
  - in:
      type: Point
      parameters: [44.137223, 12.241859]
    contents:
      - molecule: speed
        concentration: 0.2
  - in:
      type: Point
      parameters: [44.135522, 12.249264]
    contents:
      - molecule: speed
        concentration: 0.2
      - molecule: thr
        concentration: 0.2

it could be a good idea to provide support for "list anchoring" (see here)
Something like (though the YAML syntax proposed here might be wrong):

molecules: &molecules
  - molecule: speed
    concentration: 0.2
displacements:
  - in:
      type: Point
      parameters: [44.137223, 12.241859]
    contents:
      * molecules
  - in:
      type: Point
      parameters: [44.135522, 12.249264]
    contents:
      * molecules
      - molecule: thr
        concentration: 0.2

Add OutputMonitor to the simulation through YAML configuration

I think it could be useful to give the simulation designer the chance to add custom OutputMonitor to the simulation without the need to modify the AlchemistRunner class. The Alchemist YAML configuration could be a good place to specify which custom observers have to be added to the simulation.

Reduced memory footprint for OSMEnvironment

Usually, only few navigators are used (very often, one). However, they all are initialized, leading to memory waste. Initializing on request may provide consistent memory saving.

Make Neighborhood immutable

Mutable neighborhoods are a potential source of bugs. Modify the interface to make them immutable, possibly use Scala (or Kotlin) immutable collections as backends rather than Guava's.

GUI problem: does not correctly show a grid of devices

On: commit ab276ee (Alchemist 8.0.0)
Verified absence on: Alchemist 7.0.1 (plus commits from #72 )

When I start Alchemist with the following simulation configuration, I only see one node (or possibly all nodes located in a single point), instead of a grid of nodes.

network-model:
  type: EuclideanDistance
  parameters: [2.0]

incarnation: scafi

positions:
  type: Continuous2DEuclidean

displacements:
- in:
    type: Grid
    parameters: [0, 0, 20, 20, 1, 1, 0.8, 0.8]

Node cloning

Node cloning needs to be implemented: doing this it has to be taken into consideration that the TimeDistribution must be a new one (and not the same as the cloned node), with a different initial time.

Add support to Select and Pan modes

The new JavaFX UI supports switching between Select Mode and Pan Mode, but nothing changes.

The FXOutputMonitor classes should handle the DragEvents to make these modes work.

Add condition to terminate a simulation

I think it could be useful to add a condition that, once satisfied, causes the simulation to stop.

E.g. lets say I have scenario in which I am allocating resources to points in need, a reasonable condition is stop the simulation when all needs are satisfied.

Silent failure when loading OSM traces

While useful for interesting creativity exercises and for training guesses, it might be useful to notify when traces are not loaded by OSMEnvironment.

Make Environment parametric over the position type

Since we merged @Placu95 's work on GPS trace management, we have a hierarchy of position types, and some classes will only work with a sub-part of them. We might want to make Environment generic on the position type, as well as LinkingRule, and possibly other classes - the impact on the API has to be evaluated yet.

String variables

To run multiple Protelis simulations each with a different program, up to now I need to copy and paste my configuration changing only the program name (or creating a variable to create a binding number -> program).

# simulation 1
programs:
  - program: &program
    - time-distribution: 1
      program: distanceTo
    - program: send
displacements:
  - in:
      type: Point
      parameters: [44.137223, 12.241859]
    programs: 
      - *program


# simulation 2
programs:
  - program: &program
    - time-distribution: 1
      program: flex
    - program: send
displacements:
  - in:
      type: Point
      parameters: [44.137223, 12.241859]
    programs: 
      - *program

Having string variables might be useful in this case.

More efficient Neighbors encoding

Currently neighborhoods are directly computed by LinkingRules, which also builds them. They could be instead be stored internally as a bitset of size nodes², and produced on the fly when required.
The current computeNeighborhood(Node<T> center, Environment<T, P> env) method could be replaced by areNeighbors(Node<T>, Node<T>): boolean.

Memory usage estimation in YAML

The developer should be able to estimate the memory (and cpu?) usage by using the variables. That data should then be used to either limit the number of simulations running in parallel locally, or better schedule tasks in grid mode.

ConstantSpeed is not really constant

the current implementation only works in case of constant rate. It should actually evaluate the time between successive calls and compute a speed accordingly.

Impossible create new project

Trying to create new Alchemist project, after select the incarnation and click on Finish, an error is generated:
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException ... Caused by: java.lang.NullPointerException at it.unibo.alchemist.boundary.projectview.controller.NewProjLayoutSelectController.resourcesFrom(NewProjLayoutSelectController.java:143) at it.unibo.alchemist.boundary.projectview.controller.NewProjLayoutSelectController.copyRecursively(NewProjLayoutSelectController.java:100) at it.unibo.alchemist.boundary.projectview.controller.NewProjLayoutSelectController.clickFinish(NewProjLayoutSelectController.java:120) ... 124 more

Variable substitution does not work for "incarnation" in Alchemist YAML

YAML to reproduce:

variables:
  incarnation: &incarnation
    min: 0
    max: 1
    step: 1
    default: 0
  incarnationToUse: &incarnationToUse
    formula: 'if($incarnation==0) "Scafi" else "Protelis"'
    language: scala

incarnation: *incarnationToUse

Error:

Exception in thread "main" java.lang.IllegalStateException: {formula=if($incarnation==0) "Scafi" else "Protelis", language=scala} is not a valid incarnation. Supported incarnations are: [scafi, biochemistry, sapere, protelis]
        at it.unibo.alchemist.loader.YamlLoader.lambda$new$3(YamlLoader.java:231)
        at java.util.Optional.orElseThrow(Optional.java:290)
        at it.unibo.alchemist.loader.YamlLoader.(YamlLoader.java:229)
        at it.unibo.alchemist.loader.YamlLoader.(YamlLoader.java:203)
        at it.unibo.alchemist.Alchemist.main(Alchemist.java:89)

Adjustments to scafi-alchemist-incarnation

  • ScafiIncarnation.scala: specify msg on requireNonNull call in createTimeDistribution
  • See Scala-related deprecation warnings
  • Consider separating scafi program with send program (in Protelis) which is used to decouple computation and neighbourhood communication (used e.g. to calculate network lags)
  • Adjust ScafiNode by fixing createT by making it return null or raise NullPointerException if a certain molecule is not present in the node

Update QuadTree

The newer version has an optimization, but apparently is problematic to integrate. The issue should be investigated.

TimeDistribution cloning system

The current cloning interface does not account for considering the cloning time, which is relevant for scheduling the new reactions. The current strategy of using the putative reaction time as base for the new time distribution is flawed, since an event temporarily suspended would actually cause its clone to never get scheduled.

Update dependencies

Protelis and JIRF have a new release. Also, switch all HashUtils to Hashes from boilerplate.

Test the simulator on Java 9+

It's likely that the simulator can no longer correctly load incarnations if used on Java9+. This fact must get checked and countermeasures applied.

Better dependency tracking

Currently, dependencies are either a list of molecules read/modified or "null" as a token for any dependency. This would be improved by a new "Dependency" interface, along with implementations for molecules, any, and movement.
Dependencies may engulf the Context.

JavaFX UI not always handles newly added effects correctly

Probably due to not correctly bounded ObservableLists, sometimes the GUI doesn't handle new effects and groups correctly:

  • New groups usually are not added to the stack of effects of the FXOutputMonitor

  • When Drag'N'Drop to reorder effects and groups, DrawLinks effect stops to be controllable:

    • Can't change visibility
    • Can't change size

    DrawDots and DrawColoredDots seems to behave correctly

  • Add new effects during simulation execution makes crash with exception:

    [main] ERROR i.u.a.core.implementations.Engine - The simulation engine crashed.
    java.util.ConcurrentModificationException: null
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:907)
    at java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:902)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at it.unibo.alchemist.boundary.gui.effects.EffectStack.computeDrawCommands(EffectStack.java:73)
    at it.unibo.alchemist.boundary.monitor.generic.AbstractFXDisplay.lambda$update$6(AbstractFXDisplay.java:379)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
    at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:743)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at it.unibo.alchemist.boundary.monitor.generic.AbstractFXDisplay.update(AbstractFXDisplay.java:384)
    at it.unibo.alchemist.boundary.monitor.generic.AbstractFXDisplay.stepDone(AbstractFXDisplay.java:344)
    at it.unibo.alchemist.core.implementations.Engine.doStep(Engine.java:175)
    at it.unibo.alchemist.core.implementations.Engine.run(Engine.java:377)
    at it.unibo.alchemist.AlchemistRunner.lambda$launch$2(AlchemistRunner.java:189)
    at it.unibo.alchemist.AlchemistRunner.lambda$null$9(AlchemistRunner.java:246)
    at it.unibo.alchemist.AlchemistRunner.launch(AlchemistRunner.java:191)
    at it.unibo.alchemist.Alchemist.main(Alchemist.java:126)
    15:44:34.480 [main] ERROR i.u.a.core.implementations.Engine - Attempt to wait for an illegal status: RUNNING (current state is: TERMINATED)
    Exception in thread "main" java.lang.IllegalStateException: java.util.ConcurrentModificationException
    at it.unibo.alchemist.AlchemistRunner.launch(AlchemistRunner.java:198)
    at it.unibo.alchemist.Alchemist.main(Alchemist.java:126)
    Caused by: java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:907)
    at java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:902)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at it.unibo.alchemist.boundary.gui.effects.EffectStack.computeDrawCommands(EffectStack.java:73)
    at it.unibo.alchemist.boundary.monitor.generic.AbstractFXDisplay.lambda$update$6(AbstractFXDisplay.java:379)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
    at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:743)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at it.unibo.alchemist.boundary.monitor.generic.AbstractFXDisplay.update(AbstractFXDisplay.java:384)
    at it.unibo.alchemist.boundary.monitor.generic.AbstractFXDisplay.stepDone(AbstractFXDisplay.java:344)
    at it.unibo.alchemist.core.implementations.Engine.doStep(Engine.java:175)
    at it.unibo.alchemist.core.implementations.Engine.run(Engine.java:377)
    at it.unibo.alchemist.AlchemistRunner.lambda$launch$2(AlchemistRunner.java:189)
    at it.unibo.alchemist.AlchemistRunner.lambda$null$9(AlchemistRunner.java:246)
    at it.unibo.alchemist.AlchemistRunner.launch(AlchemistRunner.java:191)
    ... 1 more
    Process finished with exit code 1

    That seems not to happen when loading effects from file.

Selection mode is inverted

When trying to select nodes, the selection drag happens to be reverted compared to mouse drag.
Bug reproduced using 16-maps.yml file of the SAPERE-incarnation-tutorial.

Generate scaladoc and dokka

Since Alchemist is now a multilanguage project, documentation should be generated for all its components, in form of Javadoc, Scaladoc, and Dokka.

Architecture of reactions and time distributions is not consistent and needs refactoring

There is not enough clarity in the division of duties between time distributions and reactions, see e.g. how ChemicalReaction tries to override the rate computation. Also, the template method that calls updateInternalStatus looks like a kludge.

AbstractReaction should be refactored, and maybe directly become usable as Event. ChemicalReaction might just be an Event with a custom ExponentialTime distribution that considers the contributions of the conditions to the propensity.

Export simulation screenshots directly from Alchemist

I think that exporting simulation (svg) screenshots from Alchemist could be an useful feature to add to the simulator, also providing the possibility to export a screenshot when a given condition is true (e.g., take screenshots at 100s and 200s, when all devices' outputs are below a threshold, ...).

Modification of the details of an effect while the simulation is running

Trying to change e.g. field "Molecule property" in an effect while the simulation is running causes the production of hundreds of exception messages, such as the following one (I was trying to digit "true"), in the console:

java.lang.IllegalArgumentException: The Protelis program cannot be created because of the following errors:
Error, line 1: Couldn't resolve reference to EObject 't'.
Error, line 1: Couldn't resolve reference to EObject 'tr'

It might be better to log it at debug-level, and/or to defer the parsing until the change is committed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.