当前位置: 首页>>代码示例>>Python>>正文


Python State.plot方法代码示例

本文整理汇总了Python中State.State.plot方法的典型用法代码示例。如果您正苦于以下问题:Python State.plot方法的具体用法?Python State.plot怎么用?Python State.plot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在State.State的用法示例。


在下文中一共展示了State.plot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initial_state

# 需要导入模块: from State import State [as 别名]
# 或者: from State.State import plot [as 别名]
def initial_state(problem, filename):
    global customers

    if filename == "nearest_neighbors":
        print "Generating nearest neighbors solution..."
        depot_c = Customer(0, 0, 0, 0, 0, 0, 0)
        c = [depot_c]
        for cust in customers:
            c.append(cust)

        paths = Dijsktra.get_nearest_neighbors_all_trucks(c, depot_c, num_trucks)

        trucks = []
        for k in range(1, num_trucks + 1):
            t = Truck(k, 0, 0, truck_capacity, path = Path(paths[k-1][1:]))
            trucks.append(t)

        state = State( trucks, parent = None )
    
    elif filename == "nn_random":
        print "Generating nearest neighbors random solution..."
        depot_c = Customer(0, 0, 0, 0, 0, 0, 0)
        c = [depot_c]
        for cust in customers:
            c.append(cust)

        paths = Dijsktra.get_nearest_neighbors_random(c, depot_c, num_trucks, 2)

        trucks = []
        for k in range(1, num_trucks + 1):
            t = Truck(k, 0, 0, truck_capacity, path = Path(paths[k-1][1:]))
            trucks.append(t)

        state = State( trucks, parent = None )
        state.plot()

    else:
        state = import_solution(problem, filename)

    if do_plot:
        state.plot()

    return state
开发者ID:conwayje,项目名称:vrptw-pgss-2016,代码行数:45,代码来源:Main.py

示例2: State

# 需要导入模块: from State import State [as 别名]
# 或者: from State.State import plot [as 别名]
state = State(prob_data)



matrices = SpatialD(state)


# We apply the power iteration to the **cmfd** matrices
solver = Solver(state, matrices)
x0 = np.random.rand(prob_data.n_dofs) + 1. #fill(1.0,n)
tolerance = 1.e-10
max_it = 1000
solver.power_iteration(x0,tolerance,max_it)

state.plot(color='blue')



#plt.plot(prob_data.x, phi_fmfd, 'o', color='red' , linewidth=3.0,linestyle='--')
#plt.plot(prob_data.x, phi_cmfd, 'x', color='blue', linewidth=3.0,linestyle='--')
#plt.legend(["phi_1 CMFD"], loc="upper left")
#plt.show()
#plt.savefig('figures/CMFD.png', bbox_inches='tight')


# 
# # phi_ref = sin(x*pi/L)/norm(sin(x*pi/L))
# # plot(x, phi_ref, color="black", linewidth=1.0, linestyle="-")
# 
# 
开发者ID:segonpin,项目名称:CMFD_cpp_python,代码行数:32,代码来源:script_CMFD.py


注:本文中的State.State.plot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。