摘要: 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-11-18 17:52 qi11 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 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-11-18 17:51 qi11 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 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-11-18 17:50 qi11 阅读(2) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import pandas as pd import sympy as sp sp.init_printing(use_latex=True) from scipy.integrate import odeint import matplotlib.pyplot 阅读全文
posted @ 2024-11-12 13:54 qi11 阅读(4) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import pandas as pd import sympy as sp sp.init_printing(use_latex=True) from scipy.integrate import odeint import matplotlib.pyplot 阅读全文
posted @ 2024-11-12 13:51 qi11 阅读(3) 评论(0) 推荐(0) 编辑
摘要: import numpy as np from scipy.interpolate import interp1d, interp2d, UnivariateSpline, griddata import matplotlib.pyplot as plt np.random.seed(114514) 阅读全文
posted @ 2024-10-28 21:55 qi11 阅读(3) 评论(0) 推荐(0) 编辑
摘要: import numpy as np from scipy.interpolate import interp1d, interp2d, UnivariateSpline, griddata import matplotlib.pyplot as plt t0 = np.linspace(700, 阅读全文
posted @ 2024-10-28 21:55 qi11 阅读(6) 评论(0) 推荐(0) 编辑
摘要: import cvxpy as cp import numpy as np import pandas as pd from scipy.optimize import minimize import sympy as sp sp.init_printing(use_unicode=True) im 阅读全文
posted @ 2024-10-15 11:34 qi11 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 把max放进约束条件,不妨假定小于等于10000 linprog from scipy.optimize import linprog c=[0,0,3,2] A=[[-1,-1,0,0],[0,0,-1,-1],[3,0,2,0],[0,3,0,2],[100,90,80,70]] b=[[-30 阅读全文
posted @ 2024-10-15 11:34 qi11 阅读(4) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import math from scipy.optimize import minimize, Bounds def func(x): return sum(math.sqrt(x[i]) for i in range(100)) def con(x): re 阅读全文
posted @ 2024-10-15 11:34 qi11 阅读(4) 评论(0) 推荐(0) 编辑