lp.m

来自「数字通信第四版原书的例程」· M 代码 · 共 35 行

M
35
字号
function [x,lambda,how]=lp(f,A,B,vlb,vub,x,neqcstr,verbosity)
%LP   	Linear programming.                   
%	X=LP(f,A,b) solves the linear programming problem:
%        
%            min f'x    subject to:   Ax <= b 
%             x
%   
%	[x,LAMBDA]=LP(f,A,b) returns the set of Lagrangian multipliers,
%	LAMBDA, at the solution. 
%	
%	X=LP(f,A,b,VLB,VUB) defines a set of lower and upper
%	bounds on the design variables, X, so that the solution is always in
%	the range VLB < X < VUB.
%
%	X=LP(f,A,b,VLB,VUB,X0) sets the initial starting point to X0.
%
%	X=LP(f,A,b,VLB,VUB,X0,N) indicates that the first N constraints defined
%	by A and b are equality constraints.
%
%	LP produces warning messages when the solution is either unbounded
%	or infeasible. Warning messages can be turned off with the calling
%	syntax: X=LP(f,A,b,VLB,VUB,X0,N,-1).

%	Copyright (c) 1990 by the MathWorks, Inc.
%	Andy Grace 7-9-90.
         
if nargin<8, verbosity = 0; 
	if nargin<7, neqcstr=0; 
		if nargin<6, x=[]; 
			if nargin<5, vub=[];
				if nargin<4, vlb=[];
end, end, end, end, end
[x,lambda,how]=qp([],f(:),A,B(:),vlb, vub, x(:),neqcstr,verbosity);                                
          

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?