-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
A Nearest Neighbor Query in Time-Dependent Road Networks - MDM #20
Open
mirlabraga
wants to merge
86
commits into
InsightLab:master
Choose a base branch
from
mirlabraga:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
86 commits
Select commit
Hold shift + click to select a range
e006ad0
Adicionando artifato rcaller, para manipular as funções do R.
mirlabraga 4d3822c
Criando estutura de classes para manipular dos entradas para a geraçã…
mirlabraga 928b0c2
Manipulação como Banco de Dados. Consulta, aquivo de configuração e c…
mirlabraga beb8b0c
Gerado da função para cada aresta do grafo.
mirlabraga d1d7038
Classe com testes unitários para testes da biblioteca RCaller.
mirlabraga c3e3539
Criada primeira função após o uso do loess
mirlabraga 3cea3f2
Removido teste unitário para outra classe.
mirlabraga 43fd192
Finalizada função para o cálculo do tempo gasto para percorrer cada a…
mirlabraga a5272fd
Adicionado binário do R.
mirlabraga 1f66faf
Add configure of the DB, with file properties, DAO and class java
mirlabraga da10bc5
Create importer of the OSM Fortaleza/Ce-Brazil and ploted taxi into g…
mirlabraga 5d83a61
add postgis dependency and add configuration main class for service run.
mirlabraga 2906f3e
Removed classes referente of the solution piecewise.
mirlabraga 7c08382
Create classes with naive (Dijkstra) and
mirlabraga 6f2840f
chance member level of the method
mirlabraga 468a363
add util method double generatePdseurandom(int rangeMin, int rangeMax).
mirlabraga 760435f
add util method boolean isPointInEdgeLine(GraphBounds graph, Node po…
mirlabraga 4cf936a
set default value of category.
mirlabraga 02d7d36
Added data collection in nanoseconds
mirlabraga 6b464e8
Add test for verify cost edge
mirlabraga 8f54628
NearestNeighbor nearestNeighbor = null;
mirlabraga d701d35
define node with taxi and fixed erro cost edge
mirlabraga a458dd4
alterado biblioteca que coloca log.
mirlabraga 24ec194
add NumberVisitedNodes
mirlabraga 9d44e92
add parameter of the number visited nodes
mirlabraga a134c34
add cost in the graph
mirlabraga 4ac9faf
add parameter of the number visited nodes
mirlabraga d881d65
add parameter of the number visited nodes
mirlabraga a554c7f
create compare method synthetic analysis.
mirlabraga 8f4a07d
add parameter of the number visited nodes
mirlabraga 19989af
Milissegundo to Nanosegundos
mirlabraga 3fb8eeb
add travel time.
mirlabraga 3241e53
add travel time.
mirlabraga 00fd97c
logger
mirlabraga 8e3d433
Generalizado forma de passar o tamanho da rede. Por parametro.
mirlabraga e3e64fd
Alterado forma de capturar quantidade de nós visitados.
mirlabraga 4cdb87e
refactorado nome de variavel
mirlabraga dfca468
adicionando parametro para captura consumo de memoria total.
mirlabraga 68a79d8
Adicionada classe de Benchmark.
mirlabraga fca678f
Benchmark Memory.
mirlabraga bed2d54
Retirado comentários.
34ed185
Adicionando artifato rcaller, para manipular as funções do R.
mirlabraga 3979ce1
Criando estutura de classes para manipular dos entradas para a geraçã…
mirlabraga cdc71ad
Manipulação como Banco de Dados. Consulta, aquivo de configuração e c…
mirlabraga 3a630c3
Gerado da função para cada aresta do grafo.
mirlabraga bce4f3d
Classe com testes unitários para testes da biblioteca RCaller.
mirlabraga 26695f9
Criada primeira função após o uso do loess
mirlabraga ca60561
Removido teste unitário para outra classe.
mirlabraga fb5d3f7
Finalizada função para o cálculo do tempo gasto para percorrer cada a…
mirlabraga c131407
Adicionado binário do R.
mirlabraga 7b3b4f2
Add configure of the DB, with file properties, DAO and class java
mirlabraga ed12bed
Create importer of the OSM Fortaleza/Ce-Brazil and ploted taxi into g…
mirlabraga 4754268
add postgis dependency and add configuration main class for service run.
mirlabraga c7b2edb
Removed classes referente of the solution piecewise.
mirlabraga a48704c
Create classes with naive (Dijkstra) and
mirlabraga 137615b
chance member level of the method
mirlabraga 7c2201b
add util method double generatePdseurandom(int rangeMin, int rangeMax).
mirlabraga a422468
add util method boolean isPointInEdgeLine(GraphBounds graph, Node po…
mirlabraga 72549b3
set default value of category.
mirlabraga ecb98da
Added data collection in nanoseconds
mirlabraga d3effc0
Add test for verify cost edge
mirlabraga bdbf4ee
NearestNeighbor nearestNeighbor = null;
mirlabraga d59a922
define node with taxi and fixed erro cost edge
mirlabraga 5ecda12
alterado biblioteca que coloca log.
mirlabraga d736dca
add NumberVisitedNodes
mirlabraga 0d37048
add parameter of the number visited nodes
mirlabraga e0318a0
add cost in the graph
mirlabraga 8694d97
add parameter of the number visited nodes
mirlabraga 569b9f3
add parameter of the number visited nodes
mirlabraga e259917
create compare method synthetic analysis.
mirlabraga 30caf61
add parameter of the number visited nodes
mirlabraga d226e52
Milissegundo to Nanosegundos
mirlabraga f037ac9
add travel time.
mirlabraga a3e723a
add travel time.
mirlabraga 09bf2fa
logger
mirlabraga 31da478
Generalizado forma de passar o tamanho da rede. Por parametro.
mirlabraga f64919b
Alterado forma de capturar quantidade de nós visitados.
mirlabraga 240ff52
refactorado nome de variavel
mirlabraga 26da704
adicionando parametro para captura consumo de memoria total.
mirlabraga 294e609
Adicionada classe de Benchmark.
mirlabraga c4c5538
Benchmark Memory.
mirlabraga fbe8d5d
Retirado comentários.
e1a1ebb
Alterado GraphBoundsImpl para GraphImpl
mirlabraga 72fc90b
Merge branch 'master' of https://github.com/mirlabraga/graphast into …
mirlabraga f148dd2
Ocultando informações do bando de dados.
mirlabraga ddfc960
Removido arquivo de propriedades.
mirlabraga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ null | |
*.aux | ||
*.synctex* | ||
bin | ||
core/.RData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
core/src/main/java/org/graphast/importer/GraphGeneratorGrid.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
package org.graphast.importer; | ||
|
||
import java.math.BigDecimal; | ||
import java.math.RoundingMode; | ||
import java.util.HashSet; | ||
import java.util.Random; | ||
import java.util.Set; | ||
|
||
import org.graphast.model.Edge; | ||
import org.graphast.model.EdgeImpl; | ||
import org.graphast.model.GraphBounds; | ||
import org.graphast.model.GraphImpl; | ||
import org.graphast.model.Node; | ||
import org.graphast.model.NodeImpl; | ||
|
||
public class GraphGeneratorGrid { | ||
|
||
private int width; | ||
private int length; | ||
private GraphBounds graph; | ||
private double percentagemPoi; | ||
private BigDecimal distance_largura; | ||
private BigDecimal distance_altura; | ||
|
||
public GraphGeneratorGrid(String pathGraph, int width, int length, double percentualPoi) { | ||
this.width = width; | ||
this.length = length; | ||
this.percentagemPoi = percentualPoi; | ||
this.graph = new GraphImpl(pathGraph); | ||
} | ||
|
||
public GraphGeneratorGrid(String pathGraph, int size, double percentualPoi) { | ||
this(pathGraph, size, size, percentualPoi); | ||
} | ||
|
||
public void generateGraph() { | ||
plotNodes(); | ||
plotEdges(); | ||
graph.createBounds(); | ||
} | ||
|
||
private void plotNodes() { | ||
|
||
BigDecimal interador_largura = BigDecimal.valueOf(180).divide(BigDecimal.valueOf(width), 8, RoundingMode.HALF_UP); | ||
BigDecimal interador_altura = BigDecimal.valueOf(180).divide(BigDecimal.valueOf(length), 8, RoundingMode.HALF_UP); | ||
this.distance_largura = interador_largura; | ||
this.distance_altura = interador_altura; | ||
|
||
Set<Integer> listaIdsPoi = getListIdsPois(); | ||
|
||
Integer category = 0; | ||
for (int i = 0; i < width; i++) { | ||
BigDecimal latitude = interador_altura.multiply(BigDecimal.valueOf(i)).add(BigDecimal.valueOf(-90)); | ||
for (int j = 0; j < length; j++) { | ||
BigDecimal longitude = interador_largura.multiply(BigDecimal.valueOf(j)).add(BigDecimal.valueOf(-90));; | ||
Node node = new NodeImpl(Long.valueOf(category), latitude.doubleValue(), longitude.doubleValue()); | ||
if(listaIdsPoi.contains(category)) { | ||
int[] costs = new int[]{0}; | ||
node.setCategory(category); | ||
node.setExternalId(category); | ||
node.setLabel("CATEGORY "+category); | ||
node.setCosts(costs); | ||
listaIdsPoi.remove(category); | ||
} | ||
graph.addNode(node); | ||
category++; | ||
} | ||
} | ||
} | ||
|
||
private Set<Integer> getListIdsPois() { | ||
|
||
int quantidadeVerticesPoi = BigDecimal.valueOf(width).multiply(BigDecimal.valueOf(length)).multiply(BigDecimal.valueOf(percentagemPoi)).divide(BigDecimal.valueOf(100.0f), 8, RoundingMode.UP).intValue(); | ||
|
||
Set<Integer> listIdPoi = new HashSet<>(); | ||
do { | ||
int rangeMax = width*length - 1; | ||
Double idRandom = generatePdseurandom(0, rangeMax); | ||
listIdPoi.add(idRandom.intValue()); | ||
} while(listIdPoi.size()<quantidadeVerticesPoi); | ||
|
||
return listIdPoi; | ||
} | ||
|
||
|
||
private void plotEdges() { | ||
for (int i = 0; i < width*length - 1; i++) { | ||
|
||
//altura | ||
if(i < (width * length - width)) { | ||
|
||
Edge edgeOutTopDown = new EdgeImpl(Long.valueOf(i).longValue(), Long.valueOf(i+length).longValue(), distance_altura.intValue()); | ||
addCost(edgeOutTopDown); | ||
graph.addEdge(edgeOutTopDown); | ||
|
||
Edge edgeInTopDown = new EdgeImpl(Long.valueOf(i+length).longValue(), Long.valueOf(i).longValue(), distance_altura.intValue()); | ||
addCost(edgeInTopDown); | ||
graph.addEdge(edgeInTopDown); | ||
} | ||
|
||
//largura | ||
if(i%width != width - 1) { | ||
|
||
Edge edgeOutLeftRight = new EdgeImpl(Long.valueOf(i).longValue(), Long.valueOf(i+1).longValue(), distance_largura.intValue()); | ||
addCost(edgeOutLeftRight); | ||
graph.addEdge(edgeOutLeftRight); | ||
|
||
Edge edgeInLeftRight = new EdgeImpl(Long.valueOf(i+1).longValue(), Long.valueOf(i).longValue(), distance_largura.intValue()); | ||
addCost(edgeInLeftRight); | ||
graph.addEdge(edgeInLeftRight); | ||
|
||
} | ||
|
||
} | ||
} | ||
|
||
private double generatePdseurandom(int rangeMin, int rangeMax) { | ||
return rangeMin + (rangeMax - rangeMin) * new Random().nextDouble(); | ||
} | ||
|
||
private void addCost(Edge edge) { | ||
|
||
int distanceInMeters = edge.getDistance() * 100; | ||
int[] edgesCosts = CostGenerator.generateSyntheticEdgesCosts(distanceInMeters); | ||
edge.setCosts(edgesCosts); | ||
} | ||
|
||
public boolean isConnected() { | ||
return Boolean.TRUE; | ||
} | ||
|
||
public GraphBounds getGraph() { | ||
return graph; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
evitar as dependências de banco no core.
talvez possamos pensar no projeto graphast-postgres para integração com o postgres e postgis.
uma interface genérica DAO poderia ficar no core.