07 2022 档案

摘要:import numpy as np inf = 99999 # 不连通值 mtx_graph = [[0, 1, inf, 3, inf, inf, inf, inf, inf], [1, 0, 5, inf, 2, inf, inf, inf, inf], [inf, inf, 0, 1, in 阅读全文
posted @ 2022-07-31 22:59 故y 阅读(199) 评论(0) 推荐(0) 编辑
摘要:from collections import defaultdict from heapq import * # 堆--先进后出 inf = 99999 # 不连通值 mtx_graph = [[0, 1, inf, 3, inf, inf, inf, inf, inf], [1, 0, 5, i 阅读全文
posted @ 2022-07-31 16:43 故y 阅读(180) 评论(0) 推荐(0) 编辑
摘要:六个模型的区别 SI-Model import scipy.integrate as spi import numpy as np import matplotlib.pyplot as plt # N为人群总数 N = 10000 # β为传染率系数 beta = 0.25 # gamma为恢复率 阅读全文
posted @ 2022-07-31 16:37 故y 阅读(656) 评论(0) 推荐(0) 编辑
摘要:import numpy as np from scipy.integrate import odeint from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt def dmove(Point, t, sets 阅读全文
posted @ 2022-07-31 10:01 故y 阅读(213) 评论(0) 推荐(0) 编辑
摘要:import numpy as np from scipy import integrate import matplotlib.pyplot as plt import sympy def plot_direction_field(x, y_x, f_xy, x_lim=(-5, 5), y_li 阅读全文
posted @ 2022-07-31 09:57 故y 阅读(233) 评论(0) 推荐(0) 编辑
摘要:import numpy as np import matplotlib.pyplot as plt from scipy.optimize import leastsq from matplotlib.pylab import mpl mpl.rcParams['font.sans-serif'] 阅读全文
posted @ 2022-07-27 10:07 故y 阅读(174) 评论(0) 推荐(0) 编辑
摘要:import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib as mpl from scipy import interpolate import matplotlib.cm as cm import ma 阅读全文
posted @ 2022-07-27 10:05 故y 阅读(586) 评论(0) 推荐(0) 编辑
摘要:为了满足对函数光滑性的需要,我们可以使用一种有弹性的长条(称之为样条),强迫它弯曲通过样本点。 import numpy as npimport matplotlib.pylab as plfrom scipy import interpolatex = np.linspace(0, 10, 11) 阅读全文
posted @ 2022-07-27 09:51 故y 阅读(242) 评论(0) 推荐(0) 编辑
摘要:凸函数的非线性规划 minimize 求解的是局部最优解 简单的函数,无所谓 复杂的函数 初始值的设定很重要 scipy.optimize.minimize(fun,x0,args=(),method=None,jac=None,hess=None,hessp=None,bounds= None,c 阅读全文
posted @ 2022-07-26 11:15 故y 阅读(374) 评论(0) 推荐(0) 编辑
摘要:zip函数 a = [1,2,3,4]b = [5,6,7,8]i = sum(x * y for x, y in zip(a, b))print(i)70 floor and ceil 函数 import matha = 34.3print(math.floor(a))print(math.cei 阅读全文
posted @ 2022-07-25 09:15 故y 阅读(433) 评论(0) 推荐(0) 编辑
摘要:代码 import pulp import numpy as np from pprint import pprint def transport_problem(costs, x_max, y_max): row = len(costs) col = len(costs[0]) prob = pu 阅读全文
posted @ 2022-07-24 17:55 故y 阅读(405) 评论(0) 推荐(0) 编辑
摘要:instance 代码: import pulp z = [2, 3, 1] a = [[1, 4, 2], [3, 2, 0]] b = [8, 6] aeq = [[1,2,4]] beq = [101] #确定最大化最小化问题,最大化只需将Min改成Max即可 m = pulp.LpProbl 阅读全文
posted @ 2022-07-24 17:50 故y 阅读(591) 评论(0) 推荐(0) 编辑
摘要:instance1: 求解下列线性规划问题 s.t. 代码: from scipy import optimizeimport numpy as npc = np.array([2,3,-5])A = np.array([[-2,5,-1],[1,3,1]])B = np.array([-10,12 阅读全文
posted @ 2022-07-24 17:44 故y 阅读(110) 评论(0) 推荐(0) 编辑
摘要:线程安全性问题# 多线程环境下 肯定不可以变为单线程# 共享变量 不可以# 并发对共享变量进行修改 可以 import threadingclass MyThread(threading.Thread): sum = 0 # 锁 lock = threading.Lock() def run(sel 阅读全文
posted @ 2022-07-01 13:57 故y 阅读(18) 评论(0) 推荐(0) 编辑
摘要:import threadingclass MyThreading(threading.Thread): def run(self): print("Hello,world!")my_threading = MyThreading()my_threading2 = MyThreading()my_t 阅读全文
posted @ 2022-07-01 13:47 故y 阅读(20) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示