Class SQLFunctionHeuristicPathFinderAbstract
- java.lang.Object
-
- com.arcadedb.query.sql.function.SQLFunctionAbstract
-
- com.arcadedb.query.sql.function.SQLFunctionConfigurableAbstract
-
- com.arcadedb.query.sql.function.math.SQLFunctionMathAbstract
-
- com.arcadedb.query.sql.function.graph.SQLFunctionHeuristicPathFinderAbstract
-
- All Implemented Interfaces:
SQLFunction
- Direct Known Subclasses:
SQLFunctionAstar
public abstract class SQLFunctionHeuristicPathFinderAbstract extends SQLFunctionMathAbstract
Abstract class to find paths between nodes using heuristic .- Author:
- Saeed Tabrizi (saeed a_t nowcando.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected CommandContext
context
protected static float
MIN
static String
PARAM_CUSTOM_HEURISTIC_FORMULA
static String
PARAM_D_FACTOR
static String
PARAM_DIRECTION
static String
PARAM_EDGE_TYPE_NAMES
static String
PARAM_EMPTY_IF_MAX_DEPTH
static String
PARAM_HEURISTIC_FORMULA
static String
PARAM_MAX_DEPTH
static String
PARAM_PARALLEL
static String
PARAM_TIE_BREAKER
static String
PARAM_VERTEX_AXIS_NAMES
protected String
paramCustomHeuristicFormula
protected Vertex
paramDestinationVertex
protected double
paramDFactor
protected Vertex.DIRECTION
paramDirection
protected String[]
paramEdgeTypeNames
protected Boolean
paramEmptyIfMaxDepth
protected SQLHeuristicFormula
paramHeuristicFormula
protected long
paramMaxDepth
protected Boolean
paramParallel
protected Vertex
paramSourceVertex
protected Boolean
paramTieBreaker
protected String[]
paramVertexAxisNames
protected static Random
rnd
protected List<Vertex>
route
-
Fields inherited from class com.arcadedb.query.sql.function.SQLFunctionConfigurableAbstract
configuredParameters
-
Fields inherited from class com.arcadedb.query.sql.function.SQLFunctionAbstract
name
-
-
Constructor Summary
Constructors Constructor Description SQLFunctionHeuristicPathFinderAbstract(String iName, int iMinParams, int iMaxParams)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Boolean
booleanOrDefault(Object fromObject, boolean defaultValue)
protected Double
doubleOrDefault(Object fromObject, double defaultValue)
double
gcdist(double lata, double longa, double latb, double longb)
protected double
getDiagonalHeuristicCost(double x, double y, double gx, double gy, double dFactor)
protected double
getDiagonalHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double dFactor)
protected abstract double
getDistance(Vertex node, Vertex parent, Vertex target)
protected double
getEuclideanHeuristicCost(double x, double y, double gx, double gy, double dFactor)
protected double
getEuclideanHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double dFactor)
protected double
getEuclideanNoSQRHeuristicCost(double x, double y, double gx, double gy, double dFactor)
protected double
getEuclideanNoSQRHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double dFactor)
protected abstract double
getHeuristicCost(Vertex node, Vertex parent, Vertex target, CommandContext iContext)
protected double
getManhatanHeuristicCost(double x, double y, double gx, double gy, double dFactor)
protected double
getManhatanHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double dFactor)
protected double
getMaxAxisHeuristicCost(double x, double y, double gx, double gy, double dFactor)
protected double
getMaxAxisHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double dFactor)
protected Set<Vertex>
getNeighbors(Vertex node)
protected LinkedList<Vertex>
getPath()
protected double
getSimpleHeuristicCost(double x, double g, double dFactor)
protected double
getTieBreakingHeuristicCost(double x, double y, double sx, double sy, double gx, double gy, double heuristic)
protected double
getTieBreakingHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double heuristic)
protected double
getTieBreakingRandomHeuristicCost(double x, double y, double sx, double sy, double gx, double gy, double heuristic)
protected Integer
integerOrDefault(Object fromObject, int defaultValue)
protected boolean
isVariableEdgeWeight()
protected Long
longOrDefault(Object fromObject, long defaultValue)
protected String[]
stringArray(Object fromObject)
protected String
stringOrDefault(Object fromObject, String defaultValue)
-
Methods inherited from class com.arcadedb.query.sql.function.math.SQLFunctionMathAbstract
aggregateResults, getClassWithMorePrecision, getContextValue
-
Methods inherited from class com.arcadedb.query.sql.function.SQLFunctionConfigurableAbstract
config, toString
-
Methods inherited from class com.arcadedb.query.sql.function.SQLFunctionAbstract
getName, getResult
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.arcadedb.query.sql.executor.SQLFunction
execute, getSyntax
-
-
-
-
Field Detail
-
PARAM_DIRECTION
public static final String PARAM_DIRECTION
- See Also:
- Constant Field Values
-
PARAM_EDGE_TYPE_NAMES
public static final String PARAM_EDGE_TYPE_NAMES
- See Also:
- Constant Field Values
-
PARAM_VERTEX_AXIS_NAMES
public static final String PARAM_VERTEX_AXIS_NAMES
- See Also:
- Constant Field Values
-
PARAM_PARALLEL
public static final String PARAM_PARALLEL
- See Also:
- Constant Field Values
-
PARAM_MAX_DEPTH
public static final String PARAM_MAX_DEPTH
- See Also:
- Constant Field Values
-
PARAM_HEURISTIC_FORMULA
public static final String PARAM_HEURISTIC_FORMULA
- See Also:
- Constant Field Values
-
PARAM_CUSTOM_HEURISTIC_FORMULA
public static final String PARAM_CUSTOM_HEURISTIC_FORMULA
- See Also:
- Constant Field Values
-
PARAM_D_FACTOR
public static final String PARAM_D_FACTOR
- See Also:
- Constant Field Values
-
PARAM_TIE_BREAKER
public static final String PARAM_TIE_BREAKER
- See Also:
- Constant Field Values
-
PARAM_EMPTY_IF_MAX_DEPTH
public static final String PARAM_EMPTY_IF_MAX_DEPTH
- See Also:
- Constant Field Values
-
rnd
protected static final Random rnd
-
paramParallel
protected Boolean paramParallel
-
paramTieBreaker
protected Boolean paramTieBreaker
-
paramEmptyIfMaxDepth
protected Boolean paramEmptyIfMaxDepth
-
paramEdgeTypeNames
protected String[] paramEdgeTypeNames
-
paramVertexAxisNames
protected String[] paramVertexAxisNames
-
paramSourceVertex
protected Vertex paramSourceVertex
-
paramDestinationVertex
protected Vertex paramDestinationVertex
-
paramHeuristicFormula
protected SQLHeuristicFormula paramHeuristicFormula
-
paramDirection
protected Vertex.DIRECTION paramDirection
-
paramMaxDepth
protected long paramMaxDepth
-
paramDFactor
protected double paramDFactor
-
paramCustomHeuristicFormula
protected String paramCustomHeuristicFormula
-
context
protected CommandContext context
-
MIN
protected static final float MIN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SQLFunctionHeuristicPathFinderAbstract
public SQLFunctionHeuristicPathFinderAbstract(String iName, int iMinParams, int iMaxParams)
-
-
Method Detail
-
gcdist
public double gcdist(double lata, double longa, double latb, double longb)
-
isVariableEdgeWeight
protected boolean isVariableEdgeWeight()
-
getHeuristicCost
protected abstract double getHeuristicCost(Vertex node, Vertex parent, Vertex target, CommandContext iContext)
-
getPath
protected LinkedList<Vertex> getPath()
-
getSimpleHeuristicCost
protected double getSimpleHeuristicCost(double x, double g, double dFactor)
-
getManhatanHeuristicCost
protected double getManhatanHeuristicCost(double x, double y, double gx, double gy, double dFactor)
-
getMaxAxisHeuristicCost
protected double getMaxAxisHeuristicCost(double x, double y, double gx, double gy, double dFactor)
-
getDiagonalHeuristicCost
protected double getDiagonalHeuristicCost(double x, double y, double gx, double gy, double dFactor)
-
getEuclideanHeuristicCost
protected double getEuclideanHeuristicCost(double x, double y, double gx, double gy, double dFactor)
-
getEuclideanNoSQRHeuristicCost
protected double getEuclideanNoSQRHeuristicCost(double x, double y, double gx, double gy, double dFactor)
-
getTieBreakingHeuristicCost
protected double getTieBreakingHeuristicCost(double x, double y, double sx, double sy, double gx, double gy, double heuristic)
-
getTieBreakingRandomHeuristicCost
protected double getTieBreakingRandomHeuristicCost(double x, double y, double sx, double sy, double gx, double gy, double heuristic)
-
getManhatanHeuristicCost
protected double getManhatanHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double dFactor)
-
getMaxAxisHeuristicCost
protected double getMaxAxisHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double dFactor)
-
getDiagonalHeuristicCost
protected double getDiagonalHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double dFactor)
-
getEuclideanHeuristicCost
protected double getEuclideanHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double dFactor)
-
getEuclideanNoSQRHeuristicCost
protected double getEuclideanNoSQRHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double dFactor)
-
getTieBreakingHeuristicCost
protected double getTieBreakingHeuristicCost(String[] axisNames, Map<String,Double> slist, Map<String,Double> clist, Map<String,Double> plist, Map<String,Double> glist, long depth, double heuristic)
-
-