![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
1个回答
展开全部
x = intlinprog(f,intcon,A,b,Aeq,beq)就可以了
用法举例:
Write the objective function vector and vector of integervariables.
f = [-3;-2;-1];
intcon = 3;
Write the linear inequality constraints.
A = [1,1,1];
b = 7;
Write the linear equality constraints.
Aeq = [4,2,1];
beq = 12;
Write the bound constraints.
lb = zeros(3,1);
ub = [Inf;Inf;1]; % Enforces x(3) is binary
Call intlinprog.
x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub)
用法举例:
Write the objective function vector and vector of integervariables.
f = [-3;-2;-1];
intcon = 3;
Write the linear inequality constraints.
A = [1,1,1];
b = 7;
Write the linear equality constraints.
Aeq = [4,2,1];
beq = 12;
Write the bound constraints.
lb = zeros(3,1);
ub = [Inf;Inf;1]; % Enforces x(3) is binary
Call intlinprog.
x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub)
更多追问追答
追问
谢谢您的回答,这个不是0-1整数规划的嘛?关于遗传算法的编程应该怎么做呢?
追答
线性规划问题就不要用遗传算法了。因为遗传算法不保证得到最优解。遗传算法一般用于非线性规划问题。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询