Für Nico
This commit is contained in:
@@ -29,7 +29,7 @@ def Bogenlaenge(P1: NDArray, P2: NDArray) -> float:
|
||||
return s
|
||||
|
||||
|
||||
def gha2_ES(ell: EllipsoidTriaxial, P0: NDArray, Pk: NDArray, stepLenTarget: float = None, sigmaStep: float = 1e-7, stopeval: int = 1000, maxSteps: int = 10000, all_points: bool = False):
|
||||
def gha2_ES(ell: EllipsoidTriaxial, P0: NDArray, Pk: NDArray, stepLenTarget: float = None, sigmaStep: float = 1e-5, stopeval: int = 1000, maxSteps: int = 10000, all_points: bool = False):
|
||||
"""
|
||||
Berechnen der 2. GHA mithilfe der CMA-ES.
|
||||
Die CMA-ES optimiert sukzessive einzelne Punkte, die einen definierten Abstand (stepLenTarget) zum vorherigen und den kürzesten
|
||||
@@ -92,13 +92,12 @@ def gha2_ES(ell: EllipsoidTriaxial, P0: NDArray, Pk: NDArray, stepLenTarget: flo
|
||||
# sin(v);
|
||||
# sin(u)] auf
|
||||
# Einheitskugel
|
||||
# % arg_u = max(-1, min(1, q(3)));
|
||||
#arg_u = max(-1, min(1, q(3)));
|
||||
#
|
||||
# %Quadrantenabfrage
|
||||
# % u0 = mod(asin(arg_u) + pi / 2, pi) - pi / 2;
|
||||
# % v0 = atan2(q(2), q(1));
|
||||
# % xmean_init = [u0;
|
||||
# v0];
|
||||
#u0 = mod(asin(arg_u) + pi / 2, pi) - pi / 2;
|
||||
#v0 = atan2(q(2), q(1));
|
||||
#xmean_init = [u0;v0];
|
||||
xmean_init = ell.point_onto_ellipsoid(P_prev + stepLen * (P_end - P_prev) / np.linalg.norm(P_end - P_prev))
|
||||
|
||||
# [~, ~, aux] = geoLength(xmean_init);
|
||||
@@ -218,11 +217,12 @@ if __name__ == '__main__':
|
||||
beta1, lamb1 = (0.7, 0.3)
|
||||
P1 = ell.ell2cart(beta1, lamb1)
|
||||
|
||||
alpha0, alpha1, s, betas, lambs = gha2_num(ell, beta0, lamb0, beta1, lamb1, n=5000, all_points=True)
|
||||
alpha0, alpha1, s_num, betas, lambs = gha2_num(ell, beta0, lamb0, beta1, lamb1, n=10000, all_points=True)
|
||||
points_num = []
|
||||
for beta, lamb in zip(betas, lambs):
|
||||
points_num.append(ell.ell2cart(beta, lamb))
|
||||
points_num = np.array(points_num)
|
||||
|
||||
alpha0, alpha1, s, points = gha2_ES(ell, P0, P1)
|
||||
alpha0, alpha1, s, points = gha2_ES(ell, P0, P1, all_points=True, sigmaStep=1e-5)
|
||||
print(s - s_num)
|
||||
show_points(points, points_num, P0, P1)
|
||||
|
||||
Reference in New Issue
Block a user