当前位置:网站首页>[Mathematical Modeling] Integer Programming
[Mathematical Modeling] Integer Programming
2022-08-06 08:54:00 【happy star】
司守奎 《数学建模算法与应用》 第二版

0-1型
相互排斥的约束条件
5x1+4x2≤24 或 7x1+3x2≤45

如果有m个互相排斥的约束条件
指派问题
拟分配n人去做n项工作,每人做且仅做一项工作,若分配第i人去做第j项工作,需花费c单位时间,Ask how work should be distributed so that workers spend the least total time?
蒙特卡洛法(随机取样法)
y=x2、y=12-x与x轴在第一象限围成一个曲边三角形.设计一个随机实验,求该图形面积的近似值.
在矩形区域[0,12]×[0,9]上产生服从均匀分布的107个随机点,统计随机点落在曲边三角形的频数,则曲边三角形的面积近似为上述矩形的面积乘以频率.
clc,clear
×=unifrnd(0,12,[1,10000000]);
y=unifrnd(0,9,[1,10000000]);
pinshu =sum(y<x.^2 &x<=3)+sum(y <12-x&x>=3);
area_appr =12 *9 *pinshu/10^7

编写文件mengte.m,目标函数fand constraint vectorg
function[f,g]=mengte(x);
f=x(1)^2+x(2)^2+3*x(3)^2+4*x(4)^2+2*x(5)^2-8*x(1)-2*x(2)-3*x(3)-x(4)-...
2*x(5);
g=[
sum(x)-400
x(1)+2*x(2)+2*x(3)+x(4)+6*x(5)-800
2*x(1)+x(2)+6*x(3)-200
x(3)+x(4)+5*x(5)-200
];
主函数
format compact;
rand('state',sum(clock)); % 初始化随机数发生器
p0=0;
tic % 计时开始
for i=1:10^6
x=randi([0,99],1,5); % 产生1行5列的区间[0,99]上的随机整数
[f,g]=mengte(x);
if all(g<=0)
if p0<f
x0=0;p0=f; % Record the current best solution
end
end
end
x0,p0
toc % 计时结束
边栏推荐
- pytorch中的两个重要的自学函数 dir() ; help()
- From "prairie cattle" to "digital cattle": Mengniu's digital transformation!
- 在多核异构SoC平台上进行软件开发
- HCIP 18 days notes
- 2022-08-05:以下go语言代码输出什么?A:65, string;B:A, string;C:65, int;D:报错。
- 回头再看ResNet——深度学习史上的关键一步
- Mysql事物详解(重要)
- Flashing Neon Text Animation
- 干货,分布式数据库在金融核心场景的落地实践|腾讯云数据库
- Day 17 (16 day bpdus related knowledge and STP configuration)
猜你喜欢

QT配置,缺失.dll

How much is a code signing certificate?

【保姆级教程】腾讯云如何获取secretId和secretKey,以及开通人脸服务

微服务下token设计方案

Summary of the experience of project operation and maintenance work

Timed task appears A component required a bean named ‘xxx‘ that could not be found

RL强化学习总结(二)

干货,分布式数据库在金融核心场景的落地实践|腾讯云数据库

数据安全法在企业如何落地?

Two important self-learning functions in pytorch dir(); help()
随机推荐
Rock vocal | completes the safety operation, is not so difficult as you think
21天学习挑战赛--第三天打卡(动态更换app图标)
国内自媒体宣发.多媒体发稿的优势
2022-08-05: What does the following go code output?A: 65, string; B: A, string; C: 65, int; D: error.
第十六天(配置BPDU,TCN BPDU)
Leetcode77. 组合
jupyter notebook & pycharm(anaconda)
Free and open source web version of Xshell [Happy New Year to everyone]
ROS error [rospack] Error: package ‘.....‘ not found
EsgynDB Troubleshooting - 网卡MTU导致跨网段访问数据库失败
【Log】镜像源配置以及最新可用镜像源
在多核异构SoC平台上进行软件开发
闪烁霓虹灯文字动画
Go 语言快速入门指南:结构体
页面加载动画_渐隐变色旋转小圆圈
剑指 Offer 56 - I. 数组中数字出现的次数
bpe 中文tokens
剑指 Offer 15. 二进制中1的个数,位运算,与运算
剑指 Offer 39. 数组中出现次数超过一半的数字
Hdu 2022多校训练(5) Slipper