Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node Order Barycenter Heuristic #777

Conversation

soerendomroes
Copy link
Contributor

@soerendomroes soerendomroes commented Aug 26, 2021

Adds a barycenter heuristic that first takes the node order into account.
Only the order of the dummy nodes is changed. All real nodes remain at the same position relative to the other real nodes.

TODO:

Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
correct exception, fixed copy-paste bug.

Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Also removes author tag and check for self loops.

Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
transitive.

Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Added a barycenter heuristic that takes a look at the model order first.

Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
@soerendomroes soerendomroes changed the title Node Order Barycenter Heuristic [WIP] Node Order Barycenter Heuristic Aug 27, 2021
@soerendomroes soerendomroes marked this pull request as draft August 27, 2021 07:47
sdo/trueModelOrderCrossingMinimization

Conflicts:
	plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/components/ComponentsProcessor.java
	plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/components/SimpleRowGraphPlacer.java
	plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/graph/transform/ElkGraphImporter.java
	plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/intermediate/SortByInputModelProcessor.java
	plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/intermediate/preserveorder/ModelOrderNodeComparator.java
	plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/p3order/LayerSweepCrossingMinimizer.java
	test/org.eclipse.elk.alg.layered.test/src/org/eclipse/elk/alg/layered/intermediate/BasicConsiderModelOrderTest.java
	test/org.eclipse.elk.alg.layered.test/src/org/eclipse/elk/alg/layered/p1cycles/BasicCycleBreakerTest.java

Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
@soerendomroes
Copy link
Contributor Author

The test failure is in ForsterConstraintResolverTest with tickets/layered/528_nodeEdgeOverlap.elkt. I cannot reproduce this failure locally.

Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
@soerendomroes
Copy link
Contributor Author

The Test after my test seems to fail (which is odd)

Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
@soerendomroes
Copy link
Contributor Author

It has to be the newly introduced option that is tested in the ModelOrderBarycenterHeuristicTest that is somehow responsible for the failure.

Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
@soerendomroes
Copy link
Contributor Author

Locally, after ModelOrderBarycenterHeuristicTest, LayerSweepCrossingMinimizerTest runs and after that runs ForsterConstraintResolverTest which fails in one case with:

java.lang.AssertionError
	at org.eclipse.elk.alg.layered.p3order.ForsterConstraintResolver.findViolatedConstraint(ForsterConstraintResolver.java:234)
	at org.eclipse.elk.alg.layered.p3order.ForsterConstraintResolver.processConstraints(ForsterConstraintResolver.java:150)
	at org.eclipse.elk.alg.layered.p3order.ForsterConstraintResolver.processConstraints(ForsterConstraintResolver.java:132)
	at org.eclipse.elk.alg.layered.p3order.BarycenterHeuristic.minimizeCrossings(BarycenterHeuristic.java:97)
	at org.eclipse.elk.alg.layered.p3order.BarycenterHeuristic.minimizeCrossings(BarycenterHeuristic.java:345)
	at org.eclipse.elk.alg.layered.p3order.LayerSweepCrossingMinimizer.sweepReducingCrossings(LayerSweepCrossingMinimizer.java:421)
	at org.eclipse.elk.alg.layered.p3order.LayerSweepCrossingMinimizer.minimizeCrossingsWithCounter(LayerSweepCrossingMinimizer.java:256)
	at org.eclipse.elk.alg.layered.p3order.LayerSweepCrossingMinimizer.compareDifferentRandomizedLayouts(LayerSweepCrossingMinimizer.java:215)
	at org.eclipse.elk.alg.layered.p3order.LayerSweepCrossingMinimizer.minimizeCrossings(LayerSweepCrossingMinimizer.java:148)
	at org.eclipse.elk.alg.layered.p3order.LayerSweepCrossingMinimizer.process(LayerSweepCrossingMinimizer.java:126)
	at org.eclipse.elk.alg.layered.p3order.LayerSweepCrossingMinimizer.process(LayerSweepCrossingMinimizer.java:1)
	at org.eclipse.elk.alg.layered.ElkLayered.layout(ElkLayered.java:608)
	at org.eclipse.elk.alg.layered.ElkLayered.doLayout(ElkLayered.java:144)
	at org.eclipse.elk.alg.layered.LayeredLayoutProvider.layout(LayeredLayoutProvider.java:56)
	at org.eclipse.elk.core.RecursiveGraphLayoutEngine.executeAlgorithm(RecursiveGraphLayoutEngine.java:250)
	at org.eclipse.elk.core.RecursiveGraphLayoutEngine.layoutRecursively(RecursiveGraphLayoutEngine.java:218)
	at org.eclipse.elk.core.RecursiveGraphLayoutEngine.layoutRecursively(RecursiveGraphLayoutEngine.java:200)
	at org.eclipse.elk.core.RecursiveGraphLayoutEngine.layout(RecursiveGraphLayoutEngine.java:96)
	at org.eclipse.elk.alg.test.framework.ExperimentStatement.evaluate(ExperimentStatement.java:82)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.elk.alg.test.framework.LayoutTestRunner.runChild(LayoutTestRunner.java:353)
	at org.eclipse.elk.alg.test.framework.LayoutTestRunner.runChild(LayoutTestRunner.java:1)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:206)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:161)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:84)
	at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:113)
	at org.eclipse.tycho.surefire.osgibooter.HeadlessTestApplication.run(HeadlessTestApplication.java:21)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:593)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:205)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

I know that it has something to do with the new option and not the test itself since everything works fine with the new test if it does not specify the new option. Also if I remove the necessary check in the BarycenterHeuristic it does fail as expected.

Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
@soerendomroes soerendomroes marked this pull request as ready for review March 21, 2022 15:05
@soerendomroes soerendomroes changed the title [WIP] Node Order Barycenter Heuristic Node Order Barycenter Heuristic Mar 21, 2022
@soerendomroes soerendomroes merged commit 68de8ea into eclipse:master Mar 21, 2022
Eddykasp pushed a commit to Eddykasp/elk that referenced this pull request Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant