On branch master

Changes to be committed:
	modified:   be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java
	modified:   be-graphes-algos/src/main/java/org/insa/graphs/algorithm/utils/BinaryHeap.java
	new file:   be-graphes-algos/src/main/java/org/insa/graphs/algorithm/utils/Label.java
	new file:   be-graphes-model/src/main/java/org/insa/graphs/model/Label.java
このコミットが含まれているのは:
Jdihadi Ahamdy 2020-05-03 16:15:46 +02:00
コミット 43c08bf88e
4個のファイルの変更100行の追加3行の削除

ファイルの表示

@ -1,5 +1,16 @@
package org.insa.graphs.algorithm.shortestpath;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import org.insa.graphs.model.Arc;
import org.insa.graphs.model.Graph;
import org.insa.algo.AbstractSolution.Status;
import org.insa.algo.utils.*;
import org.insa.graph.*;
public class DijkstraAlgorithm extends ShortestPathAlgorithm {
public DijkstraAlgorithm(ShortestPathData data) {
@ -8,8 +19,28 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
@Override
protected ShortestPathSolution doRun() {
final ShortestPathData data = getInputData();
ShortestPathSolution solution = null;
// Initialisation
// du graphe
final ShortestPathData data = getInputData();
Graph graph = data.getGraph();
final int nbNodes = graph.size();
// des couts
double[] distances = new double[nbNodes];
Arrays.fill(distances, Double.POSITIVE_INFINITY);
distances[data.getOrigin().getId()] = 0;
// Notify observers about the first event (origin processed).
notifyOriginProcessed(data.getOrigin());
// Initialize array of predecessors.
Arc[] predecessorArcs = new Arc[nbNodes];
while (solution == null) { //Tant qu'il y a pas de solution
}
// TODO:
return solution;
}

ファイルの表示

@ -137,8 +137,26 @@ public class BinaryHeap<E extends Comparable<E>> implements PriorityQueue<E> {
@Override
public void remove(E x) throws ElementNotFoundException {
// TODO:
}
int index;
int lastindex;
E lastItem;
if(this.isEmpty())
throw new ElementNotFoundException(x);
else {
index = this.array.indexOf(x);
if(index == -1 || index >= this.currentSize) {
throw new ElementNotFoundException(x);
}
else {
lastindex=--this.currentSize;
lastItem = this.array.get(lastindex);
this.array.set(index, lastItem);
this.percolateDown(index);
this.percolateUp(index);
}
}
}
@Override
public E findMin() throws EmptyPriorityQueueException {

ファイルの表示

@ -0,0 +1,38 @@
package org.insa.graphs.algorithm.utils;
import org.insa.graphs.model.Node;
public class Label {
private boolean mark;
private int cost;
private Node father;
private Node nodes;
public Label(Node noeud) {
this.nodes=noeud;
this.mark=false;
this.cost=100000;
this.father=null;
}
public int getCost() {
return this.cost;
}
public boolean getMark() {
return this.mark;
}
public Node getfather() {
return this.father;
}
public boolean setMark() {
return this.mark=true;
}
}

ファイルの表示

@ -0,0 +1,10 @@
package org.insa.graphs.model;
public class Label {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}