Commit 77f146c3 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

Merge remote-tracking branch 'origin/master' into 3620



Conflicts:
	org.fortiss.af3.ocra/plugin.xml
	org.fortiss.af3.testing.ui/META-INF/MANIFEST.MF
	org.fortiss.af3.testing/META-INF/MANIFEST.MF
Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parents 9ec115bd 3aaf6544
......@@ -7,6 +7,15 @@
<modelElementHandler handler="org.fortiss.af3.allocation.ui.handler.AllocationTableCollectionHandler">
<modelElementClass modelElementClass="org.fortiss.af3.allocation.model.AllocationTableCollection"/>
</modelElementHandler>
<modelElementHandler handler="org.fortiss.af3.allocation.ui.handler.ManyToOneAllocationEntryHandler">
<modelElementClass modelElementClass="org.fortiss.af3.allocation.model.ManyToOneAllocationEntry"/>
</modelElementHandler>
<modelElementHandler handler="org.fortiss.af3.allocation.ui.handler.OneToOneAllocationEntryHandler">
<modelElementClass modelElementClass="org.fortiss.af3.allocation.model.OneToOneAllocationEntry"/>
</modelElementHandler>
<modelElementHandler handler="org.fortiss.af3.allocation.ui.handler.OneToManyAllocationEntryHandler">
<modelElementClass modelElementClass="org.fortiss.af3.allocation.model.OneToManyAllocationEntry"/>
</modelElementHandler>
</extension>
<extension point="org.fortiss.tooling.kernel.modelPrototypeProvider">
......
AF3AllocationUIActivator.java d0d2f939b1c8a1ba0995a3dc6dfd2c197ab09832 GREEN
DefaultStyle.java 1981ac9801c7867c08868dde009415db4c5c8ba8 GREEN
ParameterEntryTreeViewerEditingSupport.java aedc9b5729911b42bf752d7edbe507ff4f447420 GREEN
ParameterEntryTreeViewerLabelProvider.java dacadca1f62afba95d0d6a68f7aca6252b34b172 GREEN
ParameterEntryTreeViewerLabelProvider.java 79c70864ef80404e31aa48f75d36072f35380762 GREEN
ParameterSourceElementTreeViewerEditingSupport.java 9e30e6e0df10beaaf3231c9ff06a0c5ab1df9b34 GREEN
ParameterSourceElementTreeViewerLabelProvider.java cb886708a180db20dee0411b37fa32185b9a95f5 GREEN
ParameterTableTreeViewerManager.java 33b2836459c8258127bd1174c938b5953b115eba GREEN
TreeViewerCheckBoxEditingSupport.java 00d09fbe4950453c0272c6b497b994ffeec38023 GREEN
TreeViewerCheckBoxLabelProvider.java 97fe6771fbe09ccd16c1fe1ade862d2f95093ed1 GREEN
TreeViewerCheckBoxLabelProvider.java 831580238a82f8b1fe87dc4ff8518efd9f42c25a GREEN
TreeViewerContentProvider.java e19b353b4f7624fd38db782524fed5cdf66dff55 GREEN
TreeViewerFirstColumnLabelProvider.java 41af5aeea1c94de2deb2a024b5d0c589302b0c15 GREEN
TreeViewerManager.java 2e073c418cfdf089f42d13be62ff3b26efca3a39 GREEN
TreeViewerManager.java ac9452a973bfcb14bda59c940155fb2343fdbe18 GREEN
......@@ -15,7 +15,7 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.allocation.ui.editor.treeviewer;
import static org.fortiss.af3.allocation.ui.DefaultStyle.RIGHT_ARROW;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.RIGHT_ARROW;
import static org.fortiss.af3.allocation.utils.AllocationUtils.getParameterEntryName;
import static org.fortiss.af3.allocation.utils.AllocationUtils.getParameterEntryValue;
......
......@@ -15,7 +15,7 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.allocation.ui.editor.treeviewer;
import static org.fortiss.af3.allocation.ui.DefaultStyle.RIGHT_ARROW;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.RIGHT_ARROW;
import static org.fortiss.af3.allocation.utils.AllocationUtils.isAllocated;
import static org.fortiss.af3.allocation.utils.AllocationUtils.isModifiableAllocationEntry;
......
......@@ -18,8 +18,8 @@ package org.fortiss.af3.allocation.ui.editor.treeviewer;
import static java.util.Arrays.sort;
import static java.util.Collections.emptyList;
import static org.eclipse.jface.viewers.AbstractTreeViewer.ALL_LEVELS;
import static org.fortiss.af3.allocation.ui.DefaultStyle.DOWN_ARROW;
import static org.fortiss.af3.allocation.ui.DefaultStyle.RIGHT_ARROW;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.DOWN_ARROW;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.RIGHT_ARROW;
import java.util.ArrayList;
import java.util.Collection;
......
AllocationTableCollectionHandler.java d670d09ac29b35de7cdb12a9391f1c202b8dabe5 GREEN
ManyToOneAllocationEntryHandler.java 0f2b8ecaf7761b672d380b31558b3ca4a86eadce GREEN
OneToManyAllocationEntryHandler.java b8271e7603d4af63e0897b689f06ff9d2f2de28d GREEN
OneToOneAllocationEntryHandler.java 27a868c2b2cc528a119961990bb574ef35c4df51 GREEN
/*-------------------------------------------------------------------------+
| Copyright 2019 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.allocation.ui.handler;
import static java.util.stream.Collectors.joining;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.RIGHT_ARROW;
import java.util.Collection;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.allocation.model.ManyToOneAllocationEntry;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
/**
* {@link IModelElementHandler} for {@link ManyToOneAllocationEntry}s.
*
* @author diewald
*/
public class ManyToOneAllocationEntryHandler
extends ModelElementHandlerBase<ManyToOneAllocationEntry> {
/** {@inheritDoc} */
@Override
public String getName(ManyToOneAllocationEntry element) {
IModelElementHandlerService handlerService = IModelElementHandlerService.getInstance();
Collection<IModelElement> sourceElements = element.getSourceElements();
String name = "[ " +
sourceElements.stream().map(e -> handlerService.getName(e)).collect(joining(",")) +
" ]";
name = name + " " + RIGHT_ARROW + " ";
name = name + handlerService.getName(element.getTargetElement());
return name;
}
/** {@inheritDoc} */
@Override
public ImageDescriptor getIconImageDescriptor() {
return null;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2019 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.allocation.ui.handler;
import static java.util.stream.Collectors.joining;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.RIGHT_ARROW;
import java.util.Collection;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.allocation.model.OneToManyAllocationEntry;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
/**
* {@link IModelElementHandler} for {@link OneToManyAllocationEntry}s.
*
* @author diewald
*/
public class OneToManyAllocationEntryHandler
extends ModelElementHandlerBase<OneToManyAllocationEntry> {
/** {@inheritDoc} */
@Override
public String getName(OneToManyAllocationEntry element) {
IModelElementHandlerService handlerService = IModelElementHandlerService.getInstance();
String name = handlerService.getName(element.getSourceElement());
name = name + " " + RIGHT_ARROW + " ";
Collection<IModelElement> targetElements = element.getTargetElements();
name = name + "[ " +
targetElements.stream().map(e -> handlerService.getName(e)).collect(joining(", "));
return name + " ]";
}
/** {@inheritDoc} */
@Override
public ImageDescriptor getIconImageDescriptor() {
return null;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| Copyright 2019 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
......@@ -13,18 +13,36 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.allocation.ui;
package org.fortiss.af3.allocation.ui.handler;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.RIGHT_ARROW;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.allocation.model.OneToOneAllocationEntry;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
/**
* Style definitions for allocation UI elments.
* {@link IModelElementHandler} for {@link OneToOneAllocationEntry}s.
*
* @author barner
* @author diewald
*/
public class DefaultStyle {
public class OneToOneAllocationEntryHandler
extends ModelElementHandlerBase<OneToOneAllocationEntry> {
/** Unicode right arrow. */
public static final String RIGHT_ARROW = "\u2192";
/** {@inheritDoc} */
@Override
public String getName(OneToOneAllocationEntry element) {
IModelElementHandlerService handlerService = IModelElementHandlerService.getInstance();
String sourceName = handlerService.getName(element.getSourceElement());
String targetName = handlerService.getName(element.getTargetElement());
return sourceName + " " + RIGHT_ARROW + " " + targetName;
}
/** Unicode down arrow. */
public static final String DOWN_ARROW = "\u2193";
/** {@inheritDoc} */
@Override
public ImageDescriptor getIconImageDescriptor() {
return null;
}
}
......@@ -2,5 +2,5 @@ AF3AllocationFactoryImplCustom.java 36f55f6cc9ab49c09223a7b0c0163157b137aeb3 GRE
AllocationEntryStaticImpl.java 49e2c1390029f9652e8d891a1ce281f30e941d5b GREEN
AllocationTableCollectionStaticImpl.java d1ebdc08e00373ca5940853c1fb7c1b0a5b19c43 GREEN
AllocationTableStaticImpl.java b4abaca7b71433d05bb0ec33ad6c619d96ad9f54 GREEN
ParameterEntryStaticImpl.java 45ff9e4ab15af6527f6cba27920954981697d23d GREEN
ParameterEntryStaticImpl.java 81f62de67eaeac99da628853f31ae13bc6a33cc4 GREEN
ParameterTableStaticImpl.java cbf046b336d70c0b7b9e5976eda99537a8f73114 GREEN
......@@ -15,6 +15,7 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.allocation.model.impl;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.RIGHT_ARROW;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.computeFullyQualifiedName;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.computeRelativeName;
......@@ -43,9 +44,6 @@ public class ParameterEntryStaticImpl {
return element != null ? element.toString() : "<null>";
}
/** Unicode right arrow. */
private static final String RIGHT_ARROW = "\u2192";
/**
* Computes the "name" of the given {@link ParameterEntry} based on its referenced
* {@code sourceElement} and {@code targetElement}.
......
AllocationModelElementFactory.java 1790fc35d560cdf74ac1900c0d289e58900a0c32 GREEN
AllocationModelElementFactory.java 9aba183708290c741ebbbe2897bbfcc51ea33fb6 GREEN
AllocationUtils.java c5d804fc26e9b2664af32e3eb3b9379dd10f9802 GREEN
......@@ -33,6 +33,12 @@ import org.fortiss.af3.allocation.model.OneToOneAllocationEntry;
*/
public class AllocationModelElementFactory {
/** Allocation Names: Unicode right arrow. */
public static final String RIGHT_ARROW = "\u2192";
/** Allocation Names: Unicode down arrow. */
public static final String DOWN_ARROW = "\u2193";
/**
* Creates a new {@link AllocationTableCollection}.
*
......
......@@ -5,7 +5,7 @@ CodeSpecPrepareRemoveMultipleAssignments.java 795880e1dd95d0a579572c435a9c4647fb
CodeSpecPrepareToIfElseBlock.java a4a0300700fa7c3f11bb0b0a9d06f7392026bfe4 GREEN
CodeSpecPrepareToIfSequence.java aa91a979a9c9ec4bbe92976fc6f94f7a0921f4ae GREEN
CopyProject.java 222c9f6e3adb6d6df48900604a7e76a6d079132f GREEN
FlattenVariableDefs.java f47dcb6ad607b2b0d6ee8825bc33a567725cb2ba GREEN
FlattenVariableDefs.java 5bb7a8810d31c203878b048f5eaee001e181a4b6 GREEN
MultiValuedMap.java 9a92088a5d39dab3e64dfbb05db0507cb6e89b9a GREEN
NamesTransformation.java d499765e1d165be02536fd671c9af1f4ca170c03 GREEN
ResolveNoVal.java 072925bb14e304611ced7b862b84ea48b0334839 GREEN
......
......@@ -26,6 +26,7 @@ import static org.fortiss.af3.expression.utils.ExpressionUtils.getTypeDefinition
import static org.fortiss.af3.expression.utils.ExpressionUtils.reduceMemberAccess;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.copy;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.UniqueIDUtils.generateMissingIDs;
import static org.fortiss.tooling.kernel.utils.UniqueIDUtils.getLargestID;
......@@ -33,8 +34,6 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.component.model.Channel;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.InputPort;
......@@ -65,14 +64,16 @@ public class FlattenVariableDefs extends CacheSupportedTransformationBase {
public Object transform(Object c, IPragmaticTransformation deferredTransformation) {
if(c instanceof FileProject) {
boolean toBeIteratedAgain = false;
TreeIterator<EObject> iterator = ((FileProject)c).eAllContents();
List<IVariableDefinition> objectsToTransform =
getChildrenWithType((FileProject)c, IVariableDefinition.class);
while(iterator.hasNext()) {
EObject object = iterator.next();
Object r = deferredTransformation.buildTransformation(object);
if(r != null)
toBeIteratedAgain = true;
for(IVariableDefinition vd : objectsToTransform) {
Object r = deferredTransformation.buildTransformation(vd);
toBeIteratedAgain = toBeIteratedAgain || (r != null);
}
getChildrenWithType((FileProject)c, Channel.class)
.forEach(e -> deferredTransformation.buildTransformation(e));
return toBeIteratedAgain ? c : null;
} else if(c instanceof Channel) {
Channel ch = (Channel)c;
......
Z3Backend.java 692e27caadbd9fa1fc2b83dfcef60dad752bdd3b GREEN
Z3Backend.java bee7dbca7050a829fa284be85a1bf65336791c9a GREEN
......@@ -15,29 +15,41 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.smt.backend;
import static org.fortiss.af3.exploration.smt.modeltransformation.BasicDeploScheduleConstraint.generateDeploScheduleConstraints;
import static org.fortiss.af3.exploration.smt.modeltransformation.BasicDeploymentConstraint.createBasicSignalConstraints;
import static org.fortiss.af3.exploration.smt.modeltransformation.BasicScheduleConstraint.generatePureScheduleConstraints;
import static org.fortiss.af3.exploration.util.ExplorationUtils.isDebugVerboseEnabled;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.util.EList;
import org.fortiss.af3.deployment.model.VirtualLink;
import org.fortiss.af3.exploration.model.ExplorationSpecification;
import org.fortiss.af3.exploration.model.ExplorationTarget;
import org.fortiss.af3.exploration.model.IExplorationFeature;
import org.fortiss.af3.exploration.model.SuperSetMap;
import org.fortiss.af3.exploration.model.solutions.ExplorationSolution;
import org.fortiss.af3.exploration.projectmodel.RuleSet;
import org.fortiss.af3.exploration.service.DSESolutionVisualization;
import org.fortiss.af3.exploration.service.IDSEBackend;
import org.fortiss.af3.exploration.smt.model.SMTConstraint;
import org.fortiss.af3.exploration.smt.modeltransformation.DeploScheduleRun;
import org.fortiss.af3.exploration.smt.modeltransformation.DeploymentRun;
import org.fortiss.af3.exploration.smt.modeltransformation.ScheduleRun;
import org.fortiss.af3.exploration.smt.modeltransformation.SolverRun;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.platform.model.TransmissionUnit;
import org.fortiss.af3.schedule.model.ResourceAllocation;
import org.fortiss.af3.schedule.model.Schedule;
import org.fortiss.af3.task.model.Signal;
import org.fortiss.af3.task.model.Task;
import org.fortiss.af3.task.model.allocation.ComponentToTaskAllocationEntry;
import org.fortiss.af3.task.model.allocation.TaskToExecutionUnitAllocationTable;
import org.fortiss.tooling.base.model.element.IModelElement;
......@@ -58,35 +70,63 @@ public class Z3Backend implements IDSEBackend {
Set<Class<? extends IModelElement>> solutionTypes,
Collection<IExplorationFeature> explorationModules, IProgressMonitor monitor,
int timeoutMS) throws Exception {
if(spec.getTargets().isEmpty()) {
throw new Exception("No exploration targets defined. Cannot perform DSE.");
}
SuperSetMap superSets = spec.getSearchSpace();
List<SMTConstraint> basicDeploymentConstraints = createBasicSignalConstraints(superSets);
SolverRun solverRun;
if(solutionTypes.contains(Schedule.class) &&
solutionTypes.contains(TaskToExecutionUnitAllocationTable.class)) {
// Add SMT-specific constraints to define the basic deployment problem.
RuleSet basicDeploScheduleConstraints =
generateDeploScheduleConstraints(superSets.get(ResourceAllocation.class),
superSets.get(Task.class), superSets.get(Signal.class),
superSets.get(ExecutionUnit.class), superSets.get(VirtualLink.class),
superSets.get(ComponentToTaskAllocationEntry.class));
spec.getTargets().addAll(basicDeploScheduleConstraints.getExplorationTargets());
insertBasicConstraints(spec, basicDeploymentConstraints);
if(isDebugVerboseEnabled()) {
System.out.println("DeploScheduleRun");
}
solverRun = new DeploScheduleRun();
} else if(solutionTypes.contains(TaskToExecutionUnitAllocationTable.class)) {
// Add SMT-specific constraints to define the basic deployment problem.
spec.getTargets().addAll(createBasicSignalConstraints(spec.getSearchSpace()));
insertBasicConstraints(spec, basicDeploymentConstraints);
if(isDebugVerboseEnabled()) {
System.out.println("DeploymentRun");
}
solverRun = new DeploymentRun();
} else {
List<SMTConstraint> basicScheduleConstraints =
generatePureScheduleConstraints(superSets.get(ResourceAllocation.class),
superSets.get(ComponentToTaskAllocationEntry.class));
insertBasicConstraints(spec, basicScheduleConstraints);
if(isDebugVerboseEnabled()) {
System.out.println("ScheduleRun");
}
solverRun = new ScheduleRun();
}
if(spec.getTargets().isEmpty()) {
throw new Exception("No exploration targets defined. Cannot perform DSE.");
}
ExplorationSolution expSolution = solverRun.solve(spec, timeoutMS, monitor);
// remove basic constraints
spec.getTargets().removeAll(basicDeploymentConstraints);
return Optional.of(expSolution);
}
/** Inserts the given constraints at the beginning of the {@link ExplorationSpecification}. */
private void insertBasicConstraints(ExplorationSpecification spec,
List<SMTConstraint> basicCons) {
EList<ExplorationTarget<?>> targets = spec.getTargets();
List<ExplorationTarget<?>> temp = new ArrayList<>();
temp.addAll(targets);
spec.getTargets().clear();
spec.getTargets().addAll(basicCons);
spec.getTargets().addAll(temp);
}
/** Returns the cached solution representation (metrics/visualization + solution models). */
public DSESolutionVisualization getSolutionVisualization() {
return solutionVisualization;
......
BasicDeploScheduleConstraint.java c45ed3b3dcfd46140f17594da7bb41edf433796f GREEN
BasicDeploScheduleConstraint.java e70b87034c37317b5d422d7ac2f44239f8ae43a4 GREEN
BasicDeploymentConstraint.java ee43f8ad92f3c93d8ba1a742f4a9830c75ad0ce1 GREEN
BasicScheduleConstraint.java 7d08ab1735f7d2b1ef8afe6799739156bef07cb1 GREEN
ConstraintDefinitionUtils.java f110a4a216905d2236324ae459d789d50114e25c GREEN
BasicScheduleConstraint.java 3f39a2083d2eedf3be64fc224775e9ee2bd3224b GREEN
ConstraintDefinitionUtils.java 58bcd2b8998d3fd744ecabe5598c32b5222623d1 GREEN
ConstraintToNonQuantifiedSMT.java de0e8a7000e26d745b62a27f8c2482e7a7737add GREEN
ConstraintToQuantifiedSMT.java c84e799c69195fe80a2e66a39d0192325b06c7fd GREEN
DSMLTransformationService.java b2e90e11e36346d01c79c18f16ffc62f66f35888 GREEN
DSMLtoSMTTransformator.java 7a03c75f6d7baba392fee2c0f900fb7726854d72 GREEN
DSMLtoSMTTransformator.java d12c195177891f8959f28850626213e56b5b04c8 RED
DeploScheduleRun.java d074d157250deba431d8f34d13d6464fd27f8acb GREEN
DeploymentRun.java 67d240b1f02f906748811acad9ced9dd71e7cb56 GREEN
IDSMLTransformationService.java f56241d2dff68a69cd1fe09c119d615f74088650 GREEN
SMTTransformationUtils.java d2aa072852daffcf3c439db7da5c639d807715a5 GREEN
ScheduleRun.java 1ced7f48c5067d32e029f577ace10cdbc597ed2d GREEN
SolverRun.java f73a675bcddf8a999dad1c33ec540b182ad1549e GREEN
SolverRun.java d00f743a184793fc5253069ff771044baeaeeb06 GREEN
TimingConstraintDefinition.java fba63bf61c53e7e6606a95515c20a7205f288f36 GREEN
......@@ -30,6 +30,8 @@ import static org.fortiss.af3.exploration.smt.modeltransformation.ConstraintDefi
import static org.fortiss.af3.exploration.smt.modeltransformation.ConstraintDefinitionUtils.getSignal;
import static org.fortiss.af3.exploration.smt.modeltransformation.ConstraintDefinitionUtils.intersects;
import static org.fortiss.af3.exploration.smt.modeltransformation.ConstraintDefinitionUtils.isStronglyCausal;
import static org.fortiss.af3.exploration.smt.util.Z3ModelElementFactory.createSMTConstraint;
import static org.fortiss.af3.exploration.util.DSEProjectModelElementFactory.createRuleSet;
import static org.fortiss.af3.exploration.util.DSMLModelElementFactory.createAllocation;
import static org.fortiss.af3.exploration.util.DSMLModelElementFactory.createAnd;
import static org.fortiss.af3.exploration.util.DSMLModelElementFactory.createArithmeticLiteral;
......@@ -49,9 +51,12 @@ import static org.fortiss.af3.exploration.util.DSMLModelElementFactory.createOr;
import static org.fortiss.af3.exploration.util.DSMLModelElementFactory.createPlus;
import static org.fortiss.af3.exploration.util.DSMLModelElementFactory.createSet;
import static org.fortiss.af3.exploration.util.DSMLModelElementFactory.createSum;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import static org.fortiss.tooling.kernel.utils.UniqueIDUtils.prepareUniqueID;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.fortiss.af3.deployment.model.VirtualLink;
......@@ -84,8 +89,11 @@ import org.fortiss.af3.exploration.dsl_v2.model.function.ScheduledSignal;
import org.fortiss.af3.exploration.dsl_v2.model.function.ScheduledTask;
import org.fortiss.af3.exploration.dsl_v2.model.function.Start;
import org.fortiss.af3.exploration.dsl_v2.model.function.StronglyCausal;
import org.fortiss.af3.exploration.projectmodel.RuleSet;
import org.fortiss.af3.exploration.smt.model.DurationDummy;
import org.fortiss.af3.exploration.smt.model.SMTConstraint;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.schedule.model.ResourceAllocation;
import org.fortiss.af3.schedule.model.SchedulableEntity;
import org.fortiss.af3.schedule.model.SystemSchedule;
......@@ -93,7 +101,7 @@ import org.fortiss.af3.task.model.Message;
import org.fortiss.af3.task.model.Signal;
import org.fortiss.af3.task.model.Task;
import org.fortiss.af3.task.model.TaskOutputPort;
import org.fortiss.af3.task.model.allocation.ComponentToTaskAllocationTable;
import org.fortiss.af3.task.model.allocation.ComponentToTaskAllocationEntry;
import org.fortiss.tooling.base.model.element.IModelElement;
/**
......@@ -103,6 +111,49 @@ import org.fortiss.tooling.base.model.element.IModelElement;
*/
public class BasicDeploScheduleConstraint {
/** Generates standard schedule constraints for a deployment+scheduling run. */
public static RuleSet generateDeploScheduleConstraints(SuperSet<ResourceAllocation> resAllocSS,
SuperSet<Task> taskSS, SuperSet<Signal> signalSS, SuperSet<ExecutionUnit> ecuSS,
SuperSet<VirtualLink> vrtLinkSS, SuperSet<ComponentToTaskAllocationEntry> co2ta) {
RuleSet s = createRuleSet();
s.setImplicit(true);
s.setName("Implicit Basic Schedule Constraints");
s.setDate(new Date());
s.setAuthor("None");
s.setComment("Automatically added constraint.");
FileProject fileProject = getFirstParentWithType(co2ta, FileProject.class);
// creates constraints without unfolding of quantifiers
List<IBooleanExpression> assertions = new ArrayList<>();
assertions.addAll(createECUNonOverlappingConstraints(resAllocSS, taskSS, ecuSS));
assertions.addAll(createVLNonOverlappingConstraints(resAllocSS, signalSS, vrtLinkSS));
assertions.addAll(createCausalityConstraints(resAllocSS, taskSS, signalSS, ecuSS));
int i = 0;
for(IBooleanExpression a : assertions) {
SMTConstraint ts =
createSMTConstraint("Implicit Schedule Constraint " + i++, a, true, false);
s.getExplorationTargets().add(ts);
prepareUniqueID(ts, fileProject);
}
// creates constraints with unfolding of quantifiers
assertions = new ArrayList<>();
assertions.addAll(createStronglyCausalFunction(taskSS, co2ta));
assertions.addAll(createIsTaskFunction(resAllocSS));
assertions.addAll(createIntersectsFunction(vrtLinkSS));
assertions.addAll(createResAllocMapping(resAllocSS, taskSS, signalSS));
assertions.addAll(createDurationConstraints(resAllocSS, signalSS, ecuSS, vrtLinkSS));
assertions.addAll(createGreaterEqualZeroConstraints(resAllocSS));
for(IBooleanExpression a : assertions) {
SMTConstraint ts = createSMTConstraint("Implicit Schedule Constraint " + i++, a, true);
s.getExplorationTargets().add(ts);
prepareUniqueID(ts, fileProject);