Быстрый расчет фронта Pareto в PythonPython

Программы на Python
Anonymous
Быстрый расчет фронта Pareto в Python

Сообщение Anonymous »

У меня есть набор точек в трехмерном пространстве, из которого мне нужно найти границу Pareto. Скорость выполнения здесь очень важна, и время увеличивается очень быстро, когда я добавляю точки для тестирования. < /P>

Набор точек выглядит следующим образом: < /p>

Код: Выделить всё

[[0.3296170319979843, 0.0, 0.44472108843537406], [0.3296170319979843,0.0, 0.44472108843537406], [0.32920760896951373, 0.0, 0.4440408163265306], [0.32920760896951373, 0.0, 0.4440408163265306], [0.33815192743764166, 0.0, 0.44356462585034007]]
< /code>

Прямо сейчас я использую этот алгоритм: < /p>

def dominates(row, candidateRow):
return sum([row[x] >= candidateRow[x] for x in range(len(row))]) == len(row)

def simple_cull(inputPoints, dominates):
paretoPoints = set()
candidateRowNr = 0
dominatedPoints = set()
while True:
candidateRow = inputPoints[candidateRowNr]
inputPoints.remove(candidateRow)
rowNr = 0
nonDominated = True
while len(inputPoints) != 0 and rowNr < len(inputPoints):
row = inputPoints[rowNr]
if dominates(candidateRow, row):
# If it is worse on all features remove the row from the array
inputPoints.remove(row)
dominatedPoints.add(tuple(row))
elif dominates(row, candidateRow):
nonDominated = False
dominatedPoints.add(tuple(candidateRow))
rowNr += 1
else:
rowNr += 1

if nonDominated:
# add the non-dominated point to the Pareto frontier
paretoPoints.add(tuple(candidateRow))

if len(inputPoints) == 0:
break
return paretoPoints, dominatedPoints
Найдено здесь: http://code.activestate.com/recipes/578 ... eto-front/ написано Какой самый быстрый способ найти набор не доминирующих решений в ансамбле решений? Или, короче говоря, может ли Python добиться большего успеха, чем этот алгоритм?

Подробнее здесь: https://stackoverflow.com/questions/327 ... -in-python

Вернуться в «Python»