# Path: pomp/spaces/configurationspace.py
# class SingletonSubset(Set):
#     """A single point, with a distance given by a ConfigurationSpace.
#     """
#     def __init__(self,space,c):
#         self.space = space
#         self.c = c
# 
#     def contains(self,x):
#         return x == self.c
# 
#     def sample(self):
#         return self.c
# 
#     def project(self,x):
#         return self.c
# 
#     def signedDistance(self,x):
#         return self.space.distance(x,self.c)
# 
# class NeighborhoodSubset(Set):
#     """A ball of radius r around a point c, with a distance given by
#     a ConfigurationSpace.
#     """
#     def __init__(self,space,c,r):
#         self.space = space
#         self.c = c
#         self.r = r
# 
#     def contains(self,x):
#         return self.space.distance(x,self.c) <= self.r
# 
#     def sample(self):
#         return self.space.sampleNeighborhood(self.c,self.r)
# 
#     def project(self,x):
#         d = self.space.distance(x,self.c)
#         if d <= self.r: return x
#         return self.space.interpolate(x,self.c,(d-self.r)/d)
# 
#     def signedDistance(self,x):
#         d = self.space.distance(x,self.c)
#         return d - self.r
# 
# Path: pomp/spaces/metric.py
# def euclideanMetric(a,b):
# def L2Metric(a,b):
# def L1Metric(a,b):
# def LinfMetric(a,b):
#     def __init__(self,w):
#     def __call__(self,a,b):
#     def __init__(self,p):
#     def __call__(self,a,b):
# class WeightedEuclideanMetric:
# class LpMetric:


from ..spaces.controlspace import *
from ..spaces.configurationspace import SingletonSubset,NeighborhoodSubset
from ..spaces import metric
from . import allplanners

                 euclidean=False):
        self.space = space
        if isinstance(space,ControlSpace):
            self.controlSpace = space
            self.configurationSpace = space.configurationSpace()
        else:
            self.controlSpace = None
            self.configurationSpace = space
        if goalRadius != None and isinstance(goal,(list,tuple)):
            goal = NeighborhoodSubset(self.configurationSpace,goal,goalRadius)
        self.start = start
        self.goal = goal
        self.objective = objective
        self.visualizer = visualizer
        self.heuristic = heuristic
        self.costLowerBound = costLowerBound
        self.euclidean = euclidean

    def cartesian(self):
        return self.euclidean
    def pointToPoint(self):
        return isinstance(self.goal,SingletonSubset) or isinstance(goal,(list,tuple))
    def differentiallyConstrained(self):
        return self.controlSpace != None
    def planner(self,type,**params):
        d = metric.euclideanMetric if self.euclidean else self.configurationSpace.distance
        return allplanners.makePlanner(type,space=self.space,
                           start=self.start,goal=self.goal,
                           objective=self.objective,
                           heuristic=self.heuristic,

# Path: pomp/spaces/configurationspace.py
# class SingletonSubset(Set):
#     """A single point, with a distance given by a ConfigurationSpace.
#     """
#     def __init__(self,space,c):
#         self.space = space
#         self.c = c
# 
#     def contains(self,x):
#         return x == self.c
# 
#     def sample(self):
#         return self.c
# 
#     def project(self,x):
#         return self.c
# 
#     def signedDistance(self,x):
#         return self.space.distance(x,self.c)
# 
# class NeighborhoodSubset(Set):
#     """A ball of radius r around a point c, with a distance given by
#     a ConfigurationSpace.
#     """
#     def __init__(self,space,c,r):
#         self.space = space
#         self.c = c
#         self.r = r
# 
#     def contains(self,x):
#         return self.space.distance(x,self.c) <= self.r
# 
#     def sample(self):
#         return self.space.sampleNeighborhood(self.c,self.r)
# 
#     def project(self,x):
#         d = self.space.distance(x,self.c)
#         if d <= self.r: return x
#         return self.space.interpolate(x,self.c,(d-self.r)/d)
# 
#     def signedDistance(self,x):
#         d = self.space.distance(x,self.c)
#         return d - self.r
# 
# Path: pomp/spaces/metric.py
# def euclideanMetric(a,b):
# def L2Metric(a,b):
# def L1Metric(a,b):
# def LinfMetric(a,b):
#     def __init__(self,w):
#     def __call__(self,a,b):
#     def __init__(self,p):
#     def __call__(self,a,b):
# class WeightedEuclideanMetric:
# class LpMetric:


# Path: pomp/planners/problem.py
from ..spaces.controlspace import *
from ..spaces.configurationspace import SingletonSubset,NeighborhoodSubset
from ..spaces import metric
from . import allplanners

                 euclidean=False):
        self.space = space
        if isinstance(space,ControlSpace):
            self.controlSpace = space
            self.configurationSpace = space.configurationSpace()
        else:
            self.controlSpace = None
            self.configurationSpace = space
        if goalRadius != None and isinstance(goal,(list,tuple)):
            goal = NeighborhoodSubset(self.configurationSpace,goal,goalRadius)
        self.start = start
        self.goal = goal
        self.objective = objective
        self.visualizer = visualizer
        self.heuristic = heuristic
        self.costLowerBound = costLowerBound
        self.euclidean = euclidean

    def cartesian(self):
        return self.euclidean
    def pointToPoint(self):
        return isinstance(self.goal,SingletonSubset) or isinstance(goal,(list,tuple))
    def differentiallyConstrained(self):
        return self.controlSpace != None
    def planner(self,type,**params):
        d = metric.euclideanMetric if self.euclidean else self.configurationSpace.distance
        return allplanners.makePlanner(type,space=self.space,
                           start=self.start,goal=self.goal,
                           objective=self.objective,
                           heuristic=self.heuristic,

                           metric=d,
