コード例 #1
0
ファイル: testPoly2.py プロジェクト: edwintye/pygotools
    listD[i] = polyListOptim[i].getMeasure()

G, h = polyListOptim[207].getInequality()
G.dot(polyListOptim[207].getLocation()) - h.flatten()

polyObj = polyOperation.PolygonObj(optimTestFun.rosen, A, b)

polyList = polyOperation.divideGivenPolygon(optimTestFun.rosen, polyObj)

polyObj = polyListOptim[25]

polyObj._location
hull = scipy.spatial.ConvexHull(polyObj._V)

x, sol, G, h = polyOperation.findAnalyticCenter(hull.equations[:, 0:2],
                                                -hull.equations[:, 2],
                                                full_output=True)

for i in potentialIndex:
    print polyListOptim[i].getLocation()
    print polyListOptim[i].hasSplit()

print polyListOptim[6].getVertices()
print polyListOptim[6].getLocation()

for o in polyListOptim:
    print o.hasSplit()

minIndex = directUtil.findLowestObjIndex(polyListOptim)

polyListOptim[minIndex].getFx()
コード例 #2
0
ファイル: testPoly.py プロジェクト: etyephe/pygotools
# Gx \precceq h
# numpy.array(h).flatten() - numpy.array(G).dot(x)
# so we are expecting everything to be positive

print numpy.array(h).flatten() - numpy.array(G).dot(x)

redundantIndex = polyOperation.redundantConstraintBox(boxBounds, A, b)
bindingIndex = polyOperation.bindingConstraintBox(boxBounds, A, b)

origin = h - G * matrix(x)

bindingIndex, hull, newG, newh = polyOperation.bindingConstraintBox(boxBounds, A, b, full_output=True)

x1, sol1, G1, h1 = polyOperation.findAnalyticCenter(
    newG[bindingIndex.tolist(), :], newh[bindingIndex.tolist()], full_output=True
)


# first we find the origins
origin = h - G * matrix(x1)

# construct the set of points
D = mul(origin[:, [0, 0]] ** -1, G)

import scipy.spatial
import matplotlib.pyplot as plt

hull = scipy.spatial.ConvexHull(D)

points = numpy.array(D)
コード例 #3
0
# Gx \precceq h
# numpy.array(h).flatten() - numpy.array(G).dot(x)
# so we are expecting everything to be positive

print numpy.array(h).flatten() - numpy.array(G).dot(x)

redundantIndex = polyOperation.redundantConstraintBox(boxBounds, A, b)
bindingIndex = polyOperation.bindingConstraintBox(boxBounds, A, b)

origin = h - G * matrix(x)

bindingIndex, hull, newG, newh = polyOperation.bindingConstraintBox(
    boxBounds, A, b, full_output=True)

x1, sol1, G1, h1 = polyOperation.findAnalyticCenter(
    newG[bindingIndex.tolist(), :],
    newh[bindingIndex.tolist()],
    full_output=True)

# first we find the origins
origin = h - G * matrix(x1)

# construct the set of points
D = mul(origin[:, [0, 0]]**-1, G)

import scipy.spatial
import matplotlib.pyplot as plt

hull = scipy.spatial.ConvexHull(D)

points = numpy.array(D)
コード例 #4
0
ファイル: testPoly2.py プロジェクト: edwintye/pygotools
G,h = polyListOptim[207].getInequality()
G.dot(polyListOptim[207].getLocation()) - h.flatten()

polyObj = polyOperation.PolygonObj(optimTestFun.rosen,A,b)

polyList = polyOperation.divideGivenPolygon(optimTestFun.rosen,polyObj)



polyObj = polyListOptim[25]

polyObj._location
hull = scipy.spatial.ConvexHull(polyObj._V)

x,sol,G,h = polyOperation.findAnalyticCenter(hull.equations[:,0:2],-hull.equations[:,2],full_output=True)


for i in potentialIndex:
    print polyListOptim[i].getLocation()
    print polyListOptim[i].hasSplit()

print polyListOptim[6].getVertices()
print polyListOptim[6].getLocation()

for o in polyListOptim:
    print o.hasSplit()


minIndex = directUtil.findLowestObjIndex(polyListOptim)