摘要: 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) 编辑