martin-fleck / momot

Marrying Search-based Optimization and Model Transformation Technology
http://martin-fleck.github.io/momot/
17 stars 6 forks source link

Any bootstrap tutorials? #10

Closed liberion1994 closed 7 years ago

liberion1994 commented 7 years ago

Hi, I'm learning to use the momot, but find it difficult to make my own project from the very beginning, i.e. an empty directory. I've read the official website doc and some of the listed papers and have understand the main idea of the tool. But I'm rather confused about which files should I create manually and which files are generated automatically (and how ?). I'd be so appreciated if anyone can provide a simple startup tutorials for beginners like me.

Thanks.

martin-fleck commented 7 years ago

Hi,

Unfortunately, there are no real startup tutorials, but we do have some examples which you can try out to see how MOMoT is working. Specifically, I recommend you to look at the Class Responsibility Assignment example (at.ac.tuwien.big.momot.examples.cra) which is quite a small example but conveys the main idea of the tool and the artifacts involved. The CRA example is described in detail on our website which also features slides and a short video.

In summary, the basic steps used to solve a problem with MOMoT are as follows.

  1. For your setup, you need an Eclipse installation with the Eclipse Modeling Framework (EMF), Eclipse OCL, Xbase, Henshin and MOMoT installed.
  2. In your Eclipse workspace, you create a plugin project.
  3. Within the project, you create an Ecore metamodel describing your problem domain. Using the Ecore metamodel you can create a Genmodel to generate the model API in Java. The generated classes will be in the src-gen folder. In the CRA example, the problem consists of classes and features.
  4. You create a Henshin transformation based on your metamodel to describe how a model conforming to the metamodel can be adapted. In the CRA example, we reassign features between classes.
  5. You create an instance of your metamodel which describes the concrete problem instance you want to solve.
  6. You create a MOMoT file which links to the problem instance and specifies the fitness function, i.e., the objectives which you want to optimize and the algorithms with which you want to solve the problem. In the CRA example, we minimize coupling and maximize cohesion. The .momot file is automatically translated into a .java class in the xtend-gen folder. For many things in MOMoT, you can either specify them directly in the momot file or reference Java classes or methods. In the CRA example, we use static methods to specify the objective dimensions.
  7. Run the MOMoT file and check the console output and output files.

Hopefully, this will help you a bit. Unfortunately, I do not have the time to provide a more detailed tutorial right now. But if someone else is preparing one, we can feature it on the website.

Best wishes, Martin

liberion1994 commented 7 years ago

Martin: Thank you very much for the instructions. I followed the steps above & the video demo and tried to recreate the CRA project from the beginning and have nearly made it. The only problem is that after creating the .momot file, no corresponding .java file is generated. I wonder if it is responsible for me to do any extra operations or configurations to trigger the compiler. P.S. The example project can auto-translate so I think it's not eclipse config's fault.

Best wishes

liberion1994 commented 7 years ago

Finally after comparing my project and the example project I found mine lacked the "xtext builder". I just convert the project into an xtext project, where the builder appears and finally made it work. Thank you all the way for your kindness and patience.

martin-fleck-at commented 7 years ago

Ah sorry for not being able to reply earlier. Fantastic that you managed to get it to run yourself. If you have any further questions, just let me know. I will close this issue for now.