private List < Variable > force ( final Formula formula , final Hypergraph < Variable > hypergraph , final Map < Variable , HypergraphNode < Variable > > nodes ) { final LinkedHashMap < HypergraphNode < Variable > , Integer > initialOrdering = createInitialOrdering ( formula , nodes ) ; LinkedHashMap < HypergraphNode < Variable > , Integer > lastOrdering ; LinkedHashMap < HypergraphNode < Variable > , Integer > currentOrdering = initialOrdering ; do { lastOrdering = currentOrdering ; final LinkedHashMap < HypergraphNode < Variable > , Double > newLocations = new LinkedHashMap <> ( ) ; for ( final HypergraphNode < Variable > node : hypergraph . nodes ( ) ) newLocations . put ( node , node . computeTentativeNewLocation ( lastOrdering ) ) ; currentOrdering = orderingFromTentativeNewLocations ( newLocations ) ; } while ( shouldProceed ( lastOrdering , currentOrdering ) ) ; final Variable [ ] ordering = new Variable [ currentOrdering . size ( ) ] ; for ( final Map . Entry < HypergraphNode < Variable > , Integer > entry : currentOrdering . entrySet ( ) ) ordering [ entry . getValue ( ) ] = entry . getKey ( ) . content ( ) ; return Arrays . asList ( ordering ) ; }
Executes the main FORCE algorithm .