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

贸易网站源码淘客类网站如何做排名

贸易网站源码,淘客类网站如何做排名,类似网站的建设,建筑网站 国外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.yayakq.cn/news/514225/

相关文章:

  • 程序员 做网站 微信公众号 赚钱wordpress 获取用户密码
  • 网站海外推广多少钱男女做暖暖暖网站
  • 做网站如何买量小程序流量点击推广平台
  • 公司怎么在百度做网站网站备案主体
  • 为自家企业做网站现在做网络优化有前途吗
  • 潍坊青州网站建设怎么做wep网站
  • 学校网站方案网站推广做多大尺寸
  • 赣州市南康建设局网站ui界面设计作品模板
  • 如何创建一个自己的网站php网站开发示例
  • 个人网站如何加入百度联盟兵团住房和城乡建设局网站
  • 做图兼职网站有哪些学生网页制作教程
  • 表白网页制作网站广州搜发网络科技有限公司
  • 网站架构的优化苏州网站seo服务
  • 一建 建设网站网站建设中主页源码
  • 深圳网站建设与推广wordpress同步到豆瓣
  • 厦门营销网站建设重庆网站开发商城
  • 做毕业设计网站教程什么关键词能搜到资源
  • 网站怎么做推广建设营销型网页
  • 网站后台维护主要做什么2015网站排名
  • 没有网站可以做淘宝客简约大气网站首页
  • 网站建设五合一是指什么wordpress的slider
  • 黄骅港客运站电话号码做界面网站用什么语言好
  • 微信分享网站短链接怎么做wordpress怎么在主题上更改
  • 罗定市住房和城乡建设局网站网络设计目标
  • 好的兼职做调查网站大连网站设计策划
  • access 数据库做网站top域名注册
  • 企业网站建设策划书标准版android移动网站开发详解光盘下载
  • 好的网站或网页建设网站收费明细
  • 郑州免费网站建设网站建设公司初心
  • 广西城乡住房建设厅网站首页平面设计的规律