User Tools

Site Tools


ptidej_solver

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ptidej_solver [2014/02/16 08:00]
yann
ptidej_solver [2017/09/06 01:54]
Line 1: Line 1:
-====== Ptidej Solver ====== 
  
-At the orgin of Ptidej was [[http://​www.informatik.uni-trier.de/​~ley/​pers/​hd/​a/​Albin=Amiot:​Herv=eacute=|Hervé Albin-Amiot]]'​s and my work on the specification of design motifs, the automated identification of their occurrences,​ and the automated generation of related code. The identification of occurrences of design motifs is performed using an explanation-based constraint solver, built on top of PaLM and [[http://​www.emn.fr/​z-info/​choco-solver/​|JChoco]]. Using Ptidej Solver, it is possible to identify occurrences of several built-in design motifs or other recurring patterns. ​ 
- 
-Typically, a call to the constraint solver is made like: 
- 
-<​code>​ 
-public class DesignMotifIdentificationCallerSimple { 
- public static void main(final String[] args) throws FileNotFoundException,​ 
- IOException { 
- 
- final String path = "​../​Ptidej Solver Tests/​rsc/​JHotDraw v5.2.jar";​ 
- final String name = "​JHotDraw v5.2.ini";​ 
- 
- final IIdiomLevelModel idiomLevelModel = 
- ModelGenerator.generateModelFromJAR(path);​ 
- final IWalker constraintModelBuilder = new Generator();​ 
- final List listOfModelEntities = 
- Manager.build(idiomLevelModel,​ constraintModelBuilder);​ 
- final Problem constraintProblem = 
- CompositeMotif.getProblem(listOfModelEntities);​ 
- 
- final Writer writer = ProxyDisk.getInstance().fileTempOutput(name);​ 
- constraintProblem.setWriter(new PrintWriter(writer));​ 
- constraintProblem.automaticSolve(true);​ 
- 
- final Reader reader = ProxyDisk.getInstance().fileTempInput(name);​ 
- final Properties properties = new Properties();​ 
- properties.load(new ReaderInputStream(reader));​ 
- final OccurrenceBuilder solutionBuilder = 
- OccurrenceBuilder.getInstance();​ 
- final Occurrence[] solutions = 
- solutionBuilder.getCanonicalOccurrences(properties);​ 
- 
- System.out.print("​Found "); 
- System.out.print(solutions.length);​ 
- System.out.println("​ solutions."​);​ 
- } 
-} 
-</​code>​ 
ptidej_solver.txt · Last modified: 2019/10/06 20:37 (external edit)