-
Notifications
You must be signed in to change notification settings - Fork 47
feat!: introduce a Kotlin DSL to configure simulations #4978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MarcoFratta
wants to merge
128
commits into
AlchemistSimulator:master
Choose a base branch
from
MarcoFratta:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add the simulation entry point for building dsl files, using Continuous2DEnvironment as default environment
Introduce dsl support for defining deployments using any Deployment<*> type
add dsl support for defining contents inside a deployment
add a helper function that allows to test if a loader generated by the dsl is the same as a loader generated by a yml file
now we also compare two simulations after running them for few steps.
add @BuildDsl annotation to automatically generate helper functions
add @BuildDsl annotation to automatically generate helper functions
|
Please retry analysis of this Pull-Request directly on SonarQube Cloud |
…ctions in context interfaces
…nd simplifying constructor processing
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Summary
This PR introduces a Kotlin DSL for configuring Alchemist simulations and a KSP-based annotation processor that generates helper functions to make existing classes DSL-friendly and easier to use.
Changes
Kotlin DSL for configuration (
alchemist-loading)KSP-based annotation processor (
alchemist-dsl-processor)Example
simulation(incarnation) { val rate: Double by variable(GeometricVariable(2.0, 0.1, 10.0, 9)) val size: Double by variable(LinearVariable(5.0, 1.0, 10.0, 1.0)) val mSize by variable { -size } val sourceStart by variable { mSize / 10.0 } val sourceSize by variable { size / 5.0 } networkModel = ConnectWithinDistance(0.5) deployments { deploy(grid(mSize, mSize, size, size, 0.25, 0.25, 0.1, 0.1)) { inside(Rectangle(sourceStart, sourceStart, sourceSize, sourceSize)) { molecule = "token, 0, []" } programs { all { timeDistribution(rate.toString()) program = "{token, N, L} --> {token, N, L} *{token, N+#D, L add [#NODE;]}" } all { program = "{token, N, L}{token, def: N2>=N, L2} --> {token, N, L}" } } } } }