合集-数学建模习题第六章
数学建模习题6.2
摘要:edges = [ ("Pe", "T", 13), ("Pe", "N", 68), ("Pe", "M", 78), ("Pe", "L", 51), ("Pe", "Pa", 51), ("T", "N", 68), ("T", "M", 70), ("T", "L", 6 阅读全文
posted @ 2024-10-14 23:41 VVV1 阅读(23) 评论(0) 推荐(0)
数学建模习题6.3
摘要:import heapq def prim(graph, start): num_nodes = len(graph) visited = [False] * num_nodes min_heap = [(0, start, -1)] mst_cost = 0 mst_edges = [] whil 阅读全文
posted @ 2024-10-14 23:49 VVV1 阅读(31) 评论(0) 推荐(0)
数学建模习题6.6
摘要:`import numpy as np matches = np.array([ [0, 1, 0, 1, 1, 1], # 1队 [0, 0, 0, 1, 1, 1], # 2队 [1, 1, 0, 1, 0, 0], # 3队 [0, 0, 0, 0, 1, 1], # 4队 [0, 0, 1, 阅读全文
posted @ 2024-10-27 23:10 VVV1 阅读(45) 评论(0) 推荐(0)
数学建模习题6.5
摘要:`import numpy as np distances = np.array([ [0, 2, 7, np.inf, np.inf, np.inf], [2, 0, 4, 6, 8, np.inf], [7, 4, 0, 1, 3, np.inf], [np.inf, 6, 1, 0, 1, 6 阅读全文
posted @ 2024-10-27 23:07 VVV1 阅读(33) 评论(0) 推荐(0)
数学建模习题6.1
摘要:非赋权图: import networkx as nx import matplotlib.pyplot as plt G = nx.Graph() nodes = ['v1', 'v2', 'v3', 'v4', 'v5', 'v6'] G.add_nodes_from(nodes) edges 阅读全文
posted @ 2024-10-27 23:03 VVV1 阅读(26) 评论(0) 推荐(0)
数学建模习题6.4
摘要:initial_costs = [2.5, 2.6, 2.8, 3.1] salvage_values = [2.0, 1.6, 1.3, 1.1] maintenance_costs = [0.3, 0.8, 1.5, 2.0] dp = [[float('inf')] * 2 for _ in 阅读全文
posted @ 2024-10-14 23:51 VVV1 阅读(26) 评论(0) 推荐(0)