Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » Crossover operation by EMF Compare(How could EMF compare be used to facilitate Genetic Algorithm Operations?)
Crossover operation by EMF Compare [message #1834507] Wed, 11 November 2020 15:10 Go to next message
Meysam Karimi is currently offline Meysam KarimiFriend
Messages: 2
Registered: November 2020
Junior Member
Hi Folks,

I am trying to use EMF compare for crossover operation between two models. For whom may not familiar with crossover operation in GA, Crossover_(genetic_algorithm) page in Wikipedia can be useful.

To summarize the question, there are two model parents and we are going to have a single child from these two parents using Single-point crossover. Assume each model has 20 elements, the child is going to inherit first 10 elements from the first parent and the remaining elements from the second parent.

I see this is possible to use EMF Compare for comparison and merging the models. Is it possible to use EMF Compare to crossover? If so, would you give me some pseudo code or algorithm to do so?

Special thanks to you all.

[Updated on: Thu, 12 November 2020 04:15]

Report message to a moderator

Re: Crossover operation by EMF Compare [message #1834691 is a reply to message #1834507] Mon, 16 November 2020 08:22 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hello,

I am not sure exactly what crossover is, but if I don't think what you're trying to achieve fits a comparison engine. EMF Compare will detect differences between your two models, while what you're trying to achieve seems to be a merge that does not rely on diffs (take first 10 children from left, take 10 other children from right and create a composite model). I guess you might be able to reach that behavior by detecting all first 10 as "added in the left" and "removed from right" then merge everything toward the right so that EMF Compare will first delete these 10 elements then re-add them exactly as they are in the left model... but I'm not sure this is what you want.

Please elaborate if you think EMF Compare might fit the requirement, I might be able to point you in the right direction but for now I'm not really sure what you plan on doing and what your input models are.

Regards,

Laurent Goubet
Obeo
Re: Crossover operation by EMF Compare [message #1834706 is a reply to message #1834691] Mon, 16 November 2020 15:26 Go to previous messageGo to next message
Meysam Karimi is currently offline Meysam KarimiFriend
Messages: 2
Registered: November 2020
Junior Member
Hello Mr. Goubet,

Thank you for your reply and clever solution. The crossover idea is simple: create a child from two parents exactly same as a human that inherit from its own parents. There are two models(parents) conform a meta-model. The idea is creating a child that inherit from its parents. Simplest one would be inherit half from left parent and the other half from the right parent.

I think your solution can be the answer. There are some questions that it would be great if you can help me please.
1- How could I set a point in each parent models and say I (do not) want the EObjects before/after that point? Do I need pick 10 random Eobjects from each parent or I can determine a point in left/right parent and say give EObjects before/after this point?
2- If I just set a point or pick random EObjects, maybe the offspring would not conform the meta-model anymore. What would be your suggestion to migrate the child model to the nearest model that would conform the meta-model?

Thank you again for your consideration.
Sincerely,
Meysam Karimi
Re: Crossover operation by EMF Compare [message #1834990 is a reply to message #1834706] Mon, 23 November 2020 08:25 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hello,

1 - You will have to look at how the DiffEngine is implemented I believe your entry point here would be org.eclipse.emf.compare.diff.DefaultDiffEngine.computeContainmentDifferences(Match, EReference, boolean) ) and implement your own arbitrary rule as to which elements from either side needs to be detected as an addition so that the merge will take them later. Note that if the elements you want to be "distinct" and thus "added" are currently matched by EMF Compare, you will also have to customize the MatchEngine in order to prevent these objects to be matched together.

2 - As long as these children EObjects are within a given container in either side, it means that it conforms to the metamodel and thus the result of a merge should still be conformant, what kind of rule would be violated by merging?

Laurent Goubet
Obeo
Previous Topic:equalityHelperExtensionProvider extension point ignored
Next Topic:AbstractChangeFactory.fillRequiredDifferences() may cause circular dependencies
Goto Forum:
  


Current Time: Fri Apr 19 19:30:32 GMT 2024

Powered by FUDForum. Page generated in 0.02862 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top