Ejemplo n.º 1
0
 def get_gp(self):
     self.gps = {}
     for run in self.res_dict.keys():
         ws = self.res_dict[run][self.WS]
         w_grid = self.paramses[run]['w_grid'][0]
         g0 = Interp(w_grid, w_grid/4, kind='pchip')
         params = self.paramses[run]
         gp = g_p(g0, ws, params)
         self.gps[run] = gp
Ejemplo n.º 2
0
            params = self.paramses[run]
            gp = g_p(g0, ws, params)
            self.gps[run] = gp

    # def diff_ws(self, l_key, r_key):
    #     left = self.res_dict[l_key][self.VF]
    #     right = self.res_dict[r_key][self.VF]

if __name__ == '__main__':
    wns = [100, 400]
    zns = [100, 400]

    paramses = setup(wns, zns)

    res_dict = {}
    for wn_zn, params in paramses.iteritems():
        w_grid = params['w_grid'][0]
        w0 = Interp(w_grid, -w_grid+28)
        strt = datetime.datetime.now()
        Tv, ws, rest = iter_bellman(w0, tol=0.1, strict=False, log=False,
                                    params=params)
        time_delta = datetime.datetime.now() - strt
        print(wn_zn, str(time_delta))

        w_max = w_grid[-1]
        g0 = Interp(w_grid, w_grid/w_max, kind='pchip')
        gp = g_p(g0, ws, params)
        res_dict[wn_zn] = (Tv, ws, rest, time_delta, gp)

    res = Results(res_dict, paramses)