In [52]:
import sys
sys.path.append('../')
from Trajectory import Point_Lander
from Optimisation import Hermite_Simpson_Seperated
from numpy import *
from PyGMO import *
import matplotlib.pyplot as plt
from pandas import *

In [2]:
model = Point_Lander()
prob  = Hermite_Simpson_Seperated(model, nsegs=10)

In [ ]:
zguess = prob.Guess.Ballistic(tf=25)
tf, sb, cb, s, c = prob.Decode(zguess)
plt.plot(s[:,0], s[:,1], 'k.-')
plt.show()

In [ ]:
algo = algorithm.scipy_slsqp(max_iter=4000, screen_output=True)
algo1 = algorithm.mbh(algo, stop=1)

In [ ]:
pop = population(prob)
pop.push_back(zguess)

In [ ]:
pop = algo1.evolve(pop)

In [ ]:
tf, sb, cb, s, c = prob.Decode(pop.champion.x)
plt.plot(s[:,0], s[:,1], 'k.-')
plt.show()
plt.plot(cb[:,0],'k.-')
plt.show()

In [ ]:
z = pop.champion.x
save('../Data/HSS/10Seg/HSS_10_Base', z)

In [ ]:
algo = algorithm.scipy_slsqp(max_iter=4000, screen_output=True)
algo1 = algorithm.mbh(algo, stop=1)
fpath = "../Data/HSS/10Seg/"
z = load(fpath + 'HSS_10_Base.npy')
s = array([10, 1000, 20, -5, 9500])
ds = s/500.
ntraj=10000
for i in range(ntraj):
    print("Initial State: " + str(s))
    model = Point_Lander(s)
    prob  = Hermite_Simpson_Seperated(model, nsegs=10)
    pop   = population(prob)
    pop.push_back(z)
    pop   = algo.evolve(pop)
    z     = pop.champion.x
    save(fpath + 'HSS_10_' + str(i), z)
    n = random.rand(model.sdim) - random.rand(model.sdim)
    s = n*ds + s


Initial State: [  10 1000   20   -5 9500]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.242405E+03     1.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: -9242.40469133
            Iterations: 1
            Function evaluations: 171
            Gradient evaluations: 1
Initial State: [  9.98921253e+00   1.00077734e+03   2.00078929e+01  -4.99811426e+00
   9.50006901e+03]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.242405E+03     1.000000E+00
    2   342    -9.242312E+03     1.000000E+00
    3   513    -9.242347E+03     1.000000E+00
    4   684    -9.242356E+03     1.000000E+00
    5   855    -9.242376E+03     1.000000E+00
    6  1026    -9.242374E+03     1.000000E+00
    7  1197    -9.242374E+03     1.000000E+00
    8  1368    -9.242374E+03     1.000000E+00
    9  1539    -9.242374E+03     1.000000E+00
   10  1710    -9.242374E+03     1.000000E+00
   11  1881    -9.242374E+03     1.000000E+00
   12  2052    -9.242374E+03     1.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: -9242.37371619
            Iterations: 12
            Function evaluations: 2053
            Gradient evaluations: 12
Initial State: [  9.99970644e+00   1.00042445e+03   2.00109939e+01  -4.99576467e+00
   9.49513882e+03]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.242374E+03     1.000000E+00
    2   342    -9.237607E+03     1.000000E+00
    3   513    -9.237607E+03     1.000000E+00
    4   684    -9.237607E+03     1.000000E+00
    5   855    -9.237607E+03     1.000000E+00
    6  1026    -9.237607E+03     1.000000E+00
    7  1197    -9.237607E+03     1.000000E+00
    8  1368    -9.237607E+03     1.000000E+00
    9  1539    -9.237607E+03     1.000000E+00
   10  1710    -9.237607E+03     1.000000E+00
   11  1881    -9.237607E+03     1.000000E+00
   12  2052    -9.237607E+03     1.000000E+00
   13  2223    -9.237607E+03     1.000000E+00
   14  2394    -9.237607E+03     1.000000E+00
   15  2565    -9.237607E+03     1.000000E+00
   16  2736    -9.237607E+03     1.000000E+00
   17  2907    -9.237607E+03     1.000000E+00
   18  3078    -9.237607E+03     1.000000E+00
   19  3249    -9.237607E+03     1.000000E+00
   20  3420    -9.237607E+03     1.000000E+00
   21  3591    -9.237607E+03     1.000000E+00
   22  3763    -9.237607E+03     1.000000E+00
   23  3935    -9.237607E+03     1.000000E+00
   24  4107    -9.237607E+03     1.000000E+00
   25  4279    -9.237607E+03     1.000000E+00
   26  4451    -9.237607E+03     1.000000E+00
   27  4623    -9.237607E+03     1.000000E+00
   28  4795    -9.237607E+03     1.000000E+00
   29  4967    -9.237607E+03     1.000000E+00
   30  5139    -9.237607E+03     1.000000E+00
   31  5311    -9.237607E+03     1.000000E+00
   32  5482    -9.237607E+03     1.000000E+00
   33  5653    -9.237607E+03     1.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: -9237.60731795
            Iterations: 33
            Function evaluations: 5653
            Gradient evaluations: 33
Initial State: [  9.98837728e+00   9.99875836e+02   2.00383426e+01  -4.99928806e+00
   9.49249748e+03]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.237607E+03     1.000000E+00
    2   342    -9.235007E+03     1.000000E+00
    3   513    -9.235007E+03     1.000000E+00
    4   684    -9.235007E+03     1.000000E+00
    5   855    -9.235007E+03     1.000000E+00
    6  1026    -9.235007E+03     1.000000E+00
    7  1197    -9.235007E+03     1.000000E+00
    8  1368    -9.235007E+03     1.000000E+00
    9  1539    -9.235007E+03     1.000000E+00
   10  1710    -9.235007E+03     1.000000E+00
   11  1881    -9.235007E+03     1.000000E+00
   12  2052    -9.235007E+03     1.000000E+00
   13  2223    -9.235007E+03     1.000000E+00
   14  2394    -9.235007E+03     1.000000E+00
   15  2565    -9.235007E+03     1.000000E+00
   16  2736    -9.235007E+03     1.000000E+00
   17  2907    -9.235007E+03     1.000000E+00
   18  3079    -9.235007E+03     1.000000E+00
   19  3251    -9.235008E+03     1.000000E+00
   20  3423    -9.235008E+03     1.000000E+00
   21  3595    -9.235008E+03     1.000000E+00
   22  3767    -9.235008E+03     1.000000E+00
   23  3939    -9.235008E+03     1.000000E+00
   24  4110    -9.235008E+03     1.000000E+00
   25  4281    -9.235008E+03     1.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: -9235.00754685
            Iterations: 25
            Function evaluations: 4281
            Gradient evaluations: 25
Initial State: [  9.97111911e+00   1.00030561e+03   2.00315830e+01  -4.99707039e+00
   9.48061103e+03]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.237607E+03     1.000000E+00
    2   342    -9.223445E+03     1.000000E+00
    3   513    -9.223445E+03     1.000000E+00
    4   684    -9.223445E+03     1.000000E+00
    5   855    -9.223445E+03     1.000000E+00
    6  1026    -9.223445E+03     1.000000E+00
    7  1197    -9.223445E+03     1.000000E+00
    8  1368    -9.223445E+03     1.000000E+00
    9  1539    -9.223445E+03     1.000000E+00
   10  1710    -9.223445E+03     1.000000E+00
   11  1881    -9.223445E+03     1.000000E+00
   12  2052    -9.223445E+03     1.000000E+00
   13  2223    -9.223445E+03     1.000000E+00
   14  2394    -9.223445E+03     1.000000E+00
   15  2565    -9.223445E+03     1.000000E+00
   16  2736    -9.223445E+03     1.000000E+00
   17  2907    -9.223445E+03     1.000000E+00
   18  3078    -9.223445E+03     1.000000E+00
   19  3249    -9.223445E+03     1.000000E+00
   20  3420    -9.223445E+03     1.000000E+00
   21  3591    -9.223445E+03     1.000000E+00
   22  3762    -9.223445E+03     1.000000E+00
   23  3934    -9.223445E+03     1.000000E+00
   24  4106    -9.223445E+03     1.000000E+00
   25  4278    -9.223446E+03     1.000000E+00
   26  4450    -9.223446E+03     1.000000E+00
   27  4622    -9.223446E+03     1.000000E+00
   28  4794    -9.223446E+03     1.000000E+00
   29  4965    -9.223446E+03     1.000000E+00
   30  5136    -9.223446E+03     1.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: -9223.44558986
            Iterations: 30
            Function evaluations: 5136
            Gradient evaluations: 30
Initial State: [  9.95940109e+00   1.00006885e+03   2.00141063e+01  -4.99561188e+00
   9.47003793e+03]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.237607E+03     1.000000E+00
    2   342    -9.213256E+03     1.000000E+00
    3   513    -9.213254E+03     1.000000E+00
    4   684    -9.213254E+03     1.000000E+00
    5   855    -9.213254E+03     1.000000E+00
    6  1026    -9.213254E+03     1.000000E+00
    7  1197    -9.213254E+03     1.000000E+00
    8  1368    -9.213254E+03     1.000000E+00
    9  1539    -9.213254E+03     1.000000E+00
   10  1710    -9.213254E+03     1.000000E+00
   11  1881    -9.213255E+03     1.000000E+00
   12  2052    -9.213255E+03     1.000000E+00
   13  2223    -9.213255E+03     1.000000E+00
   14  2394    -9.213255E+03     1.000000E+00
   15  2565    -9.213255E+03     1.000000E+00
   16  2736    -9.213255E+03     1.000000E+00
   17  2907    -9.213255E+03     1.000000E+00
   18  3078    -9.213255E+03     1.000000E+00
   19  3249    -9.213255E+03     1.000000E+00
   20  3420    -9.213255E+03     1.000000E+00
   21  3591    -9.213255E+03     1.000000E+00
   22  3762    -9.213255E+03     1.000000E+00
   23  3933    -9.213255E+03     1.000000E+00
   24  4105    -9.213255E+03     1.000000E+00
   25  4277    -9.213256E+03     1.000000E+00
   26  4449    -9.213256E+03     1.000000E+00
   27  4621    -9.213256E+03     1.000000E+00
   28  4792    -9.213256E+03     1.000000E+00
   29  4963    -9.213256E+03     1.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: -9213.25575878
            Iterations: 29
            Function evaluations: 4963
            Gradient evaluations: 29
Initial State: [  9.95802700e+00   9.99222890e+02   2.00099691e+01  -5.00116875e+00
   9.46299129e+03]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.237607E+03     1.000000E+00
    2   342    -9.206506E+03     1.000000E+00
    3   513    -9.206502E+03     1.000000E+00
    4   684    -9.206502E+03     1.000000E+00
    5   855    -9.206502E+03     1.000000E+00
    6  1026    -9.206502E+03     1.000000E+00
    7  1198    -9.206502E+03     1.000000E+00
    8  1369    -9.206502E+03     1.000000E+00
    9  1540    -9.206502E+03     1.000000E+00
   10  1711    -9.206502E+03     1.000000E+00
   11  1882    -9.206503E+03     1.000000E+00
   12  2053    -9.206503E+03     1.000000E+00
   13  2224    -9.206503E+03     1.000000E+00
   14  2395    -9.206503E+03     1.000000E+00
   15  2566    -9.206503E+03     1.000000E+00
   16  2737    -9.206503E+03     1.000000E+00
   17  2908    -9.206503E+03     1.000000E+00
   18  3079    -9.206503E+03     1.000000E+00
   19  3250    -9.206503E+03     1.000000E+00
   20  3422    -9.206503E+03     1.000000E+00
   21  3594    -9.206503E+03     1.000000E+00
   22  3766    -9.206503E+03     1.000000E+00
   23  3938    -9.206503E+03     1.000000E+00
   24  4110    -9.206503E+03     1.000000E+00
   25  4282    -9.206504E+03     1.000000E+00
   26  4454    -9.206504E+03     1.000000E+00
   27  4626    -9.206504E+03     1.000000E+00
   28  4798    -9.206505E+03     1.000000E+00
   29  4970    -9.206505E+03     1.000000E+00
   30  5142    -9.206505E+03     1.000000E+00
   31  5314    -9.206506E+03     1.000000E+00
   32  5485    -9.206506E+03     1.000000E+00
   33  5656    -9.206506E+03     1.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: -9206.5056361
            Iterations: 33
            Function evaluations: 5656
            Gradient evaluations: 33
Initial State: [  9.95796125e+00   9.98943398e+02   2.00031289e+01  -4.99571873e+00
   9.46649702e+03]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.237607E+03     1.000000E+00
    2   342    -9.209958E+03     1.000000E+00
    3   513    -9.209954E+03     1.000000E+00
    4   684    -9.209954E+03     1.000000E+00
    5   855    -9.209954E+03     1.000000E+00
    6  1026    -9.209954E+03     1.000000E+00
    7  1198    -9.209954E+03     1.000000E+00
    8  1369    -9.209954E+03     1.000000E+00
    9  1540    -9.209954E+03     1.000000E+00
   10  1711    -9.209954E+03     1.000000E+00
   11  1882    -9.209955E+03     1.000000E+00
   12  2053    -9.209955E+03     1.000000E+00
   13  2224    -9.209955E+03     1.000000E+00
   14  2395    -9.209955E+03     1.000000E+00
   15  2566    -9.209955E+03     1.000000E+00
   16  2737    -9.209955E+03     1.000000E+00
   17  2908    -9.209955E+03     1.000000E+00
   18  3079    -9.209955E+03     1.000000E+00
   19  3250    -9.209955E+03     1.000000E+00
   20  3422    -9.209955E+03     1.000000E+00
   21  3593    -9.209955E+03     1.000000E+00
   22  3764    -9.209955E+03     1.000000E+00
   23  3935    -9.209955E+03     1.000000E+00
   24  4107    -9.209956E+03     1.000000E+00
   25  4279    -9.209956E+03     1.000000E+00
   26  4451    -9.209957E+03     1.000000E+00
   27  4623    -9.209957E+03     1.000000E+00
   28  4795    -9.209957E+03     1.000000E+00
   29  4967    -9.209958E+03     1.000000E+00
   30  5139    -9.209958E+03     1.000000E+00
   31  5310    -9.209958E+03     1.000000E+00
   32  5481    -9.209958E+03     1.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: -9209.95768127
            Iterations: 32
            Function evaluations: 5481
            Gradient evaluations: 32
Initial State: [  9.95479389e+00   9.98419982e+02   1.99802719e+01  -5.00329258e+00
   9.47489103e+03]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.209958E+03     1.000000E+00
    2   342    -9.209961E+03     1.000000E+00
    3   513    -9.210016E+03     1.000000E+00
    4   684    -9.210281E+03     1.000000E+00
    5   855    -9.211429E+03     1.000000E+00
    6  1026    -9.212150E+03     1.000000E+00
    7  1197    -9.215547E+03     1.000000E+00
    8  1368    -9.216463E+03     1.000000E+00
    9  1539    -9.218262E+03     1.000000E+00
   10  1710    -9.218623E+03     1.000000E+00
   11  1881    -9.218609E+03     1.000000E+00
   12  2052    -9.218657E+03     1.000000E+00
   13  2223    -9.218734E+03     1.000000E+00
   14  2394    -9.218770E+03     1.000000E+00
   15  2565    -9.218789E+03     1.000000E+00
   16  2736    -9.218866E+03     1.000000E+00
   17  2907    -9.219236E+03     1.000000E+00
   18  3078    -9.219402E+03     1.000000E+00
   19  3249    -9.219402E+03     1.000000E+00
   20  3420    -9.219402E+03     1.000000E+00
   21  3591    -9.219402E+03     1.000000E+00
   22  3762    -9.219402E+03     1.000000E+00
   23  3933    -9.219402E+03     1.000000E+00
   24  4105    -9.219403E+03     1.000000E+00
   25  4277    -9.219403E+03     1.000000E+00
   26  4448    -9.219404E+03     1.000000E+00
   27  4619    -9.219404E+03     1.000000E+00
   28  4790    -9.219404E+03     1.000000E+00
   29  4961    -9.219404E+03     1.000000E+00
   30  5132    -9.219404E+03     1.000000E+00
   31  5304    -9.219405E+03     1.000000E+00
   32  5476    -9.219405E+03     1.000000E+00
   33  5647    -9.219405E+03     1.000000E+00
   34  5818    -9.219405E+03     1.000000E+00
   35  5989    -9.219405E+03     1.000000E+00
   36  6160    -9.219405E+03     1.000000E+00
   37  6332    -9.219406E+03     1.000000E+00
   38  6504    -9.219406E+03     1.000000E+00
   39  6675    -9.219406E+03     1.000000E+00
   40  6846    -9.219406E+03     1.000000E+00
   41  7017    -9.219406E+03     1.000000E+00
   42  7189    -9.219406E+03     1.000000E+00
   43  7361    -9.219406E+03     1.000000E+00
   44  7533    -9.219406E+03     1.000000E+00
   45  7704    -9.219406E+03     1.000000E+00
   46  7875    -9.219406E+03     1.000000E+00
   47  8046    -9.219406E+03     1.000000E+00
   48  8217    -9.219406E+03     1.000000E+00
   49  8389    -9.219406E+03     1.000000E+00
   50  8561    -9.219406E+03     1.000000E+00
   51  8734    -9.219406E+03     1.000000E+00
   52  8907    -9.219406E+03     1.000000E+00
   53  9080    -9.219407E+03     1.000000E+00
   54  9253    -9.219407E+03     1.000000E+00
   55  9426    -9.219407E+03     1.000000E+00
   56  9599    -9.219407E+03     1.000000E+00
   57  9772    -9.219407E+03     1.000000E+00
   58  9945    -9.219407E+03     1.000000E+00
   59 10118    -9.219407E+03     1.000000E+00
   60 10290    -9.219407E+03     1.000000E+00
   61 10462    -9.219407E+03     1.000000E+00
   62 10634    -9.219407E+03     1.000000E+00
   63 10806    -9.219407E+03     1.000000E+00
   64 10978    -9.219407E+03     1.000000E+00
   65 11150    -9.219407E+03     1.000000E+00
   66 11322    -9.219407E+03     1.000000E+00
   67 11494    -9.219407E+03     1.000000E+00
   68 11666    -9.219407E+03     1.000000E+00
   69 11838    -9.219407E+03     1.000000E+00
   70 12010    -9.219407E+03     1.000000E+00
   71 12181    -9.219407E+03     1.000000E+00
   72 12352    -9.219407E+03     1.000000E+00
   73 12523    -9.219407E+03     1.000000E+00
   74 12694    -9.219407E+03     1.000000E+00
   75 12865    -9.219407E+03     1.000000E+00
   76 13036    -9.219407E+03     1.000000E+00
   77 13208    -9.219407E+03     1.000000E+00
   78 13380    -9.219407E+03     1.000000E+00
   79 13552    -9.219407E+03     1.000000E+00
   80 13724    -9.219407E+03     1.000000E+00
   81 13895    -9.219407E+03     1.000000E+00
   82 14066    -9.219407E+03     1.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: -9219.40749148
            Iterations: 82
            Function evaluations: 14066
            Gradient evaluations: 82
Initial State: [  9.94291512e+00   9.99405670e+02   1.99609465e+01  -5.01097635e+00
   9.47787545e+03]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.219407E+03     1.000000E+00
    2   342    -9.219352E+03     1.000000E+00
    3   513    -9.219403E+03     1.000000E+00
    4   684    -9.219635E+03     1.000000E+00
    5   855    -9.220700E+03     1.000000E+00
    6  1026    -9.222462E+03     1.000000E+00
    7  1197    -9.222278E+03     1.000000E+00
    8  1368    -9.222278E+03     1.000000E+00
    9  1539    -9.222278E+03     1.000000E+00
   10  1710    -9.222278E+03     1.000000E+00
   11  1881    -9.222278E+03     1.000000E+00
   12  2052    -9.222278E+03     1.000000E+00
   13  2223    -9.222278E+03     1.000000E+00
   14  2394    -9.222278E+03     1.000000E+00
   15  2565    -9.222278E+03     1.000000E+00
   16  2736    -9.222278E+03     1.000000E+00
   17  2907    -9.222278E+03     1.000000E+00
   18  3079    -9.222278E+03     1.000000E+00
   19  3251    -9.222278E+03     1.000000E+00
   20  3422    -9.222278E+03     1.000000E+00
   21  3593    -9.222278E+03     1.000000E+00
   22  3764    -9.222278E+03     1.000000E+00
   23  3935    -9.222278E+03     1.000000E+00
   24  4106    -9.222278E+03     1.000000E+00
   25  4277    -9.222278E+03     1.000000E+00
   26  4449    -9.222278E+03     1.000000E+00
   27  4621    -9.222278E+03     1.000000E+00
   28  4793    -9.222278E+03     1.000000E+00
   29  4965    -9.222278E+03     1.000000E+00
   30  5137    -9.222278E+03     1.000000E+00
   31  5309    -9.222278E+03     1.000000E+00
   32  5481    -9.222278E+03     1.000000E+00
   33  5653    -9.222278E+03     1.000000E+00
   34  5825    -9.222278E+03     1.000000E+00
   35  5996    -9.222278E+03     1.000000E+00
   36  6167    -9.222278E+03     1.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: -9222.2784892
            Iterations: 36
            Function evaluations: 6167
            Gradient evaluations: 36
Initial State: [  9.92718250e+00   1.00021538e+03   1.99562463e+01  -5.00902021e+00
   9.49238742e+03]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.219407E+03     1.000000E+00
    2   342    -9.219122E+03     1.000000E+00
    3   513    -9.219173E+03     1.000000E+00
    4   684    -9.219227E+03     1.000000E+00
    5   855    -9.219496E+03     1.000000E+00
    6  1026    -9.220841E+03     1.000000E+00
    7  1197    -9.227570E+03     1.000000E+00
    8  1368    -9.243794E+03     1.000000E+00
    9  1539    -9.236275E+03     1.000000E+00
   10  1710    -9.236287E+03     1.000000E+00
   11  1881    -9.236302E+03     1.000000E+00
   12  2052    -9.236311E+03     1.000000E+00
   13  2223    -9.236311E+03     1.000000E+00
   14  2394    -9.236311E+03     1.000000E+00
   15  2565    -9.236311E+03     1.000000E+00
   16  2736    -9.236311E+03     1.000000E+00
   17  2907    -9.236311E+03     1.000000E+00
   18  3078    -9.236311E+03     1.000000E+00
   19  3249    -9.236311E+03     1.000000E+00
   20  3420    -9.236311E+03     1.000000E+00
   21  3591    -9.236311E+03     1.000000E+00
   22  3762    -9.236311E+03     1.000000E+00
   23  3933    -9.236311E+03     1.000000E+00
   24  4104    -9.236311E+03     1.000000E+00
   25  4276    -9.236311E+03     1.000000E+00
   26  4448    -9.236311E+03     1.000000E+00
   27  4621    -9.236311E+03     1.000000E+00
   28  4794    -9.236311E+03     1.000000E+00
   29  4967    -9.236311E+03     1.000000E+00
   30  5140    -9.236311E+03     1.000000E+00
   31  5313    -9.236311E+03     1.000000E+00
   32  5486    -9.236311E+03     1.000000E+00
   33  5659    -9.236311E+03     1.000000E+00
   34  5832    -9.236311E+03     1.000000E+00
   35  6005    -9.236311E+03     1.000000E+00
   36  6178    -9.236311E+03     1.000000E+00
   37  6351    -9.236311E+03     1.000000E+00
   38  6524    -9.236311E+03     1.000000E+00
   39  6697    -9.236311E+03     1.000000E+00
   40  6870    -9.236311E+03     1.000000E+00
   41  7043    -9.236311E+03     1.000000E+00
   42  7216    -9.236311E+03     1.000000E+00
   43  7389    -9.236311E+03     1.000000E+00
   44  7562    -9.236311E+03     1.000000E+00
   45  7735    -9.236311E+03     1.000000E+00
   46  7908    -9.236312E+03     1.000000E+00
   47  8081    -9.236312E+03     1.000000E+00
   48  8254    -9.236312E+03     1.000000E+00
   49  8427    -9.236312E+03     1.000000E+00
   50  8600    -9.236312E+03     1.000000E+00
   51  8773    -9.236312E+03     1.000000E+00
   52  8946    -9.236312E+03     1.000000E+00
   53  9119    -9.236312E+03     1.000000E+00
   54  9292    -9.236312E+03     1.000000E+00
   55  9465    -9.236312E+03     1.000000E+00
   56  9638    -9.236312E+03     1.000000E+00
   57  9811    -9.236312E+03     1.000000E+00
   58  9984    -9.236312E+03     1.000000E+00
   59 10157    -9.236312E+03     1.000000E+00
   60 10330    -9.236312E+03     1.000000E+00
   61 10503    -9.236312E+03     1.000000E+00
   62 10676    -9.236312E+03     1.000000E+00
   63 10849    -9.236312E+03     1.000000E+00
   64 11022    -9.236312E+03     1.000000E+00
   65 11195    -9.236312E+03     1.000000E+00
   66 11368    -9.236312E+03     1.000000E+00
   67 11541    -9.236312E+03     1.000000E+00
   68 11714    -9.236312E+03     1.000000E+00
   69 11887    -9.236312E+03     1.000000E+00
   70 12059    -9.236312E+03     1.000000E+00
   71 12231    -9.236312E+03     1.000000E+00
   72 12403    -9.236312E+03     1.000000E+00
   73 12575    -9.236312E+03     1.000000E+00
   74 12747    -9.236312E+03     1.000000E+00
   75 12919    -9.236312E+03     1.000000E+00
   76 13091    -9.236312E+03     1.000000E+00
   77 13263    -9.236312E+03     1.000000E+00
   78 13435    -9.236312E+03     1.000000E+00
   79 13607    -9.236312E+03     1.000000E+00
   80 13779    -9.236312E+03     1.000000E+00
   81 13951    -9.236312E+03     1.000000E+00
   82 14123    -9.236312E+03     1.000000E+00
   83 14295    -9.236312E+03     1.000000E+00
   84 14467    -9.236312E+03     1.000000E+00
   85 14639    -9.236312E+03     1.000000E+00
   86 14811    -9.236312E+03     1.000000E+00
   87 14983    -9.236312E+03     1.000000E+00
   88 15155    -9.236312E+03     1.000000E+00
   89 15327    -9.236312E+03     1.000000E+00
   90 15499    -9.236312E+03     1.000000E+00
   91 15671    -9.236312E+03     1.000000E+00
   92 15843    -9.236312E+03     1.000000E+00
   93 16015    -9.236312E+03     1.000000E+00
   94 16186    -9.236312E+03     1.000000E+00
   95 16357    -9.236312E+03     1.000000E+00
   96 16529    -9.236312E+03     1.000000E+00
   97 16702    -9.236312E+03     1.000000E+00
   98 16875    -9.236312E+03     1.000000E+00
   99 17048    -9.236312E+03     1.000000E+00
  100 17221    -9.236312E+03     1.000000E+00
  101 17394    -9.236312E+03     1.000000E+00
  102 17567    -9.236312E+03     1.000000E+00
  103 17740    -9.236312E+03     1.000000E+00
  104 17913    -9.236312E+03     1.000000E+00
  105 18086    -9.236312E+03     1.000000E+00
  106 18259    -9.236312E+03     1.000000E+00
  107 18432    -9.236312E+03     1.000000E+00
  108 18605    -9.236312E+03     1.000000E+00
  109 18778    -9.236312E+03     1.000000E+00
  110 18951    -9.236312E+03     1.000000E+00
  111 19124    -9.236312E+03     1.000000E+00
  112 19297    -9.236312E+03     1.000000E+00
  113 19470    -9.236312E+03     1.000000E+00
  114 19643    -9.236312E+03     1.000000E+00
  115 19816    -9.236312E+03     1.000000E+00
  116 19989    -9.236312E+03     1.000000E+00
  117 20162    -9.236312E+03     1.000000E+00
  118 20335    -9.236312E+03     1.000000E+00
  119 20508    -9.236312E+03     1.000000E+00
  120 20681    -9.236312E+03     1.000000E+00
  121 20854    -9.236312E+03     1.000000E+00
  122 21027    -9.236312E+03     1.000000E+00
  123 21200    -9.236312E+03     1.000000E+00
  124 21373    -9.236312E+03     1.000000E+00
  125 21546    -9.236312E+03     1.000000E+00
  126 21719    -9.236312E+03     1.000000E+00
  127 21892    -9.236312E+03     1.000000E+00
  128 22065    -9.236312E+03     1.000000E+00
  129 22238    -9.236312E+03     1.000000E+00
  130 22411    -9.236312E+03     1.000000E+00
  131 22584    -9.236312E+03     1.000000E+00
  132 22757    -9.236312E+03     1.000000E+00
  133 22930    -9.236312E+03     1.000000E+00
  134 23103    -9.236312E+03     1.000000E+00
  135 23276    -9.236312E+03     1.000000E+00
  136 23449    -9.236312E+03     1.000000E+00
  137 23622    -9.236312E+03     1.000000E+00
  138 23795    -9.236312E+03     1.000000E+00
  139 23968    -9.236312E+03     1.000000E+00
  140 24141    -9.236312E+03     1.000000E+00
  141 24314    -9.236312E+03     1.000000E+00
  142 24487    -9.236312E+03     1.000000E+00
  143 24660    -9.236312E+03     1.000000E+00
  144 24833    -9.236312E+03     1.000000E+00
  145 25006    -9.236312E+03     1.000000E+00
  146 25179    -9.236312E+03     1.000000E+00
  147 25352    -9.236312E+03     1.000000E+00
  148 25525    -9.236312E+03     1.000000E+00
  149 25698    -9.236312E+03     1.000000E+00
  150 25871    -9.236312E+03     1.000000E+00
  151 26044    -9.236312E+03     1.000000E+00
  152 26217    -9.236312E+03     1.000000E+00
  153 26390    -9.236312E+03     1.000000E+00
  154 26563    -9.236312E+03     1.000000E+00
  155 26736    -9.236312E+03     1.000000E+00
  156 26909    -9.236312E+03     1.000000E+00
  157 27082    -9.236312E+03     1.000000E+00
  158 27255    -9.236312E+03     1.000000E+00
  159 27428    -9.236312E+03     1.000000E+00
  160 27600    -9.236312E+03     1.000000E+00
  161 27772    -9.236312E+03     1.000000E+00
  162 27944    -9.236312E+03     1.000000E+00
  163 28116    -9.236312E+03     1.000000E+00
  164 28287    -9.236313E+03     1.000000E+00
  165 28459    -9.236313E+03     1.000000E+00
  166 28631    -9.236313E+03     1.000000E+00
  167 28803    -9.236313E+03     1.000000E+00
  168 28975    -9.236313E+03     1.000000E+00
  169 29147    -9.236313E+03     1.000000E+00
  170 29319    -9.236313E+03     1.000000E+00
  171 29491    -9.236313E+03     1.000000E+00
  172 29663    -9.236313E+03     1.000000E+00
  173 29835    -9.236313E+03     1.000000E+00
  174 30007    -9.236313E+03     1.000000E+00
  175 30179    -9.236313E+03     1.000000E+00
  176 30351    -9.236313E+03     1.000000E+00
  177 30523    -9.236313E+03     1.000000E+00
  178 30694    -9.236313E+03     1.000000E+00
  179 30865    -9.236313E+03     1.000000E+00
  180 31036    -9.236313E+03     1.000000E+00
  181 31207    -9.236313E+03     1.000000E+00
  182 31378    -9.236313E+03     1.000000E+00
  183 31549    -9.236314E+03     1.000000E+00
  184 31721    -9.236314E+03     1.000000E+00
  185 31893    -9.236314E+03     1.000000E+00
  186 32065    -9.236314E+03     1.000000E+00
  187 32237    -9.236314E+03     1.000000E+00
  188 32409    -9.236314E+03     1.000000E+00
  189 32580    -9.236314E+03     1.000000E+00
  190 32751    -9.236314E+03     1.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: -9236.31364373
            Iterations: 190
            Function evaluations: 32751
            Gradient evaluations: 190
Initial State: [  9.92777423e+00   9.99991824e+02   1.99623276e+01  -5.01006538e+00
   9.49271955e+03]
  NIT    FC           OBJFUN            GNORM
    1   171    -9.219407E+03     1.000000E+00
    2   342    -9.219134E+03     1.000000E+00
    3   513    -9.219184E+03     1.000000E+00
    4   684    -9.219237E+03     1.000000E+00
    5   855    -9.219505E+03     1.000000E+00
    6  1026    -9.220846E+03     1.000000E+00
    7  1197    -9.227551E+03     1.000000E+00
    8  1368    -9.244613E+03     1.000000E+00
    9  1539    -9.236599E+03     1.000000E+00
   10  1710    -9.236610E+03     1.000000E+00
   11  1881    -9.236624E+03     1.000000E+00
   12  2052    -9.236635E+03     1.000000E+00
   13  2223    -9.236635E+03     1.000000E+00
   14  2394    -9.236635E+03     1.000000E+00
   15  2565    -9.236635E+03     1.000000E+00
   16  2736    -9.236635E+03     1.000000E+00
   17  2907    -9.236635E+03     1.000000E+00
   18  3078    -9.236635E+03     1.000000E+00
   19  3249    -9.236635E+03     1.000000E+00
   20  3420    -9.236635E+03     1.000000E+00
   21  3591    -9.236635E+03     1.000000E+00
   22  3762    -9.236635E+03     1.000000E+00
   23  3933    -9.236635E+03     1.000000E+00
   24  4104    -9.236635E+03     1.000000E+00
   25  4275    -9.236635E+03     1.000000E+00
   26  4446    -9.236635E+03     1.000000E+00
   27  4618    -9.236635E+03     1.000000E+00
   28  4790    -9.236636E+03     1.000000E+00
   29  4963    -9.236636E+03     1.000000E+00
   30  5136    -9.236636E+03     1.000000E+00
   31  5309    -9.236636E+03     1.000000E+00
   32  5482    -9.236636E+03     1.000000E+00
   33  5655    -9.236636E+03     1.000000E+00
   34  5828    -9.236636E+03     1.000000E+00
   35  6001    -9.236636E+03     1.000000E+00
   36  6174    -9.236636E+03     1.000000E+00
   37  6347    -9.236636E+03     1.000000E+00
   38  6520    -9.236636E+03     1.000000E+00
   39  6693    -9.236636E+03     1.000000E+00
   40  6866    -9.236636E+03     1.000000E+00
   41  7039    -9.236636E+03     1.000000E+00
   42  7212    -9.236636E+03     1.000000E+00
   43  7385    -9.236636E+03     1.000000E+00
   44  7558    -9.236636E+03     1.000000E+00
   45  7730    -9.236636E+03     1.000000E+00
   46  7902    -9.236636E+03     1.000000E+00
   47  8074    -9.236636E+03     1.000000E+00
   48  8246    -9.236636E+03     1.000000E+00
   49  8418    -9.236636E+03     1.000000E+00
   50  8590    -9.236636E+03     1.000000E+00
   51  8762    -9.236636E+03     1.000000E+00
   52  8934    -9.236636E+03     1.000000E+00
   53  9106    -9.236636E+03     1.000000E+00
   54  9278    -9.236636E+03     1.000000E+00
   55  9450    -9.236636E+03     1.000000E+00
   56  9622    -9.236636E+03     1.000000E+00
   57  9794    -9.236636E+03     1.000000E+00
   58  9966    -9.236636E+03     1.000000E+00
   59 10138    -9.236636E+03     1.000000E+00
   60 10310    -9.236636E+03     1.000000E+00
   61 10482    -9.236636E+03     1.000000E+00
   62 10654    -9.236636E+03     1.000000E+00
   63 10826    -9.236636E+03     1.000000E+00
   64 10998    -9.236636E+03     1.000000E+00
   65 11170    -9.236636E+03     1.000000E+00
   66 11342    -9.236636E+03     1.000000E+00
   67 11514    -9.236636E+03     1.000000E+00
   68 11686    -9.236636E+03     1.000000E+00
   69 11859    -9.236636E+03     1.000000E+00
   70 12032    -9.236636E+03     1.000000E+00
   71 12205    -9.236636E+03     1.000000E+00
   72 12378    -9.236636E+03     1.000000E+00
   73 12551    -9.236636E+03     1.000000E+00
   74 12724    -9.236636E+03     1.000000E+00
   75 12897    -9.236637E+03     1.000000E+00
   76 13069    -9.236637E+03     1.000000E+00
   77 13241    -9.236637E+03     1.000000E+00
   78 13413    -9.236637E+03     1.000000E+00
   79 13585    -9.236637E+03     1.000000E+00
   80 13757    -9.236637E+03     1.000000E+00
   81 13929    -9.236637E+03     1.000000E+00
   82 14101    -9.236637E+03     1.000000E+00
   83 14272    -9.236637E+03     1.000000E+00
   84 14443    -9.236637E+03     1.000000E+00
   85 14615    -9.236637E+03     1.000000E+00
   86 14787    -9.236637E+03     1.000000E+00
   87 14959    -9.236637E+03     1.000000E+00
   88 15131    -9.236637E+03     1.000000E+00
   89 15303    -9.236637E+03     1.000000E+00
   90 15475    -9.236637E+03     1.000000E+00
   91 15647    -9.236637E+03     1.000000E+00
   92 15819    -9.236637E+03     1.000000E+00
   93 15991    -9.236637E+03     1.000000E+00
   94 16163    -9.236637E+03     1.000000E+00
   95 16335    -9.236637E+03     1.000000E+00
   96 16507    -9.236637E+03     1.000000E+00
   97 16679    -9.236637E+03     1.000000E+00
   98 16851    -9.236637E+03     1.000000E+00
   99 17022    -9.236637E+03     1.000000E+00
  100 17193    -9.236637E+03     1.000000E+00
  101 17365    -9.236637E+03     1.000000E+00
  102 17537    -9.236637E+03     1.000000E+00
  103 17709    -9.236637E+03     1.000000E+00
  104 17881    -9.236637E+03     1.000000E+00
  105 18053    -9.236638E+03     1.000000E+00
  106 18225    -9.236638E+03     1.000000E+00
  107 18397    -9.236638E+03     1.000000E+00
  108 18569    -9.236638E+03     1.000000E+00
  109 18741    -9.236638E+03     1.000000E+00
  110 18913    -9.236638E+03     1.000000E+00
  111 19085    -9.236638E+03     1.000000E+00
  112 19257    -9.236638E+03     1.000000E+00
  113 19429    -9.236638E+03     1.000000E+00
  114 19600    -9.236638E+03     1.000000E+00
  115 19771    -9.236638E+03     1.000000E+00
  116 19943    -9.236638E+03     1.000000E+00
  117 20115    -9.236638E+03     1.000000E+00
  118 20287    -9.236638E+03     1.000000E+00

In [ ]:
(random.rand(3)-random.rand(3))*random.rand(3)

In [3]:
fpath = "../Data/HSS/10Seg/"

In [51]:
trajectories = empty((0, 8))
ntraj = 1578
for i in range(ntraj):
    z = load(fpath + 'HSS_10_' + str(i) + '.npy')
    tf, sb, cb, s, c = prob.Decode(z)
    sb = sb[1:]
    cb = cb[1:]
    trajb = hstack((sb, cb))
    trajr = hstack((s, c))
    traj  = vstack((trajb, trajr))
    trajectories = vstack((trajectories, traj))
print trajectories


[[  4.61454561e+01   9.83789391e+02   1.60288477e+01 ...,   6.40148128e-01
   -1.00000000e+00  -7.30771943e-01]
 [  9.85163428e+01   9.17210113e+02   1.20576953e+01 ...,   0.00000000e+00
    7.72434751e-01   9.20956759e-01]
 [  1.46903224e+02   8.21584681e+02   1.20576953e+01 ...,   8.06451202e-17
    2.46789162e-01  -3.00538790e-01]
 ..., 
 [  1.47461211e+02   1.00012295e+02  -2.83878398e+01 ...,   6.34245396e-01
   -1.00000000e+00   1.00000000e+00]
 [  3.95279448e+01   2.60961130e+01  -1.94105222e+01 ...,   1.00000000e+00
    1.00000000e+00   1.00000000e+00]
 [  0.00000000e+00   0.00000000e+00   0.00000000e+00 ...,   1.00000000e+00
    1.00000000e+00   1.00000000e+00]]

In [55]:
DataFrame(trajectories).to_csv('../Data/HSS_10_Data.txt')

In [56]:
save('../Data/HSS_10_Data', trajectories)

In [85]:
from seaborn import *

In [76]:
x, y = random.randn(2,300)

In [ ]:
plt.close('all')
heatmap(trajectories[:,[0,1,5]])
plt.show()

In [81]:
g


Out[81]:
<seaborn.axisgrid.JointGrid at 0x7fed1a5a9750>

In [ ]: