public WrappedBinaryMinHeap(int maxSize, int fanout, boolean classicalRemove) { this.delegate = new BinaryMinHeap<>(maxSize, fanout, classicalRemove); this.map = new IdentityHashMap<>(maxSize); }
public WrappedBinaryMinHeap(int maxSize) { this.delegate = new BinaryMinHeap<>(maxSize); this.map = new IdentityHashMap<>(maxSize); }
private MinHeap<HasIndex> createMinHeap(boolean classicalRemove) { MinHeap<HasIndex> pq = new BinaryMinHeap<HasIndex>(maxElements, BinaryMinHeap.defaultFanout, classicalRemove); return pq; }
@Override /*package*/ RouterPriorityQueue<? extends Node> createRouterPriorityQueue() { /* * Re-use existing BinaryMinHeap instead of creating a new one. For large networks (> 10^6 nodes and links) this reduced * the computation time by 40%! cdobler, oct'15 */ if (this.routingNetwork instanceof ArrayRoutingNetwork) { int size = this.routingNetwork.getNodes().size(); if (this.heap == null || this.maxSize != size) { this.maxSize = size; this.heap = new BinaryMinHeap<>(maxSize); return this.heap; } else { this.heap.reset(); return this.heap; } // int maxSize = this.routingNetwork.getNodes().size(); // return new BinaryMinHeap<ArrayRoutingNetworkNode>(maxSize); } else { return super.createRouterPriorityQueue(); } }
@Override /*package*/ RouterPriorityQueue<? extends Node> createRouterPriorityQueue() { /* * Re-use existing BinaryMinHeap instead of creating a new one. For large networks (> 10^6 nodes and links) this reduced * the computation time by 40%! cdobler, oct'15 */ if (this.routingNetwork instanceof ArrayRoutingNetwork) { int size = this.routingNetwork.getNodes().size(); if (this.heap == null || this.maxSize != size) { this.maxSize = size; this.heap = new BinaryMinHeap<>(maxSize); return this.heap; } else { this.heap.reset(); return this.heap; } } else { return super.createRouterPriorityQueue(); } }
@Override /*package*/ RouterPriorityQueue<? extends Node> createRouterPriorityQueue() { /* * Re-use existing BinaryMinHeap instead of creating a new one. For large networks (> 10^6 nodes and links) this reduced * the computation time by 40%! cdobler, oct'15 */ if (this.routingNetwork instanceof ArrayRoutingNetwork) { int size = this.routingNetwork.getNodes().size(); if (this.heap == null || this.maxSize != size) { this.maxSize = size; this.heap = new BinaryMinHeap<>(maxSize); return this.heap; } else { this.heap.reset(); return this.heap; } // int maxSize = this.routingNetwork.getNodes().size(); // return new BinaryMinHeap<ArrayRoutingNetworkNode>(maxSize); } else { return super.createRouterPriorityQueue(); } }
@Override /*package*/ RouterPriorityQueue<? extends Node> createRouterPriorityQueue() { /* * Re-use existing BinaryMinHeap instead of creating a new one. For large networks (> 10^6 nodes and links) this reduced * the computation time by 40%! cdobler, oct'15 */ if (this.routingNetwork instanceof ArrayRoutingNetwork) { int size = this.routingNetwork.getNodes().size(); if (this.heap == null || this.maxSize != size) { this.maxSize = size; this.heap = new BinaryMinHeap<>(maxSize); return this.heap; } else { this.heap.reset(); return this.heap; } // int maxSize = this.routingNetwork.getNodes().size(); // return new BinaryMinHeap<ArrayRoutingNetworkNode>(maxSize); } else { return super.createRouterPriorityQueue(); } }
public PointingAgent( final Person person, final ReplanningGroup group, final WeightCalculator weight) { this.id = person.getId(); this.records = new PlanRecord[ person.getPlans().size() ]; this.heap = new BinaryMinHeap<>( records.length ); int i = 0; for ( Plan p : person.getPlans() ) { records[ i ] = new PlanRecord( this, p, weight.getWeight( p, group ), // this is used by the binary heap to be efficient: // it asks the user to set the index of the element in the // internal array by himself. i); final boolean added = this.heap.add( records[ i ], // inverse priority: we want decreasing order -records[ i ].getWeight() ); if ( !added ) throw new RuntimeException(); i++; } }