当前位置: 首页 > news >正文

苏州seo网站优化软件友情链接可以随便找链接加吗

苏州seo网站优化软件,友情链接可以随便找链接加吗,网站怎么做短信接口,网站的链接要怎么做B题已经完成模型代码!详情查看文末名片 问题1:可以考虑使用统计学中的“样本量估算”方法,使用二项分布或正态近似来决定最少的样本量,并通过假设检验(如单侧检验)在95%和90%置信度下进行判断。 import n…

B题已经完成模型代码!详情查看文末名片

问题1:可以考虑使用统计学中的“样本量估算”方法,使用二项分布或正态近似来决定最少的样本量,并通过假设检验(如单侧检验)在95%和90%置信度下进行判断。

import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt# 参数设置
p_0 = 0.10  # 标称次品率(供应商声称)
confidence_level_95 = 0.95  # 问题 (1) 的置信水平
confidence_level_90 = 0.90  # 问题 (2) 的置信水平
margin_of_error = 0.05  # 误差限# 计算Z值
Z_95 = stats.norm.ppf((1 + confidence_level_95) / 2)  # 95%置信区间
Z_90 = stats.norm.ppf((1 + confidence_level_90) / 2)  # 90%置信区间# 样本量估算公式
def sample_size(Z, p, E):"""根据Z值,次品率p,误差限E计算最少样本量"""return (Z**2 * p * (1 - p)) / (E**2)# 计算95%和90%置信度下的最少样本量
n_95 = sample_size(Z_95, p_0, margin_of_error)
n_90 = sample_size(Z_90, p_0, margin_of_error)print(f"95%置信水平下的最少样本量: {int(np.ceil(n_95))}")
print(f"90%置信水平下的最少样本量: {int(np.ceil(n_90))}")# 抽样假设检验
def hypothesis_test(p_0, n, x, confidence_level):"""根据样本量n,抽样检测到的次品数量x,以及置信水平,计算置信区间p_0: 标称次品率n: 样本量x: 次品数量confidence_level: 置信水平"""p_hat = x / n  # 样本次品率Z = stats.norm.ppf((1 + confidence_level) / 2)margin = Z * np.sqrt((p_hat * (1 - p_hat)) / n)lower_bound = p_hat - marginupper_bound = p_hat + marginreturn lower_bound, upper_bound# 模拟抽样检测
np.random.seed(42)  # 固定随机种子
n_sample = int(np.ceil(n_95))  # 使用95%置信水平下的样本量
true_defect_rate = 0.12  # 假设实际次品率为12%
sample_defects = np.random.binomial(n_sample, true_defect_rate)  # 抽样检测出的次品数量# 进行95%置信水平的假设检验
lower_95, upper_95 = hypothesis_test(p_0, n_sample, sample_defects, confidence_level_95)
# 进行90%置信水平的假设检验
lower_90, upper_90 = hypothesis_test(p_0, n_sample, sample_defects, confidence_level_90)# 打印检测结果
print(f"抽样检测得到的次品数量: {sample_defects}/{n_sample}")
print(f"95%置信区间: [{lower_95:.3f}, {upper_95:.3f}]")
print(f"90%置信区间: [{lower_90:.3f}, {upper_90:.3f}]")
完整代码:https://mbd.pub/o/bread/mbd-ZpqZl55p

问题2:基于零配件的次品率和成本数据,建立一个决策树模型或者动态规划模型,分析在每个阶段是否检测、是否拆解能使企业的总成本最小化。重点在于计算检测成本、拆解费用、调换损失等对整体利润的影响。

import numpy as np
import matplotlib.pyplot as plt
from matplotlib import font_manager# 使用SimHei字体来支持中文显示
plt.rcParams['font.sans-serif'] = ['SimHei']  # 或者你系统支持的中文字体
plt.rcParams['axes.unicode_minus'] = False# 定义输入参数
# 情况1的数据
p1_defect_rate = 0.10  # 零配件1的次品率
p2_defect_rate = 0.10  # 零配件2的次品率
product_defect_rate = 0.10  # 成品的次品率
purchase_cost1 = 4  # 零配件1的购买单价
purchase_cost2 = 18  # 零配件2的购买单价
assembly_cost = 6  # 装配成本
market_price = 56  # 市场售价
replacement_loss = 6  # 调换损失
dismantling_cost = 5  # 拆解费用# 检测成本
detection_cost1 = 2  # 零配件1的检测成本
detection_cost2 = 3  # 零配件2的检测成本
product_detection_cost = 3  # 成品的检测成本# 决策1: 是否对零配件进行检测
def part_detection_decision(p_defect, detection_cost, purchase_cost):"""决定是否对零配件进行检测,基于检测成本和次品率如果检测成本低于购买并丢弃次品的期望损失,则选择检测"""expected_defect_loss = p_defect * purchase_cost  # 不检测时的期望损失if detection_cost < expected_defect_loss:return True  # 检测else:return False  # 不检测# 决策2: 是否对成品进行检测
def product_detection_decision(p_defect, detection_cost, market_price, replacement_loss):"""决定是否对成品进行检测,基于检测成本和退货损失如果检测成本低于次品退货的期望损失,则选择检测"""
完整代码:https://mbd.pub/o/bread/mbd-ZpqZl55p

问题3:扩展模型,考虑多道工序的情形。可以将每道工序看作一个子系统,递归地分析各个阶段的次品率对最终成品质量的影响,并提出最优的检测方案。

import numpy as np
import matplotlib.pyplot as pltplt.rcParams['font.sans-serif'] = ['SimHei']  # 中文字体
plt.rcParams['axes.unicode_minus'] = False  # 解决负号显示问题# 决策函数:是否检测零配件
def part_detection_decision(p_defect, detection_cost, purchase_cost):"""根据次品率和检测成本,决定是否检测零配件。"""expected_defect_loss = p_defect * purchase_cost  # 不检测的期望次品损失detect = detection_cost < expected_defect_loss  # 如果检测成本低于次品损失,则检测decision = "检测" if detect else "不检测"return detect, decision# 决策函数:是否检测半成品/成品
def product_detection_decision(p_defect, detection_cost, replacement_loss):"""根据次品率和检测成本,决定是否检测半成品或成品。"""expected_defect_loss = p_defect * replacement_loss  # 不检测的期望次品损失detect = detection_cost < expected_defect_loss  # 如果检测成本低于次品损失,则检测decision = "检测" if detect else "不检测"return detect, decision# 工序中次品率的递进计算
def calculate_defect_rate(p_list):"""计算多个零配件组合后的次品率(使用联合概率公式)。p_list: 各零配件的次品率列表"""combined_defect_rate = 1 - np.prod([1 - p for p in p_list])  # 联合次品率return combined_defect_rate# 计算总成本,并输出决策依据
def total_cost(steps, dismantling_cost, replacement_loss):"""计算总期望成本,并输出决策依据。"""total_parts_cost = 0total_assembly_cost = 0total_product_cost = 0previous_defect_rate = 0  # 初始时为0,没有前序工序
完整代码:https://mbd.pub/o/bread/mbd-ZpqZl55p

问题4:结合问题1的抽样检测方法,重新优化问题2和问题3中的方案,确保抽样检测得到的次品率可以指导后续的决策。

import numpy as np
import scipy.stats as stats# 抽样次品率估计函数
def estimate_defect_rate(sample_size, defect_count):"""使用抽样检测方法估算次品率。sample_size: 样本量defect_count: 检测到的次品数"""return defect_count / sample_size# 决策函数:是否检测零配件
def part_detection_decision(p_defect, detection_cost, purchase_cost):"""根据估算次品率和检测成本,决定是否检测零配件。"""expected_defect_loss = p_defect * purchase_cost  # 不检测的期望次品损失detect = detection_cost < expected_defect_loss  # 如果检测成本低于次品损失,则检测decision = "检测" if detect else "不检测"return detect, decision# 决策函数:是否检测成品
def product_detection_decision(p_defect, detection_cost, replacement_loss):"""根据估算次品率和检测成本,决定是否检测成品。p_defect: 成品的次品率detection_cost: 检测成品的成本replacement_loss: 成品退货的损失"""expected_defect_loss = p_defect * replacement_loss  # 不检测的期望退货损失detect = detection_cost < expected_defect_loss  # 如果检测成本低于退货损失,则检测decision = "检测" if detect else "不检测"return detect, decision# 工序中次品率的递进计算
def calculate_defect_rate(p_list):"""计算多个零配件组合后的次品率(使用联合概率公式)。
完整代码:https://mbd.pub/o/bread/mbd-ZpqZl55p
http://www.zhongyajixie.com/news/6002.html

相关文章:

  • 通过高新区网站建设seo网站分析
  • 房山网站建设公司网络营销推广软件
  • 济宁网站建设 帮站旺道seo推广有用吗
  • 购买一级域名做网站推广普通话宣传海报
  • 宇锋网站建设宁德市政府
  • 购买一级域名做网站长尾关键词排名系统
  • 在哪个网站找事做靠谱杭州企业seo
  • 做公众号的网站模板下载深圳营销型网站定制
  • 金华规划局网站开发区公司网站定制
  • 静态网站建设的技术运用在百度怎么发广告做宣传
  • 网站后台可改资料适合发表个人文章的平台
  • 聊城做网站推广可以发广告的100个网站
  • 怎么给一个花店做网站建设2024百度下载
  • 建网站需要有啥能力哪里可以代写软文
  • 网站后台补丁如何做网坛最新排名
  • 太阳镜商城网站建设网站服务器地址查询
  • 做文献综述用什么网站百度网站推广价格
  • 博彩网站开发逻辑网站建设与网页设计制作
  • 做网站标题居中代码百度手机卫士下载安装
  • 网站后台配置教育培训机构加盟
  • 省建设厅官网查询东莞关键词seo
  • 软件开发文档是什么南宁优化网站网络服务
  • 南宁网页设计价格太原百度seo排名
  • 响应式企业网站 下载代写平台在哪找
  • 怎么把微信公众号的文章wordpressseo快速排名是什么
  • 做动漫短视频网站seo搜索引擎优化实战
  • 自助网站建设系统企业管理软件
  • 市政府网站集约化建设调研报告广州:推动优化防控措施落地
  • 广东深广东深圳网站建设成都本地推广平台
  • 做雨棚的网站seo模拟点击软件