In [49]:
import numpy as np
import Startup as St
import LinkedLineNumpy2 as LLO

MAXIT = 2000
th = 0.000001

def GenTest(testnum):
    cgopt, params, fevals = St.Start(testnum, False)
    f, dim, nopt, max_fes, nea2 = fevals
    max_it, npop, step, thr, thrL = MAXIT, 10, th, th, 0.1*np.sqrt(dim)*(f.ub[0]-f.lb[0])    
    LLO.f = f
    St.f = f
    cgopt1, cgopt2, cgopt3, cgopt4, cgopt5, optWhat = cgopt
    LLO.cgopt1 = cgopt1
    LLO.nopt = nopt
    X, Y, Adj, nevals = LLO.LinkedLineOpt(max_it,dim, npop, step, thr, thrL,False)
    return X, Y, Adj, f

In [2]:
from bokeh.models.glyphs import Circle, Line
from bokeh.plotting import figure, show, output_notebook, vplot

TOOLS="pan,wheel_zoom,box_zoom,reset,save"

def PlotNetwork1D(X,Y,Adj,f):
    contourX = np.arange(f.lb, f.ub, 0.001)
    contourY = np.array([f(x) for x in contourX])
    p = figure(title = 'Output Network Plot',plot_width=800, plot_height=800,
           tools=TOOLS,background_fill="#ECECEC")

    p.line(contourX, contourY, color='blue', line_width=2)
    radius = 10
    
    for i in range(Adj.shape[0]-1):
        p.circle(X[i],Y[i], color='red', size=radius)
        for j in range(i+1, Adj.shape[1]):
            if Adj[i,j]:
                p.circle(X[j],Y[j], color='red', size=radius)
                p.line(X[[i,j]].flatten(), Y[[i,j]], color='red', line_width=3)
                p.line(np.array([X[j], X[i] + 0.9*(X[j]-X[i])]).flatten(), [Y[j], Y[j]*.95], color='red', line_width=3)
                

    p.ygrid.grid_line_color = "white"
    p.ygrid.grid_line_width = 2
    p.xgrid.grid_line_color = "white"
    p.xgrid.grid_line_width = 2
    p.axis.major_label_text_font_size = "18pt"
    p.axis.major_label_text_font_style = "bold"
    show(p)

In [3]:
def PlotNetwork2D(X,Y,Adj,f):
    
    N = 500

    x = np.linspace(f.lb[0], f.ub[0], N)
    y = np.linspace(f.lb[1], f.ub[1], N)
    xx, yy = np.meshgrid(x, y)
    d = np.zeros( xx.shape )
    for i in range(xx.shape[0]):
        for j in range(xx.shape[1]):
            d[i,j] = f(np.array([xx[i,j],yy[i,j]]))
        
           
    p = figure(title = 'Output Network Plot',
               x_range=[f.lb[0], f.ub[0]], y_range=[f.lb[1], f.ub[1]]
               )
    p.image(image=[d], x=[f.lb[0]], y=[f.lb[1]], dw=[f.ub[0]-f.lb[0]], dh=[f.ub[1]-f.lb[1]], palette="Spectral11")
        

    radius = 10
    
    for i in range(Adj.shape[0]-1):
        p.circle(X[i,0],X[i,1], color='red', size=radius)
        for j in range(i+1, Adj.shape[1]):
            if Adj[i,j]:
                p.circle(X[j,0],X[j,1], color='red', size=radius)
                p.line(X[[i,j],0], X[[i,j],1], color='red', line_width=3)
                p.circle(X[j,0],X[j,1],color='blue',fill_alpha=0.1, size=radius*2)               
                

    p.ygrid.grid_line_color = "white"
    p.ygrid.grid_line_width = 2
    p.xgrid.grid_line_color = "white"
    p.xgrid.grid_line_width = 2
    p.axis.major_label_text_font_size = "18pt"
    p.axis.major_label_text_font_style = "bold"
    show(p)

In [50]:
X, Y, Adj, f = GenTest(13)


range: [-5.0,5.0], nopts: 6, maxFES: 400000.0, dim: F11 - 3D
end
size: 486, cg: 4, nvs: 863924

In [52]:
output_notebook()

if X.shape[1]==1:
    PlotNetwork1D(X,Y,Adj,f)
else:
    PlotNetwork2D(X,Y,Adj,f)


BokehJS successfully loaded.

Warning: BokehJS previously loaded

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-52-40e09979a7d3> in <module>()
      4     PlotNetwork1D(X,Y,Adj,f)
      5 else:
----> 6     PlotNetwork2D(X,Y,Adj,f)

<ipython-input-3-abd4385a8030> in PlotNetwork2D(X, Y, Adj, f)
      9     for i in range(xx.shape[0]):
     10         for j in range(xx.shape[1]):
---> 11             d[i,j] = f(np.array([xx[i,j],yy[i,j]]))
     12 
     13 

/home/olivetti/Projects/LINKEDOPT/SRC/lib/F11.pyc in f11(x)
     73                 f11.M.append( RotMatrixCondition(D,1) )
     74 
---> 75     return hybrid_comp( x, f11.fn, f11.f, f11.o, f11.sigma, f11.lamb, f11.bias, f11.M )
     76     # agora para os outros Fs basta setar esse parametro e usar hybrid_comp

ValueError: operands could not be broadcast together with shapes (2,) (6,3) 

In [51]:
for i, (x,y) in enumerate(zip(X,Y)):
     print i,x,y


0 [-2.57676527 -0.5467268   3.56468783] -377.019859662
1 [ 0.75722608  0.15858478  0.50133953] -946.823596359
2 [-1.51553501  4.30548775  3.28322755] -4.06982709363
3 [ 1.75325751  1.58828108 -4.30599061] -0.0479565404958
4 [-3.39447709 -3.31656884  2.34608756] -0.00257040502552
5 [ 1.75774394  1.59573804 -4.30893001] -1.51590062306e-09
6 [ 1.75792548  1.59590084 -4.30952112] -0.000258201079168
7 [-4.42022469  3.88669797  0.90068509] -463.839730961
8 [ 0.02295978  1.09711178  1.33266263] -913.811445995
9 [ 4.14166859  2.47718428  2.66919233] -0.00110945814174
10 [-0.48208637  2.25889752  2.25833088] -389.304020269
11 [-0.243341    0.05691975  3.32790159] -585.54451725
12 [-3.39673371 -3.31988205  2.34553693] -0.0188207963105
13 [-2.46757304  2.45707485 -0.65063902] -834.271905554
14 [-0.77545302  1.62121773  0.83347765] -836.128543124
15 [ 0.22350085 -0.93028955 -1.82919645] -1108.79886376
16 [-2.41821123 -4.75564327  2.44310396] -337.565551237
17 [-4.20434653  1.88386719 -2.21919514] -1048.9884392
18 [-0.06793833  4.30692178  3.54965346] -231.598201432
19 [-3.45118956  3.97409683 -1.90049846] -1112.53957041
20 [-0.57913685  0.22983564  0.04255558] -830.798259622
21 [-3.22329779 -2.85339091  2.25790053] -235.343582762
22 [-2.41094117  3.68966539  3.73911678] -93.4064029345
23 [-4.55526435  0.26712826  2.90956251] -391.152924075
24 [-1.68052593 -1.3275246   2.793565  ] -586.886218156
25 [-1.79047116  1.53891535  3.77660849] -360.718805875
26 [ 2.85677269 -4.36081545 -0.22337981] -1530.56611507
27 [-4.00152961  3.80364675  4.25346655] -501.866428502
28 [ 1.13630834  1.59587912 -0.3819112 ] -1101.29688542
29 [-1.86002526  1.71381772 -0.35658848] -432.29958152
30 [-1.59015058  2.87818156 -0.23196233] -964.962782499
31 [-2.59034667  1.22298133 -4.85564946] -1294.2058059
32 [ 0.04454468  0.8943605   0.51137471] -1132.20775368
33 [-3.89662973  4.10953779 -4.95078905] -1722.19205399
34 [-1.56156015  4.3999837   3.28528018] -7.2652183848e-07
35 [-4.00324546  0.84122171 -0.062475  ] -814.026258065
36 [-0.58508891 -1.37870872  4.22780794] -683.406426282
37 [ 2.050787   -0.41564841 -4.16496827] -614.445284622
38 [-2.89631972  1.03522423  0.32381528] -410.318024753
39 [ 1.71222552  1.59309908 -4.31670143] -1.3391889273
40 [-1.56181004  4.40035373  3.28485381] -0.000155549459792
41 [-1.65131595  4.46614896  3.27991143] -6.06223725054
42 [-0.48821886 -0.76090663  1.07798068] -1123.57421604
43 [ 0.75866652  2.38074011  3.73907307] -568.451029858
44 [-1.56419352  4.39705402  3.28209333] -0.0105987780499
45 [ 4.14128229  2.47702251  2.66984747] -2.80740728974e-06
46 [ 4.1410994   2.48478687  2.67073401] -0.116539800923
47 [ 4.14094616  2.47696018  2.66917042] -0.000977062436871
48 [ 3.1916683   1.38134062  2.43024272] -752.923350354
49 [-0.95686362  0.84220636  3.33907078] -698.769120861
50 [ 1.75817908  1.59571305 -4.30857867] -0.000189789905674
51 [ 1.75736256  1.59339168 -4.30765019] -0.00430093904367
52 [-2.14640378  4.50496914  0.91532275] -616.693107657
53 [ 0.19436528  2.12674224  4.60451629] -381.817589978
54 [-0.8606876   0.82072472  3.13664822] -358.586050637
55 [-3.80327528 -3.54490954  3.03144047] -219.118261324
56 [-2.91517696  3.98793764  1.45876156] -531.289045528
57 [-3.20372293 -1.41510205  2.34428637] -613.812340574
58 [-0.76154893  0.13286055 -3.07992982] -1190.09764507
59 [ 1.73409684  1.63844864 -4.34791828] -2.26957442974
60 [ 4.13988124  2.46214326  2.67942418] -0.581888409526
61 [-4.54766722  1.06808351  0.81399256] -438.683491544
62 [ 0.80372319  0.77316912  2.6509009 ] -646.349631102
63 [-3.26123113 -0.42242573  1.21577793] -487.459856355
64 [-1.58018038 -0.44934386  0.72631844] -739.850027225
65 [ 1.7754935   1.58414857 -4.31274828] -0.318004447359
66 [ 1.75978892  1.59630564 -4.30576409] -0.00878143169098
67 [ 1.75817664  1.5957003  -4.30907126] -0.000142543018026
68 [-3.49794033 -0.64522353  1.14096255] -797.869482075
69 [ 1.75812577  1.59578407 -4.30878734] -0.000102545605283
70 [ 1.76034572  1.60379017 -4.31286081] -0.0490434376444
71 [-3.62398753 -0.45106571  2.2656009 ] -496.878441057
72 [-2.18011396 -2.22701162 -3.76096338] -1145.87539843
73 [-0.63305262  1.6292187   4.29573872] -489.873603166
74 [-2.123517   0.4101552 -4.716527 ] -1107.08652615
75 [-1.2669996   0.35439757 -2.29435738] -1008.93702477
76 [ 1.37471359 -2.17272184  4.88002147] -1019.4053675
77 [-2.09829405  3.71102168  2.81686454] -111.033588587
78 [-2.76970763  3.84045896  0.44668807] -443.09778514
79 [ 1.75649224  1.5927018  -4.30606659] -0.0112526308723
80 [-1.54564491  0.94550993  0.78897389] -322.601001626
81 [-2.12974055  3.09925954  0.64653132] -347.561196114
82 [-3.85927842  2.52496451 -0.94571409] -881.215161968
83 [ 2.04242531  3.76596444  3.16203761] -653.700769823
84 [ 1.7573783   1.59808564 -4.30775213] -0.00476101900778
85 [ 1.06005772 -1.40452908  3.73601862] -859.309354374
86 [ 2.07040539 -1.32437234  0.79586824] -1365.21486406
87 [ 0.71849475 -1.57643827 -3.06165552] -1108.34892842
88 [-1.81573287  2.33138396  1.79139683] -229.667885361
89 [ 1.66934454  0.05244474  2.18856927] -1165.1461849
90 [ 2.83263998  1.37422865  3.3673314 ] -612.069441573
91 [ 0.94930088 -3.43556389  1.56401019] -1150.92252808
92 [ 3.68436843 -3.40882306 -0.69310675] -1241.90565735
93 [-1.42072947  2.18270449  4.98033007] -353.037022892
94 [ 1.78550065 -2.62918373 -3.20716584] -1110.54133702
95 [-3.91396104  2.34347855  3.53727548] -536.643158056
96 [ 0.90931172  2.81297859  4.86031645] -385.283397149
97 [ 2.40754059 -0.68114467  2.10497382] -1191.58170522
98 [-3.65847181 -2.64754538  4.23062477] -367.204289779
99 [-1.16497046 -0.69456498  4.04670668] -656.026239974
100 [ 1.76016519  1.59813847 -4.31359167] -0.0205140760004
101 [ 2.50955552 -3.48781231  1.36904327] -1695.81124837
102 [ 2.72770921  1.54580303 -0.66153268] -1372.57500266
103 [-1.56135233  4.40006986  3.28528055] -1.72504136996e-05
104 [-1.3861437  -4.05780204  1.72516672] -541.375675396
105 [-0.61338489 -2.33022891 -1.00882391] -1100.25461629
106 [-1.09072758 -1.89080526 -1.24713216] -1151.24402894
107 [ 1.75794699  1.59359189 -4.30559746] -0.00955445570263
108 [-0.38234676  4.28575473  4.45673025] -113.959903932
109 [-1.07731405  3.616303    4.19834305] -85.1457772594
110 [ 4.14137702  2.47688625  2.6698278 ] -5.64318477448e-05
111 [-0.99379633  1.18809354 -0.03451475] -1053.00320316
112 [-1.87733891 -4.7040128  -2.69332281] -747.597166276
113 [-1.65554621 -1.87842335  0.67007618] -681.240008224
114 [ 2.63430164  2.58816911  3.3329841 ] -658.760811833
115 [-2.52273707  0.86546785  3.622809  ] -263.296051807
116 [-0.4354125   2.87628092  4.39925229] -173.471286914
117 [ 0.75749435 -1.79666861 -3.61697437] -831.816160507
118 [ 0.16106781 -1.30065212  2.01876512] -1139.10978574
119 [-3.40007416 -3.32454918  2.34772722] -0.13420035409
120 [-3.39440764 -3.31621659  2.34586107] -0.00447837120955
121 [-3.43798278 -3.32018963  2.28940564] -8.46251266982
122 [ 0.69029771 -2.04795403  2.53277506] -843.874442267
123 [-3.47754045  2.37561115  2.2773239 ] -235.068798429
124 [ 1.73830351  1.68716219 -4.27161779] -7.33088527866
125 [-2.04863626 -4.11178196  3.64686937] -269.674208325
126 [ 1.77518915  0.26568203 -2.31910801] -763.463979866
127 [ 3.77672315  0.68332198  2.61823608] -821.727578484
128 [-3.80274115  2.34929713  3.2230729 ] -237.432992413
129 [-1.88275857 -4.6416257  -2.55036149] -700.920736104
130 [ 1.93993181  1.61680183 -4.17072288] -30.4854759944
131 [-3.63397961  4.03396871  2.27067105] -439.513579899
132 [-2.71023666 -1.64159054  0.31341597] -1033.02082695
133 [-3.48993677  4.9249448   3.44089045] -448.375245205
134 [-4.03840995 -3.28436147  2.9837542 ] -188.614480246
135 [-2.4761644   2.42915009 -0.54987874] -643.638361364
136 [ 4.58818852  4.13641617  2.99197756] -666.064864237
137 [ 4.14166271  2.47663979  2.66984435] -0.000566196450385
138 [-2.76331207  3.02380958  2.54528407] -262.058128904
139 [-0.43984436 -2.74785226  3.53424353] -826.307579908
140 [ 1.80340146  1.42863961 -4.18787196] -27.6779570823
141 [-0.82815801  3.58566092  3.22522133] -193.176293524
142 [ 1.07195146  1.41179832  4.13750239] -734.859466532
143 [-2.96593101 -1.78217673  0.2216331 ] -731.618579898
144 [ 4.13627481  1.47999293 -0.41281099] -1425.55297623
145 [ 2.4243777 -4.8252666 -0.047626 ] -926.502152803
146 [-4.70222146  2.45806084  1.50510985] -653.711517498
147 [-2.68890291 -3.36986528  3.44680259] -207.994428143
148 [-0.56744402 -0.59113171  2.1398598 ] -650.159798444
149 [-2.04331576  4.15898553  2.82132267] -164.195572093
150 [ 4.14177947  2.47720285  2.67075039] -0.00219181112305
151 [ 0.23666419  3.54450688  4.72641913] -300.284954793
152 [-2.46739302  2.27719518  3.68130441] -174.184545643
153 [ 1.24570808  4.24018364  4.07623587] -429.248560891
154 [ 4.14111267  2.47683262  2.6697555 ] -0.000106677933363
155 [-4.78903091 -4.05166251 -0.69399322] -652.634710742
156 [-2.78481429 -2.5835527   1.66795238] -493.062851798
157 [ 0.87074788  2.97923705  0.61957659] -886.969701904
158 [-4.86051309 -0.44968554  1.7216779 ] -576.20380959
159 [-3.61770339 -0.89223322 -4.20815493] -808.41258521
160 [ 0.90374609 -3.63031646 -0.62493077] -984.593937889
161 [ 0.52404854  2.93914465  1.56044281] -677.974332185
162 [-2.61023481 -0.36821315 -0.67436526] -713.75687402
163 [-0.16172297  2.28560447  1.32925658] -644.77916568
164 [ 1.92716722  3.50175845  4.15878263] -490.513272375
165 [-2.03105302 -3.99593108 -0.57641758] -683.991028806
166 [-3.38496142 -3.34373757  2.34137403] -1.401914999
167 [-4.12287394  2.31614576  4.16996067] -413.943322637
168 [-3.8961239   0.29632724  1.04116923] -717.271979252
169 [ 1.75782759  1.59444095 -4.30571323] -0.00742752785365
170 [-1.55892868  4.40247418  3.27816765] -0.0268047008353
171 [ 0.17199892  2.32632248  0.37361006] -950.028792351
172 [-2.65647562  1.15390939 -4.88194429] -1339.6940194
173 [-2.18509696  0.07121068  4.77510882] -504.282042579
174 [ 4.1398682   2.48831237  2.66243132] -0.357419232597
175 [-1.77352595  0.13298942  3.50816939] -626.145308603
176 [ 4.1386953   2.47691917  2.66894917] -0.0138245090919
177 [ 4.21383002  2.71448641  3.917149  ] -503.069798414
178 [ 0.68244247  4.43374451  1.65358135] -734.144134733
179 [ 0.52787759  1.72492754 -2.95645024] -791.463052669
180 [ 2.09247281  0.88067355 -1.09522762] -1077.43995442
181 [ 4.14893351  2.46947374  2.66477355] -0.263106489929
182 [-4.97621435 -3.26128629  1.6028132 ] -335.517730557
183 [-0.92987663  0.99604285 -0.99746984] -1025.91022569
184 [ 2.18403205  2.29576628 -1.13998653] -1215.43795861
185 [ 1.03213064 -1.49191695 -3.70968445] -895.569092672
186 [-1.75249429 -2.64839538  2.73412967] -542.470656652
187 [-4.60415146 -1.52232207 -3.51070852] -1394.98638558
188 [ 0.15550647  3.71813314  0.628873  ] -1001.81801346
189 [-1.11978977  3.00084809  2.05116639] -272.127836324
190 [-2.19657074  0.89238546  2.67787303] -259.692029362
191 [-2.74771233 -0.78306309 -1.79161757] -1194.98753391
192 [-1.56151852  4.40003182  3.28527285] -5.74824047435e-07
193 [-0.57111816 -3.22384991 -3.07130546] -639.875732713
194 [ 1.82357898  1.5980396  -4.22495802] -6.89518544599
195 [ 1.69336365  1.85849217 -4.33333279] -45.5370553742
196 [ 1.88933404  2.88371979  1.99899947] -744.121144516
197 [ 2.98323581  4.20075383  3.49851462] -656.32350931
198 [ 0.67182203  3.84451132  2.77879619] -639.109909437
199 [-3.57750761 -2.65763932 -1.06790655] -859.684496023
200 [-2.87156184  1.63121724  2.57908114] -433.143263478
201 [-4.18589993  2.66897892 -4.30658511] -1339.60498102
202 [ 1.75910591  1.59451703 -4.30856816] -0.00236379037961
203 [ 3.42255672  1.66809511 -2.80539529] -747.337046364
204 [-4.38181409 -0.59695854  0.81578015] -780.208621817
205 [ 1.75824186  1.5951192  -4.3072984 ] -0.00200216308229
206 [-3.41858454  4.7325155  -3.98462347] -1593.83867402
207 [-4.43696133 -4.74566143  3.98112419] -229.505101651
208 [ 2.74531371  2.2510239  -3.10760756] -592.801739863
209 [-3.39170932 -3.43428204 -3.06927987] -721.043372929
210 [-3.8034001   3.9662562  -0.96441193] -826.639413594
211 [ 1.2061265   3.80414175 -2.41609344] -1231.90872493
212 [-0.73804125 -0.79648603 -4.59417551] -951.092191503
213 [-3.11054832  3.02168024  3.48059154] -191.550325467
214 [ 1.76927757  1.58192892 -4.32665638] -0.439875400743
215 [-1.55827508  4.37845609  3.29745899] -0.267332814954
216 [ 1.34937983  1.3421814  -4.44615734] -140.916530467
217 [ 3.89968002 -4.9791188   2.49991719] -1516.70408187
218 [-1.23610057  0.95528942 -0.16358978] -687.119122837
219 [-4.40618681  0.80462997  4.98201701] -906.232278662
220 [ 0.76801296  0.95312623 -1.58732305] -1147.13007889
221 [ 1.7592027   1.59540359 -4.30869578] -0.00151718480938
222 [ 2.26046638  0.95648181 -4.75477506] -434.492917251
223 [-1.30188979  0.25981399  1.91048349] -630.968795162
224 [ 1.74982477  1.65249381 -4.38860947] -5.33052944346
225 [-4.63477297 -0.97524403 -1.38979498] -816.78515848
226 [-4.53111793  1.85661914 -1.27399906] -683.73906786
227 [ 4.19404985  2.51716218  2.68132306] -8.30649574176
228 [-3.39515734 -3.31789608  2.34681859] -0.000590529993242
229 [ 4.14121922  2.49058402  2.68241775] -0.646593547526
230 [-3.2459916   0.37421274 -0.88454903] -768.408587822
231 [ 2.89167805  2.78724582  3.42948128] -538.281252425
232 [-3.91447375  1.09206451 -1.08330223] -827.499002875
233 [-2.84845197  0.83908249  4.56789746] -342.8500002
234 [ 1.78611798  1.65799257 -4.26104141] -4.43746851737
235 [ 4.1934785  -3.71159245 -2.64370962] -1228.1000256
236 [ 1.90993646  1.67199372 -4.22766467] -18.3714243081
237 [ 2.89944466  3.58097614  1.33691867] -864.472274381
238 [ 1.66621177  0.84544243  4.00846283] -820.828991133
239 [ 4.71143676 -4.43967809 -0.86414675] -1600.20665352
240 [ 0.06215031 -0.51093935  0.24290093] -882.703314821
241 [-2.90050079  0.40170926 -1.88956803] -1131.72140804
242 [ 0.07439728 -0.51175287  0.20789361] -970.599413274
243 [-0.11028071  2.90381909  3.45345618] -230.811521469
244 [-3.83074878  1.71350093  1.07965999] -400.070929443
245 [-3.82672975  0.93940374  3.07085325] -529.166484685
246 [ 2.11519982  0.72926081  3.1018702 ] -799.956324396
247 [-3.51118272 -0.26171316 -2.39436112] -1090.60442548
248 [-4.03728014  0.23224208 -2.20788917] -1251.21094923
249 [-3.97264215 -1.88702339  3.05585514] -312.887097865
250 [-3.79974695 -2.75076645  0.96479315] -519.006414612
251 [-3.40199686 -3.32538543  2.35695749] -0.365483188132
252 [-1.02607362 -3.4161462   2.96063533] -462.895570552
253 [-3.61998798 -1.0836952   0.02809167] -692.477671431
254 [-4.16127158  1.70567431  1.9835632 ] -415.951733453
255 [ 4.18399641  2.4774011   2.71329837] -6.80039737787
256 [ 3.34135218 -2.8359934   1.30833158] -1567.10576301
257 [-4.77743138  4.83068703 -4.45045702] -1248.13410819
258 [ 2.71655535 -4.31715819  2.09795542] -1648.42291764
259 [ 2.63329479  4.96326466  2.33705785] -810.301402641
260 [-4.57252577 -1.69379313 -3.86619355] -1314.30675913
261 [ 1.73506183  1.66345057 -4.34387742] -3.84144228211
262 [ 3.80557654  2.62145265  2.53232815] -269.741010609
263 [ 4.71295208 -4.43556208 -0.85018554] -1531.2687999
264 [ 0.2407704  -4.91070779  3.35558095] -997.879642766
265 [-4.88811217 -1.85450976 -2.59865577] -1339.04593287
266 [-4.81558331  2.44860704  1.81853034] -379.566495435
267 [-1.10757228  3.62519481  4.26652918] -160.433644484
268 [ 4.15772494  2.48134582  2.68082808] -0.756806080527
269 [-1.68753508  4.36206877  3.91744189] -56.793371653
270 [-3.82774268 -1.46689321  4.15678896] -604.79453228
271 [-3.0632151   4.43042481  3.57426018] -209.314132797
272 [ 1.72951619  1.55023523 -4.24387639] -4.50177736308
273 [ 3.90761568  2.43797935  2.59468835] -109.41909495
274 [ 1.22249436 -4.09008816 -2.5960316 ] -1039.96579491
275 [ 3.7019846  -4.23432047 -2.43526711] -988.210307235
276 [ 0.10167158 -0.68880739  4.45793795] -696.246596854
277 [ 2.61964192 -2.91733667  3.17403183] -1522.28332892
278 [ 1.87688052 -4.19914869 -4.53575116] -1215.67610955
279 [-2.35252677 -2.54949972  0.41145676] -742.314614095
280 [ 2.43214603 -0.05859217 -2.10457535] -1150.19214186
281 [-1.83080442 -1.75616295  1.68464888] -835.870383201
282 [-1.50160352  0.76859921  4.99544369] -452.394805943
283 [-4.96277503 -0.98794179 -0.44579641] -587.888434273
284 [-2.59281922  1.89048812 -2.70986885] -1372.94050911
285 [-4.30201173 -2.59450173  1.86284838] -393.591094241
286 [ 2.50578528 -2.45959277 -1.08186058] -1376.09513686
287 [ 1.79746709  1.63434561 -4.31388715] -1.71951312503
288 [-3.6436053  -4.00469368  4.15785627] -288.693315168
289 [-3.21933162  2.7458626   4.49349335] -462.881868139
290 [-2.51013923  1.66022311  1.53170637] -201.882771463
291 [-1.98065276 -1.90166368  1.60408816] -570.208891772
292 [ 4.13891769  2.48260698  2.6753831 ] -0.127479101014
293 [ 2.95221414 -1.22631109  3.33997681] -1412.38677391
294 [-3.75029892 -4.70096856 -4.70583911] -972.629216626
295 [-0.84180391 -3.69009168 -4.87315257] -992.997308578
296 [ 0.80507468 -0.5860468   2.58723857] -1060.48636432
297 [ 1.74806573  1.46695638 -4.34479024] -10.4701352446
298 [-4.45961083 -3.09107117 -4.71812323] -1526.28425346
299 [ 4.15940275  2.4536237   2.66125713] -1.8218391269
300 [-4.83134679  3.41184171 -4.48884338] -1395.24516983
301 [ 1.786919    1.60595251 -4.31437269] -0.575878503961
302 [-4.11752367  3.2976954  -2.25363065] -1188.87438731
303 [-3.71648421 -1.77682311  2.08319475] -438.550084423
304 [ 2.57453053  3.55498652  2.28125045] -655.169760269
305 [ 3.25814631  3.42951331  4.62982744] -583.289304684
306 [-1.5494417   0.14406308  2.87970126] -438.846349888
307 [ 2.7402038  -0.04003433  3.41448056] -1018.58904578
308 [-0.64006098  3.91804128  2.25061616] -402.546542805
309 [-1.06524285  4.40760089  2.10978414] -206.448233335
310 [-4.03499173  0.68857346 -2.19428285] -1200.62970074
311 [-4.56305134 -2.51401809 -3.51130319] -1210.46976135
312 [-1.55889917  2.43942651  0.82483888] -553.172232159
313 [-0.75207786 -4.3515829  -4.74311511] -823.840702152
314 [-1.22051709 -3.45892154  3.59484379] -598.171458164
315 [-1.29726268 -2.02971006  3.96002589] -521.864481737
316 [ 1.76223994  1.58895849 -4.29861629] -0.104719300335
317 [-2.66653825 -1.96873929  3.61304882] -481.472457336
318 [-1.10116737  2.33555823  4.15428678] -409.136694402
319 [ 0.5955864   0.84462478 -4.70836016] -364.197444422
320 [-0.6802878  -1.98149522  2.17997592] -803.170035228
321 [-0.49556418 -4.00705761 -4.88297056] -82.9938758752
322 [-1.53206781 -2.04216314  4.62753868] -767.218783515
323 [-2.23511512 -1.31939094  4.64064274] -597.984655883
324 [-3.39650904 -3.31892192  2.34636526] -0.00819204090691
325 [-3.45090577 -4.66114628  1.10993323] -366.314445756
326 [-1.04520062 -2.07719935  2.97965451] -661.341936908
327 [-3.53331244  0.96245137  2.22378248] -342.53733008
328 [ 1.78796357 -4.44740966  1.78673903] -1379.47261115
329 [-2.46731738 -1.6937593  -1.60301094] -1181.05159873
330 [-3.84989171  1.91139203 -3.24584238] -1299.7335765
331 [-0.81098692  2.22517883  3.19301114] -256.921627772
332 [ 4.92959444 -4.99832492 -1.81090275] -1325.41824651
333 [-2.31926489 -2.72597858  4.650447  ] -376.863707058
334 [-0.89858628  3.12330783 -3.15655874] -1478.41186971
335 [ 0.25582566  4.33988322  2.61420395] -394.956734973
336 [-2.19254392  3.26834766 -3.52461215] -1672.30814998
337 [ 1.67471427  1.62558797 -4.63703707] -64.5912591715
338 [-3.87661269  1.90986323 -3.17135182] -1153.85584067
339 [ 1.81925816  1.59081953 -4.34198738] -3.05567503911
340 [-0.83037067 -0.52686446  3.10991429] -688.935233987
341 [-4.16966077  0.90713176  4.11583974] -534.294779328
342 [-0.59929428  4.41214216  0.84514574] -982.639147017
343 [-4.3863612  -0.60168899  4.70266194] -923.84545737
344 [ 3.08063381 -4.89369186  4.33507688] -1604.1580532
345 [ 2.79181953  2.24421171  1.6060974 ] -1051.3041897
346 [-4.82568479 -1.57496544  0.64692055] -821.457938691
347 [ 4.9803688  -4.47921415 -0.09490999] -1207.82099709
348 [-2.09486968 -2.74701058  3.67127464] -492.308997952
349 [ 3.39898939 -4.73915337  2.21701884] -1544.01518796
350 [-0.83983525  2.40297279 -1.07026743] -1182.94735173
351 [ 2.11589181  0.72847894  3.10208673] -795.996464875
352 [ 0.61170541 -0.42437494 -2.73814779] -1241.09141042
353 [ 4.15846075  1.30270398  3.85767891] -605.626198703
354 [-3.15846217  1.60774516  3.41135917] -275.783358597
355 [-3.07446593  2.588875   -3.22210899] -1564.30242878
356 [ 0.34622589  0.44517141 -3.85280323] -951.579190084
357 [ 0.71217303 -1.45199033  4.66741275] -922.401359926
358 [ 1.74335937  0.66817797  4.24957293] -924.271053469
359 [ 2.24893626  3.52452503  3.22911668] -546.626742371
360 [-1.85979854  2.50721854 -2.41221281] -1410.29406747
361 [-2.29771719  1.63382326 -3.6967061 ] -1659.33352488
362 [-3.8130333   4.48207582  1.16250574] -496.880096615
363 [ 0.09365731  0.10455737  2.42539704] -711.534829916
364 [-1.52524625  1.7402998  -1.32465294] -1073.68982243
365 [ 1.72790683  1.52143352  1.93241255] -984.372463822
366 [-2.70111627  3.91059442  0.13259653] -1096.41698094
367 [-1.55715688  1.13200906 -3.48150066] -1288.46138759
368 [ 4.16401275  2.30822042  2.56966447] -63.5932348778
369 [ 2.88948271  0.20664907  2.37347089] -1234.25676466
370 [-2.33109971 -1.93333283  2.62919093] -417.22313081
371 [-3.09496011  3.80025614  1.37856983] -394.194432708
372 [-2.12108996 -3.32142219  1.78887402] -540.441292755
373 [-1.8871895   1.09551727 -2.50046718] -1097.71418502
374 [ 1.90187268 -3.4517595   2.90763346] -1462.46715999
375 [ 0.25528755  0.00780186  1.3821816 ] -1117.06024053
376 [ 1.61674582  1.31165701 -3.88114313] -197.95074584
377 [ 1.64685363  1.57702122 -4.47464358] -23.0585503878
378 [-0.47067113  3.04997915  0.19396543] -929.599715109
379 [-4.34690512  2.81758474 -3.30031485] -1509.5457982
380 [-3.76581501 -4.66138717  1.9575062 ] -285.570201704
381 [-1.86851343  0.91638881  1.73351396] -297.478566208
382 [-2.54926477  1.04695685 -0.64001794] -702.905526143
383 [-0.05363377  2.89060253 -1.81931929] -1479.3169971
384 [ 3.35302285 -2.19306806  3.47155936] -1543.75000232
385 [ 3.747334    3.61168103  3.74542639] -626.554470072
386 [ 2.42287324  3.03871678 -4.13851167] -451.724804551
387 [ 3.34276683 -4.59432066 -4.46667653] -1174.6319259
388 [-0.11227809  1.0349787  -3.30143207] -1030.90203091
389 [ 1.82925963  2.19246082 -4.03423221] -220.968963251
390 [ 3.59788138  0.84733024  3.96288899] -866.563454048
391 [-2.8702782   4.62633645 -1.3182732 ] -1309.73066979
392 [ 4.34460334 -1.48874287  2.868457  ] -1723.22010635
393 [ 0.38035881 -4.007794    4.52566973] -1232.07200005
394 [ 1.79457801  4.45997572  2.01445185] -919.99508086
395 [-2.36760918 -4.01584365  0.00806411] -965.039156885
396 [-0.87716652  1.30759749 -4.9791338 ] -1199.03870242
397 [-2.78483032 -4.5902863  -4.71894218] -994.170241992
398 [-4.92669752  0.58561928 -4.66443455] -1154.05936883
399 [ 0.59238823 -2.91592014  4.63013209] -1225.61948626
400 [ 1.87430935 -3.33834661  3.96284371] -1396.06384857
401 [ 0.03193752  1.8394498  -0.75975629] -1326.41075404
402 [ 1.34244426  3.64150348  1.54559075] -961.144575509
403 [-2.29587421 -1.13896056  0.46167376] -664.23376698
404 [ 2.42823699 -1.44538403  4.20460945] -1310.68798794
405 [-3.30984685 -4.16137644 -4.77755942] -967.073199719
406 [ 1.57822741  1.6389863  -4.29733678] -24.6741360487
407 [-0.75997694  0.30004137  4.21476294] -643.975790609
408 [ 1.67089979  1.6162284  -4.31881295] -5.32637468213
409 [ 2.20227793  2.2735161   3.16644247] -728.645964066
410 [-1.7855149   4.53372391 -0.13370164] -913.570925221
411 [ 0.23137913 -3.53937357  3.42965244] -991.02377741
412 [ 2.14005242  4.79016755  3.25300922] -738.807163413
413 [-1.31902275  2.55149724 -3.9794137 ] -1516.85487947
414 [-0.80076573  2.32812623 -4.79577807] -1280.65642817
415 [ 1.65156374  1.76319456 -4.48684581] -38.5364947134
416 [-4.30717023 -4.92414054  2.80535383] -344.404068047
417 [ 2.2869832  -3.82629143 -4.84313487] -823.335449848
418 [-0.1015864   1.41764272  3.41454155] -515.813637167
419 [-0.83230223  3.21174168 -3.13481994] -1396.27690948
420 [ 1.86458392  1.63487319 -3.97416929] -85.0460667871
421 [-1.86650324  3.84710104 -2.41619813] -1630.75662695
422 [ 2.50114413  1.72212493 -4.07870183] -244.329552241
423 [ 1.84517299  2.06240239  4.08105803] -627.879685519
424 [ 4.03414853 -0.11192732  4.13340866] -1156.79260275
425 [ 0.0131711  -4.20979431  2.24219202] -1003.01105648
426 [-4.72138671 -1.68958764  0.68588138] -728.936847399
427 [ 4.16102665  2.23777561  3.27978851] -495.78528366
428 [ 2.14976509  4.31428937  1.45417663] -1025.78413179
429 [-0.31315101  1.85936253 -4.76676807] -945.845833496
430 [-4.73528064 -2.8653923  -4.81995004] -1328.60531457
431 [-3.43794816 -3.39393621  2.3151786 ] -14.7201655375
432 [-0.18289129  2.46807541 -2.9226481 ] -1200.27286502
433 [ 1.23577153  4.97644029  2.21158074] -835.984672148
434 [ 2.40734659  2.13668276  2.53549801] -760.632730925
435 [ 3.02426483 -2.21137325  4.39359078] -1510.48086956
436 [ 0.61669095 -2.54164762  1.43097095] -1330.15787423
437 [ 1.85467742  3.42551188 -4.27996258] -763.296460917
438 [ 1.12497748 -0.28694521 -3.64212066] -1071.19424042
439 [-4.27101516 -0.32241379 -0.18764012] -607.788026617
440 [ 1.11322051  1.48614397  3.83579142] -636.439898849
441 [ 1.87597109  1.71843529 -4.01461265] -66.2454234526
442 [-0.30938654 -0.58738855  1.14451308] -1080.89077281
443 [ 4.79886644  2.87966911  2.10057548] -620.901547641
444 [ 0.68360263  2.43152189 -4.72216968] -713.85903811
445 [-3.8600927   4.6578189  -3.03340186] -1615.90499817
446 [ 4.92965671 -1.99302828 -1.2641243 ] -1579.9315268
447 [-1.47794989 -3.60426141  0.80082622] -1026.25322623
448 [-3.27882512  1.17110356 -2.97960658] -1353.49455198
449 [-0.81582438  3.74106672 -1.01179645] -1448.9847069
450 [ 2.4806505  -0.0862048   4.26320617] -934.462883004
451 [ 3.08170787  0.55489953  4.48838832] -873.315840947
452 [-2.43190339  4.48236434  1.74328729] -338.223382645
453 [ 0.27094456  4.54417399 -1.6767614 ] -1616.03358713
454 [-0.4940002   3.79834717 -1.93937098] -1605.42101133
455 [ 0.57309309 -4.76225585  2.28088734] -1293.35721383
456 [-0.54911048 -0.32864742 -2.11860684] -1094.65343835
457 [  1.06726626e+00   2.00565842e-03   3.93789231e+00] -983.466233577
458 [-2.66514413  1.57358175 -1.69636696] -1296.95811963
459 [ 0.83140954  3.79172739 -1.38174654] -1522.3279207
460 [-0.03322512  3.0904416  -1.08677452] -1444.2632002
461 [-4.67079623  1.23190135 -3.14444202] -1309.72785237
462 [-1.47633419  3.01260291  2.99157866] -247.71934307
463 [ 3.95905996 -1.68114073 -2.87415166] -1787.7933343
464 [ 1.145334   -4.00659023  3.79878197] -1418.05189121
465 [ 1.88054335  3.72406045 -0.17296988] -1479.85993866
466 [ 3.42699327  2.62566707  1.1078102 ] -1124.13186522
467 [ 1.006614    3.27921308 -4.26116226] -928.173416622
468 [ 2.27089371 -2.31872617 -1.87232756] -1521.59813211
469 [ 3.2476168   1.54307072  4.33715917] -904.627435087
470 [-1.15557595  3.82075535  0.28849413] -1211.63954234
471 [ 0.43914893  4.97820485 -0.53145266] -1542.41885096
472 [-0.34390709 -4.99936329  0.19787521] -1253.58637951
473 [-1.86647639  1.70704807 -0.35840815] -493.613314235
474 [-1.07871576 -4.89428929  3.20816893] -922.685056288
475 [ 3.91399647  1.91522077 -1.42072461] -1532.0330432
476 [ 0.44942422  0.75120401  3.6125612 ] -682.854201012
477 [ 0.86722646  2.37068898 -1.64512615] -1250.56214995
478 [-1.76201647  3.23282386 -4.85544222] -1880.71777052
479 [ 4.60875218 -2.17901735  3.90558016] -1946.40983112
480 [-2.16835699  1.68231395  0.55544581] -303.043758535
481 [ 3.60217774 -0.707521   -1.81966857] -1383.59879019
482 [ 0.12906437 -2.11070486  4.09667456] -1117.14140706
483 [ 1.26257029  4.52962611 -0.28276252] -1540.4867283
484 [-4.16415315  3.20971208  1.99898395] -709.670796345
485 [ 1.69206072  2.04405438 -2.19718654] -1362.05378691

In [21]:
x1 = np.array([-0.50046915, -4.01266659])
d = LLO.genDir(2)
x2 = x1 + th*d*0.1
xm = 0.5*(x1+x2)
y1 = f(x1)
y2 = f(x2)
ym = f(xm)
print y1, ym, y2
print LLO.LineSimple(x1,y1,x2,y2,xm,ym), 0.1*np.sqrt(2)*(f.ub[0]-f.lb[0])


-8.78773090812 -5.85149156742 -5.90145915448
0.000517312156071 1.41421356237

In [ ]: