本文整理汇总了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
示例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="-")
#
#