(1)   linprog函数是用来求解线性规划问题的。

什么是线性规划问题?

就是在一系列的线性条件的约束下,从而规定了可行解,在通过具体的目标函数,求得满足函数 的最优的解

例如平常的线性规划函数的例子:

而在matlab中使用matlab 标准的格式:

若是目标函数是求解最大值的话,则取-C形式:

具体的应用:

代码:

c = [2;3;-5];               %目标函数的系数

a = [-2,5,-1;1,3,1];      %不等式的系数(其中的不等式是小于等于>)

b = [-10,12];              %不等式的右边的矩阵

aeq = [1,1,1];            %等式部分的系数

deq = 7;                  %等式的右边的值

x = linprog(-c,a,b,aeq,deq,zeros(3,1))

value = c'*x

结果:

(2)具体的函数linprog:

使用help linprog

linprog Linear programming.

X = linprog(f,A,b) attempts to solve the linear programming problem:

min f'*x    subject to:   A*x <= b

x

X = linprog(f,A,b,Aeq,beq) solves the problem above while additionally

satisfying the equality constraints Aeq*x = beq.

X = linprog(f,A,b,Aeq,beq,LB,UB) defines a set of lower and upper

bounds on the design variables, X, so that the solution is in

the range LB <= X <= UB. Use empty matrices for LB and UB

if no bounds exist. Set LB(i) = -Inf if X(i) is unbounded below;

set UB(i) = Inf if X(i) is unbounded above.

X = linprog(f,A,b,Aeq,beq,LB,UB,X0) sets the starting point to X0. This

option is only available with the active-set algorithm. The default

interior point algorithm will ignore any non-empty starting point.

X = linprog(PROBLEM) finds the minimum for PROBLEM. PROBLEM is a

structure with the vector 'f' in PROBLEM.f, the linear inequality

constraints in PROBLEM.Aineq and PROBLEM.bineq, the linear equality

constraints in PROBLEM.Aeq and PROBLEM.beq, the lower bounds in

PROBLEM.lb, the upper bounds in  PROBLEM.ub, the start point

in PROBLEM.x0, the options structure in PROBLEM.options, and solver

name 'linprog' in PROBLEM.solver. Use this syntax to solve at the

command line a problem exported from OPTIMTOOL. The structure PROBLEM

must have all the fields.

[X,FVAL] = linprog(f,A,b) returns the value of the objective function

at X: FVAL = f'*X.

[X,FVAL,EXITFLAG] = linprog(f,A,b) returns an EXITFLAG that describes

the exit condition of linprog. Possible values of EXITFLAG and the

corresponding exit conditions are

1  linprog converged to a solution X.

0  Maximum number of iterations reached.

-2  No feasible point found.

-3  Problem is unbounded.

-4  NaN value encountered during execution of algorithm.

-5  Both primal and dual problems are infeasible.

-7  Magnitude of search direction became too small; no further

progress can be made. The problem is ill-posed or badly

conditioned.

[X,FVAL,EXITFLAG,OUTPUT] = linprog(f,A,b) returns a structure OUTPUT

with the number of iterations taken in OUTPUT.iterations, maximum of

constraint violations in OUTPUT.constrviolation, the type of

algorithm used in OUTPUT.algorithm, the number of conjugate gradient

iterations in OUTPUT.cgiterations (= 0, included for backward

compatibility), and the exit message in OUTPUT.message.

[X,FVAL,EXITFLAG,OUTPUT,LAMBDA] = linprog(f,A,b) returns the set of

Lagrangian multipliers LAMBDA, at the solution: LAMBDA.ineqlin for the

linear inequalities A, LAMBDA.eqlin for the linear equalities Aeq,

LAMBDA.lower for LB, and LAMBDA.upper for UB.

NOTE: the interior-point (the default) algorithm of linprog uses a

primal-dual method. Both the primal problem and the dual problem

must be feasible for convergence. Infeasibility messages of

either the primal or dual, or both, are given as appropriate. The

primal problem in standard form is

min f'*x such that A*x = b, x >= 0.

The dual problem is

max b'*y such that A'*y + s = f, s >= 0.

转:https://blog.csdn.net/luolang_103/article/details/80202370

标签:Aeq,linprog,函数,point,matlab,OUTPUT,PROBLEM,problem

来源: https://blog.csdn.net/eric_e/article/details/89286851

matlab optimeset函数,matlab 中的 linprog函数相关推荐

  1. MATLAB解决线性规划问题,学会使用linprog函数,在一个实例中演示linprog函数各参数的用法

    最近接触到了一个线性规划的题目,尝试用MATLAB解决,动手前想了很多思路,上网搜索了一下发现MATLAB中有专门的linprog函数专门解决线性规划问题,了解学习后果然十分方便.事实上,绝大部分的线 ...

  2. scala 函数中嵌套函数_Scala中的嵌套函数 用法和示例

    scala 函数中嵌套函数 Scala中的嵌套函数 (Nested functions in Scala) A nested function is defined as a function whi ...

  3. oracle中转换函数,Oracle中的转换函数

    Oracle中的转换函数有三个,分别为to_char(),to_date(),to_number() 1.to_char()的用法 格式化当前的日期时间 select sysdate,to_char( ...

  4. 3. matlab 中的 linprog函数

    (1)   linprog函数是用来求解线性规划问题的. 什么是线性规划问题? 就是在一系列的线性条件的约束下,从而规定了可行解,在通过具体的目标函数,求得满足函数 的最优的解 例如平常的线性规划函数 ...

  5. matlab中fval函数,收集整理Matlab中的linprog函数使用说明 | 学步园

    linprog函数是用来求解线性规划问题,其中,f,x,b,beq,lb,ub为向量,A,Aeq为矩阵. a).x=linprog(f,A,b) 功能:求解最小化问题:min f*x,条件:A*x≤ ...

  6. 收集整理Matlab中的linprog函数使用说明

    linprog函数是用来求解线性规划问题,其中,f,x,b,beq,lb,ub为向量,A,Aeq为矩阵. a).x=linprog(f,A,b) 功能:求解最小化问题:min f*x,条件:A*x ≤ ...

  7. python方差函数_python 中的var()函数和cov函数用法-Go语言中文社区

    本文是学习多篇博客总结而得: numpy中var和cov函数求法和MATLAB中var和cov函数求法类似: 首先均值X,样本方差S,样本协方差C 公式分别为: 一.  MATLAB和Python中计 ...

  8. java中的string函数_java中string.trim()函数的作用实例及源码

    trim()的作用:去掉字符串首尾的空格. public static void main(String arg[]){ String a=" hello world "; Str ...

  9. python里面map函数_python中的map()函数

    先来看一下官方文档: map(function, iterable, ...) Apply function to every item of iterable and return a list o ...

最新文章

  1. java ee核心技术_【科普】JavaEE的核心技术
  2. log4j2.xml 的标签 loggers 中 root 的属性 level 指的是什么
  3. 挖掘城市ip_不断挖掘IP价值,紧抓乐园经济新机遇!
  4. iphone个人热点无法开启_无法在 iPhone 上正常使用“个人热点”怎么办?
  5. 没有文化可以学php吗,宋威龙深夜发文感慨,却被吐槽文化低,学历真的重要吗?...
  6. 原根算法C语言,数据结构与算法分析 C语言描述(第2版)Larry Nyhoff AVL树
  7. 不同调制方式性能优劣指标
  8. Infopath入门到精通系列-2 Infopath 文件内容查看
  9. java复习题_JAVA复习题及答案.doc
  10. 如何在Linux上安装Oracle客户端连接工具sqlplus
  11. Cell插件在J2EE系统中的应用
  12. keil 5(C51)下载安装
  13. Linux中安装VIM命令
  14. 翁凯C语言程序设计期末考试
  15. win10桌面背景为什么突然变黑了 win10桌面背景不显示解决方法
  16. 如何知道计算机显卡内存,如何查看显卡显存_如何查看显卡显存占用
  17. Yolo-V4数据增强
  18. 项目实战:如何构建知识图谱
  19. ARM 汇编指令 DCD
  20. c语言while输入n求n个奇数,任意输入n个整数,输出这n个数中的奇数个数和偶数个数.用while语句...

热门文章

  1. 家校互动、班级管理系统
  2. Linux中ls及其使用方法
  3. C++ 中的DWORD
  4. seo标题优化的方法,具体怎么做?
  5. 五年后你在何方 怎样设定目标总结篇
  6. centos7配置命令别名
  7. 深度学习之强调一下数据的重要性
  8. 软件开发实训(720科技)-----运营推广/新媒体运营
  9. EWMA 指数加权移动平均
  10. c语言指针变量输出不了共用体,瘋子C语言札记(结构体/共用体/枚举篇)