版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、.using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace 灵敏度分析尝试 public partial class Form1 : Form public Form1() InitializeComponent(); public bool jiansuo(double x, dou
2、ble y) bool cunzai = false; ; for (int i = 0; i y.Length; i+) if (yi = x) cunzai = true; return cunzai; public double qiumax(List array) double max=-9999; for (int i = 0; i max) max = arrayi; return max; public double qiumin(List array) double min = 9999; for (int i = 0; i array.Count; i+) if (array
3、i 0 | dataGridView2.Columns.Count 0 | dataGridView3.Columns.Count 0 | dataGridView4.Columns.Count 0 | dataGridView5.Columns.Count 0) dataGridView1.Columns.Clear(); dataGridView2.Columns.Clear(); dataGridView3.Columns.Clear(); dataGridView4.Columns.Clear(); dataGridView5.Columns.Clear(); if (dataGrid
4、View1.Rows.Count 0 | dataGridView2.Rows.Count 0 | dataGridView4.Rows.Count 0 | dataGridView5.Rows.Count 0) dataGridView1.Rows.Clear(); dataGridView2.Rows.Clear(); dataGridView3.Rows.Clear(); dataGridView4.Rows.Clear(); dataGridView2.Rows.Clear(); int m, n; m = int.Parse(textBox1production.Text);/m=3
5、 n = int.Parse(textBox2resource.Text);/n=3 for (int i = 1; i = m + n; i+) dataGridView5.Columns.Add( , C + i.ToString(); for (int i = 1; i = m + n; i+) dataGridView4.Columns.Add(, X + i.ToString(); dataGridView4.Rows.Add(n + 1); dataGridView3.Columns.Add( , C); dataGridView1.Columns.Add(, Cb); dataG
6、ridView1.Columns.Add(, Xb(下标); dataGridView1.Columns.Add(, B-1b); dataGridView1.Rows.Add(n); dataGridView2.Columns.Add( , C); dataGridView2.Rows.Add(1); private void splitContainer3_SplitterMoved(object sender, SplitterEventArgs e) private void splitContainer6_Panel2_Paint(object sender, PaintEventA
7、rgs e) private void button1产品_Click(object sender, EventArgs e) double Xb = new doubledataGridView1.Rows.Count;/用于存放Xb的下标; for (int i = 0; i dataGridView1.Rows.Count; i+) if (dataGridView1.Rowsi.Cells1.Value != null) Xbi = double.Parse(dataGridView1.Rowsi.Cells1.Value.ToString(); double, A = new dou
8、bledataGridView4.Rows.Count, dataGridView4.Columns.Count;/A矩阵存放后面的 for (int i = 0; i dataGridView4.Rows.Count; i+) for (int j = 0; j dataGridView4.Columns.Count; j+) if (dataGridView4.Rowsi.Cellsj.Value != null) Ai, j = double.Parse(dataGridView4.Rowsi.Cellsj.Value.ToString(); int pro=0; if (textBox
9、3输入产品.Text!=) pro = int.Parse(textBox3输入产品.Text); if (pro int.Parse(textBox1production.Text)+int.Parse (textBox2resource .Text) MessageBox.Show(输入的数据必须大于0小于产品总数+资源数!,请重新输入!); else if (jiansuo(pro, Xb) List zuo = new List(); List you = new List(); double zuomax = 0, youmin = 0; for (int j = 0; j Xb.L
10、ength; j+) if (pro = Xbj)/pro是基变量,且第i列是非基变量 for (int i = 0; i 0) shang=AA.GetLength(0) - 1, i / Aj, i; zuo.Add(Math.Round (shang,2); /非基变量的检验数除以Cj(j就是pro)对应的变量Xj那一行 if (Aj, i 0) zuomax = qiumax(zuo); if (you.Count 0) youmin = qiumin(you); if (zuo.Count = 0 & you.Count = 0) textBox1产品结果.Text = ; if (
11、zuo.Count 0 & you.Count = 0) textBox1产品结果.Text = 产品 + pro + 的变化量= + Convert.ToString(zuomax); if (zuo.Count = 0 & you.Count 0) textBox1产品结果.Text = 产品 + pro + 的变化量 0 & you.Count 0) textBox1产品结果.Text = 产品 + pro + 的变化范围为 + Convert.ToString(zuomax) + 到 + Convert.ToString(youmin); if (jiansuo(pro, Xb)=fa
12、lse ) int hangbiao=dataGridView4.Rows .Count-1; if (dataGridView4.Rowshangbiao.Cellspro-1.Value != null) double jieguo = -(double.Parse(dataGridView4.Rowshangbiao.Cellspro -1.Value.ToString(); textBox1产品结果.Text = 产品 + pro + 的变化量= + Convert.ToString(jieguo); private void button资源计算_Click(object sende
13、r, EventArgs e) double B_1b = new doubledataGridView1.Rows.Count;/用于存放B-1b列; for (int i = 0; i dataGridView1.Rows.Count; i+) /给XbB_1b赋值 if (dataGridView1.Rowsi.Cells2.Value != null) B_1bi = double.Parse(dataGridView1.Rowsi.Cells2.Value.ToString(); int Res = 0; if (textBox3输入资源.Text != ) Res = int.Pa
14、rse(textBox3输入资源.Text); if (Res int.Parse(textBox2resource.Text) MessageBox.Show(输入的数据必须大于0小于等于资源数!,请重新输入!); else double Xnaddi = new doubledataGridView4.Rows.Count-1;/用于存放Xnaddi列 for (int i = 0; i dataGridView4.Rows.Count-1; i+) if (dataGridView4.Rowsi.Cellsint.Parse(textBox1production.Text) + Res-
15、1.Value != null) Xnaddii = double.Parse(dataGridView4.Rowsi.Cellsint.Parse(textBox1production.Text) + Res-1.Value.ToString(); double shang = 0; List zuo = new List(); List you = new List(); double zuomax = 0, youmin = 0; for (int i = 0; i 0) shang = -(B_1bi) / Xnaddii; zuo.Add(Math.Round(shang, 2);
16、/非基变量的检验数除以Cj(j就是pro)对应的变量Xj那一行 if (Xnaddii 0) zuomax = qiumax(zuo); if (you.Count 0) youmin = qiumin(you); if (zuo.Count = 0 & you.Count = 0) textBox2资源结果.Text = ; if (zuo.Count 0 & you.Count = 0) textBox2资源结果.Text = 资源 + Res + 的变化量= + Convert.ToString(zuomax); if (zuo.Count = 0 & you.Count 0) text
17、Box2资源结果.Text = 资源 + Res + 的变化量 0 & you.Count 0) textBox2资源结果.Text = 资源 + Res + 的变化范围为 + Convert.ToString(zuomax) + 到 + Convert.ToString(youmin); private void button1影子价格_Click(object sender, EventArgs e) int m; m = Convert.ToInt32(textBox1production.Text ); int n; n = Convert.ToInt32(textBox2resour
18、ce.Text ); double Aend = new double dataGridView4.Columns.Count;/A矩阵存放后面的 for (int j = 0; j dataGridView4.Columns.Count; j+) if (dataGridView4.RowsdataGridView4.Rows.Count - 1.Cellsj.Value != null) Aendj = double.Parse(dataGridView4.RowsdataGridView4.Rows.Count - 1.Cellsj.Value.ToString(); int resou
19、rce = 0; if (textBox1输入资源.Text != ) resource = int.Parse(textBox1输入资源.Text); if (resource n) MessageBox.Show(输入的数据必须大于0小于等于资源数!,请重新输入!); if (resource 0 & resource 0 | dataGridView6.Columns.Count 0) dataGridView6.Rows.Clear(); dataGridView6.Columns.Clear(); dataGridView6.Columns.Add( , 单位利润 ); for (i
20、nt i = 1; i = int.Parse(textBox2resource.Text); i+) dataGridView6.Columns.Add( , 消耗资源 + i.ToString(); dataGridView6.Rows.Add(1); private void splitContainer9_Panel1_Paint(object sender, PaintEventArgs e) private void buttonCount_Click(object sender, EventArgs e) int m, n; m = int.Parse(textBox1produ
21、ction.Text);/m=3 n = int.Parse(textBox2resource.Text);/n=3 double A = new doublen;/A矩阵存放后面的 for (int j = 0; j n; j+) if (dataGridView4.RowsdataGridView4.Rows.Count - 1.Cellsj+m.Value != null) Aj = Math.Abs(double.Parse(dataGridView4.RowsdataGridView4.Rows.Count - 1.Cellsj+m.Value.ToString(); double
22、XbN = new doublen+1; for (int i = 0; i n+1; i+) if (dataGridView6.Rows0.Cellsi.Value != null) XbNi = double.Parse(dataGridView6.Rows0.Cellsi.Value.ToString(); double z = XbN0; for (int i = 0; i 0) textBox1.Text = 生产该商品盈利; else textBox1.Text = 生产该商品亏本; private void button2_Click(object sender, EventA
23、rgs e) int i = 0, j = 0; if (textBox6i.Text != & textBox5j.Text != ) i = int.Parse(textBox6i.Text); j = int.Parse(textBox5j.Text); if (j (int.Parse(textBox1production.Text) + int.Parse(textBox2resource.Text) | i int.Parse(textBox2resource.Text) MessageBox.Show(输入的产品必须大于0小于产品总数+资源数;输入的资源必须大于0小于资源数!,请
24、输入正确的数字!); else double shang = 0; double Azuihouyihang = new doubledataGridView4.Columns.Count; for (int n = 0; n 0) i = int.Parse(textBox6i.Text); j = int.Parse(textBox5j.Text); shang = y / Math.Abs(x); textBox4Aij结果.Text = A + i + j + 的变化量= + Convert.ToString(Math.Round(shang, 2); i = int.Parse(te
25、xtBox6i.Text); j = int.Parse(textBox5j.Text); else textBox4Aij结果.Text = A + i + j + 的变化量为 + R; private void button1产品计算_Click(object sender, EventArgs e) double Xb = new doubledataGridView1.Rows.Count;/用于存放Xb的下标; for (int i = 0; i dataGridView1.Rows.Count; i+) if (dataGridView1.Rowsi.Cells1.Value !=
26、 null) Xbi = double.Parse(dataGridView1.Rowsi.Cells1.Value.ToString(); double, A = new doubledataGridView4.Rows.Count, dataGridView4.Columns.Count;/A矩阵存放后面的 for (int i = 0; i dataGridView4.Rows.Count; i+) for (int j = 0; j dataGridView4.Columns.Count; j+) if (dataGridView4.Rowsi.Cellsj.Value != null
27、) Ai, j = double.Parse(dataGridView4.Rowsi.Cellsj.Value.ToString(); int pro=0; if (textBox3输入产品.Text!=) pro = int.Parse(textBox3输入产品.Text); if (pro int.Parse(textBox1production.Text)+int.Parse (textBox2resource .Text) MessageBox.Show(输入的数据必须大于0小于产品总数+资源数!,请重新输入!); else if (jiansuo(pro, Xb) List zuo = new List(); List you = new List(); double z
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- GB/Z 176-2026生物技术生物过程用于治疗用细胞制造设备系统的通用要求和考虑
- 养老护理员职业道德培训
- 国家级检验检测机构资质认定评审员考试试题及答案(河南省开封市2026年)
- 2026心理咨询师考试题库附参考答案
- 《水力分析与计算》 课件 课程介绍
- 2026年心理咨询师国家职业资格认证考试试题及答案
- 2026年湖北省咸宁市农业专业技术职务水平能力测试(农学)全真模拟试题及答案
- 2026年湖北建筑工程专业技术职务水平能力测试(工程造价)训练题及答案
- 2026年第三届全国应急管理普法知识竞赛题库及答案
- 肠道微生态制剂临床应用专家共识
- 2026年辽宁锦州海通实业有限公司度校园招聘28人笔试备考题库及答案详解
- 2026年巨量本地推初级题库
- 摩根士丹利-中国消费:当前消费趋势走向何方?-China Consumer:Where is consumption trending now-20260601
- GB 26396-2026洗涤用品安全技术规范
- 2026年北京市石景山区初三二模英语试卷(含答案及解析)
- GB/T 2828.1-2012计数抽样检验程序第1部分:按接收质量限(AQL)检索的逐批检验抽样计划
- GB/T 28026.2-2018轨道交通地面装置电气安全、接地和回流第2部分:直流牵引供电系统杂散电流的防护措施
- GB 12021.3-2000房间空气调节器能源效率限定值及节能评价值
- 设备运行分析报告(模板02)
- 二次函数求最值动轴定区间动区间定轴课件
- X射线衍射课件(XRD)
评论
0/150
提交评论