Cédric Brun, OBEO (@bruncedric)
Benoit Combemale, INRIA and Univ. Rennes 1 (@bcombemale)
Slides available at https://cedric.brun.io/talks/ModelingAvengers/
A Language Workbench for concurrent execution and simulation of heterogeneous models
GEMOC is an open international initiative that aims to coordinate and disseminate the research results regarding the support of the coordinated use of various modeling languages that will lead to the concept of globalization of modeling
languages, that is, the use of multiple modeling languages to support coordinated development of diverse aspects of a system.
French National Institute for Agricultural Research
build domain specific tools for supporting design and analysis of complex software or embedded systems from multiple viewpoints.
*: modeling community
Disclaimer: this experiment is not about the science itself but about how to use the OSS modeling technologies.
This is a toy, but a toy complex enough that we can learn from it.
Language Engineers | Domain | Viewpoint (Graph Editor) | Grammar (Textual Editor) | Constraints and Goals (Score function) | Behavioral Semantic (animator) |
Language Users | Data | Views and static checking | Text | Optimization | Execution, simulation |
public static void main(String[] args) {
// ...
Exploitation exploitation = loadFromFile(args[1]);
for (WorkGroup group : exploitation.getGroups()) {
System.out.println(group.getName());
for (Culture cultureAssignedToThisGroup : group.getCultures()) {
for (ExploitationActivity activity : cultureAssignedToThisGroup
.getActivities()) {
System.out.println(activity.getName());
System.out.println(activity.getFrequency());
System.out.println(activity.getStartDate());
System.out.println(activity.getEndDate());
}
// ...
public class ClimateDataResourceImpl extends ResourceImpl {
public ClimateDataResourceImpl(URI uri) {
super(uri);
}
@Override
protected void doLoad(InputStream inputStream, Map, ?> options)
throws IOException {
getContents().clear();
ClimateData climate = SimulationFactory.eINSTANCE.createClimateData();
String content = CharStreams.toString(new InputStreamReader(inputStream,
Charsets.US_ASCII));
List lines = Lists.newArrayList(Splitter.on('\n')
.omitEmptyStrings().split(content));
// ...
If you need to optimize goals under constraints while having limited resources.
When will I seed the crop based on the culture constraints, the climate and the peoples, machine, fields I have ?
NP class of problems, huge number of solutions, many being useless
@PlanningEntity(
difficultyComparatorClass = ActivityWorkDifficultyComparator.class
)
public interface ActivityWork extends EObject {
//...
@PlanningVariable(valueRangeProviderRefs = {"days"})
Day getScheduledOn();
//...
}
@PlanningEntity(
difficultyComparatorClass = ResourceAllocationDifficultyComparator.class
)
public interface ResourceAllocation extends EObject {
//...
@PlanningVariable(valueRangeProviderRefs = {"resources"})
Resource getResource();
//...
}
@PlanningEntity(
difficultyComparatorClass = ActivityWorkDifficultyComparator.class
)
public interface ActivityWork extends EObject {
//...
@PlanningVariable(valueRangeProviderRefs = {"days"})
Day getScheduledOn();
//...
}
@PlanningEntity(
difficultyComparatorClass = ResourceAllocationDifficultyComparator.class
)
public interface ResourceAllocation extends EObject {
//...
@PlanningVariable(valueRangeProviderRefs = {"resources"})
Resource getResource();
//...
}
@PlanningEntity(
difficultyComparatorClass = ActivityWorkDifficultyComparator.class
)
public interface ActivityWork extends EObject {
//...
@PlanningVariable(valueRangeProviderRefs = {"days"})
Day getScheduledOn();
//...
}
@PlanningEntity(
difficultyComparatorClass = ResourceAllocationDifficultyComparator.class
)
public interface ResourceAllocation extends EObject {
//...
@PlanningVariable(valueRangeProviderRefs = {"resources"})
Resource getResource();
//...
}
public Score calculateScore(SimulationSolution solution) {
int hardScore = 0;
int softScore = 0;
//...
/*
* Constraint: all the resources which are required should be allocated.
*/
for (ResourceAllocation alloc : solution.getSimulation().getAllocations()) {
if (alloc.getResource() == null) {
hardScore += mediumPenalty(1);
addFeedback(
alloc.getWork(),
(createFeedback(FeedbackLevel.ERROR, "A required resource of kind "
+ alloc.getKind().getName() + " is missing.")));
}
}
//...
return HardSoftScore.valueOf(hardScore, softScore)
}
“Do not compromise on your domain model.”
Eclipse: platform and User interface integration
EMF: data, resources, deeplinkink, reflective manipulation