-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the projectparmorel wiki!
This is a brief introduction on how to use the algorithm to repair models.
First, create an instance of a ModelFixer. You need to create a model fixer implementation that handle the type of model you want to handle. For now, the only implementation that exists is for Ecore. If you want to handle other model-types you can create an implementations as described here.
Example:
private ModelFixer modelFixer = new EcoreQModelFixer();
Second, you need to select some preferences. The preferences are fed to the algorithm through a List of PreferenceOptions. This is stored in the Q-table with their respecive ID's. The preferences are as follows:
| Integer | Meaning |
|---|---|
| 0 | Prefer shorter sequences of actions |
| 1 | Prefer longer sequences of actions |
| 2 | Prefer to repair higher in the context hierarchy |
| 3 | Prefer to repair lower in the context hierarchy |
| 4 | Punish deletion |
| 5 | Punish modification of the original model |
| 6 | Reward modification of the original model |
Retrieve a reference to the file containing the model you want to fix. The reference needs to be of type java.io.File.
First, set the preferences as a List of PreferenceOptions.
modelFixer.setPreferences(preferences);
Then, call fix model with the file as a parameter.
Solution optimalSolution = modelFixer.fixModel(modelfile);
the fixModel-method returns what it thinks is the optimal solutions based on the solutions weight. In reality, the algorithm remembers all the solutions calculated. These can be fetched by calling getPossibleSolutions() on the ModelFixer.
The Solution-object holds a reference to the sequence of all the actions performed to solve a given error, in order to achieve that specific solution. It also holds a reference to the original model and a temporary file with the possible solution. The file can be used to overwrite the current model, or the actions can be applied to the model.