登录

  • 登录
  • 忘记密码?点击找回

注册

  • 获取手机验证码 60
  • 注册

找回密码

  • 获取手机验证码60
  • 找回
毕业论文网 > 外文翻译 > 理工学类 > 电气工程及其自动化 > 正文

基于PLC的病房人身安全监控系统设计外文翻译资料

 2022-08-21 23:21:37  

翻译要求:

1.文章约17000字(包含不用翻译的语句),每人约5500字,由顾琳完成绿色部分,余志翔完成紫色部分,袁娇娇完成蓝色部分

2.文章来自网站http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Tutorials.Installation

3.拷贝过程中,少量公式以及图片丢失,待文字部分翻译结束后请至上面网站补充完整

4.YALMIP作为一种非常有效的工具,国内尚无完整的资料,请各位尽最大努力完成

5.逢10号、20号、30号发送一次翻译成果至liwdedy@qq.com

6.我翻译了1.2(附于1.2后),供参考(黑色部分)

1. Introduction

1.1 Installation

YALMIP is entirely based on m-code, and is thus easy to install. Remove any old version of YALMIP, unzip the file YALMIP.zip and add the following directories to your MATLAB path

/yalmip

/yalmip/extras

/yalmip/demos

/yalmip/solvers

/yalmip/modules

/yalmip/modules/parametric

/yalmip/modules/moment

/yalmip/modules/global

/yalmip/modules/sos

/yalmip/operators

A lazy way to do this is addpath (genpath(yalmiprootdirectory)).

If you have MPT installed, make sure that you delete the YALMIP distribution residing inside MPT and remove the old path definitions.

If you have used YALMIP before, type clear classes or restart MATLAB before using the new version.

The solvers should be installed as described in the solver manuals. Make sure to add required paths.

To test your installation, run the command yalmiptest. For further examples and tests, run code from this Wiki!

If you have problems, please read the FAQ.

YALMIP is primarily developed on a Windows machine using MATLAB 7.12 (2011a). The code should work on any platform, but is developed and thus most extensively tested on Windows. Most parts of YALMIP should in principle work with MATLAB 6.5, but has not been tested (to any larger extent) on these versions. MATLAB 5.2 or earlier versions are definitely not supported.

1.2 Basics

The following piece of code introduces essentially everything you ever need to learn. It defines variables, constraints, objectives, options, checks result and extracts solution (Note that the code specifies the solver to CPLEX. If you dont have CPLEX installed, simply remove that solver selection in the definition of options. YALMIP will pick some other solver it finds installed)

% Define variables

x = sdpvar(2,1);

% Define constraints and objective

Constraints = [sum(x) lt;= 1, x(1)==0, x(2) gt;= 0.5];

Objective = x*x norm(x);

% Set some options for YALMIP and solver

options = sdpsettings(verbose,1,solver,cplex,cplex.qpmethod,1);

% Solve the problem

sol = optimize(Constraints,Objective,options);

% Analyze error flags

if sol.problem == 0

% Extract and display value

solution = value(x)

else

display(Hmm, something went wrong!);

sol.info

yalmiperror(sol.problem)

end

Having seen that, let us start from the beginning.

1.2.1 YALMIPs symbolic variable

The most important command in YALMIP is sdpvar. This command is used to the define decision variables. To define a matrix (or scalar) P with n rows and m columns, we write

P = sdpvar(n,m)

A square matrix is symmetric by default!. To obtain a fully parameterized (i.e. not necessarily symmetric) square matrix, a third argument is needed.

P = sdpvar(3,3,full)

The third argument can be used to obtain a number of pre-defined types of variables, such as Toeplitz, Hankel, diagonal, symmetric and skew-symmetric matrices. See the help text on sdpvar for details. Alternatively, the associated MATLAB commands can be applied to a vector.

x = sdpvar(n,1);

D = diag(x) ; % Diagonal matrix

H = hankel(x); % Hankel matrix

T = toeplitz(x); % Hankel matrix

Scalars can be defined in three different ways.

x = sdpvar(1,1); y = sdpvar(1,1);

x = sdpvar(1); y = sdpvar(1);

sdpvar x y

Note that due to a bug in MATLAB, the last command-line syntax fails in some cases (inside functions), if the variable name is the same as some built-in function or variable (i, j, e, beta, gamma).

The sdpvar objects are manipulated in MATLAB as any other variable and most functions are overloaded. Hence, the following commands are valid

P = sdpvar(3,3) diag(sdpvar(3,1));

X = [P P;P eye(length(P))] 2*trace(P);

Y = X sum(sum(P*rand(length(P)))) P(end,end) hankel(X(:,1));

In some situations, coding is simplified with a multi-dimensional variable. This is supported in YALMIP with two different constructs, cell arrays and multi-dimensional sdpvar objects.

The cell array is nothing but an abstraction of the following code

for i = 1:5

X{i} = sdpvar(2,3);

end

By using vector dimensions in sdpvar, the same cell array can be setup as follows

X = sdpvar([2 2 2 2 2],[3 3 3 3 3]);

The cell array can now be used as usual in MATLAB.

The drawback with the approach above is that the variable X not can be used directly, as a standard sdpvar object. As an alternative, a completely general multi-dimensional sdpvar is available. We can create an essentially equivalent object with this call.

X = sdpvar(2,3,5);

The difference is that we can operate directly on this object, using standard MATLAB code.

Y = sum(X,3)

X((:,:,2)

Note that the two first slices are symmetric (if the two first dimensions are the same), according to standard YALMIP syntax. To create a fully paramterized higher-dimensional, use trailing flags as in the standard case.

X = sdpvar(2,2,2,2,full);

For an illustration of multi/dimensional variables, check out the Sudoku example.

1.2.2 Constraints

To define a collection of constraints, we simply define and concatenate them. The meaning of a constraint is context-dependent. If the left-hand side and right-hand side are Hermitian, th

剩余内容已隐藏,支付完成后下载完整资料


3.9 整体最佳化

整体的解决方案!然而,在这个阶段还有较多限制。这里使用的bmibnb求解器有待完善和提高。这些代码能非常容易的解决一些小的问题(它完全能在8分钟内解决180种globlib问题),并且已经成功解决了几个现实生活中的双线性矩阵不等式小问题。

该算法是基于简单的空间分支界定法,该算法用McCormick凸包络法定义双线性边界,并用普通凸包络法来估计非线性运算符。基于LP的缩界法被反复用来改善可变范围,另外也可以利用互补约束等其他一些技术来改善可变范围。详情见求解器的说明。

我根据具体的情况选择使用LP求解器,QP求解器或SDP求解器均来解决那些无界的问题,而上界是通过本地的非线性求解器来确定的,例如有FMINCON,SNOPT和IPOPT求解器还有被用来解决非线性半定问题的PENBMI求解器。

非凸二次编程

首先我们先来举一个关于凹形二次约束问题的例子(这是在处在处在松弛阶段的例子)。在分支期间解决了三个不同的优化问题:使用本地的非线性求解器(bmibnb上界求解器和bmibnb下界求解器)分别求上界和下界;使用线性编程器(bmibnb.lpsolver)来约束趋紧。

clear all

x1 = sdpvar(1,1);

x2 = sdpvar(1,1);

x3 = sdpvar(1,1);

p = -2*x1 x2-x3;

F = [x1*(4*x1-4*x2 4*x3-20) x2*(2*x2-2*x3 9) x3*(2*x3-13) 24gt;=0,

4-(x1 x2 x3)gt;=0,

6-(3*x2 x3)gt;=0,

x1gt;=0,

2-x1gt;=0,

x2gt;=0,

x3gt;=0,

3-x3gt;=0]

options = sdpsettings(verbose,1,solver,bmibnb);

optimize(F,p,options);

* Starting YALMIP bilinear branch amp; bound.

* Lower solver : glpk

* Upper solver : penbmi

Node Upper Gap(%) Lower Open

1 : Inf NaN -6.000E 000 2

2 : Inf NaN -6.000E 000 3

3 : -4.000E 000 40.00 -6.000E 000 4 Improved solution

4 : -4.000E 000 40.00 -6.000E 000 3 Infeasible

5 : -4.000E 000 37.98 -5.899E 000 4 Poor bound

6 : -4.000E 000 37.98 -5.899E 000 5

7 : -4.000E 000 25.80 -5.290E 000 6

8 : -4.000E 000 25.80 -5.290E 000 5 Infeasible

9 : -4.000E 000 7.08 -4.354E 000 4 Infeasible

10 : -4.000E 000 7.08 -4.354E 000 3 Infeasible

11 : -4.000E 000 0.06 -4.003E 000 4

11 Finishing. Cost: -4 Gap: 0.06486%

现在我们再举一个关于比较复杂的不定二次编程问题的例子。该问题很容易解决,误差低于1%。

clear all

x1 = sdpvar(1,1);

x2 = sdpvar(1,1);

x3 = sdpvar(1,1);

x4 = sdpvar(1,1);

x5 = sdpvar(1,1);

x6 = sdpvar(1,1);

p = -25*(x1-2)^2-(x2-2)^2-(x3-1)^2-(x4-4)^2-(x5-1)^2-(x6-4)^2;

F = [(x3-3)^2 x4gt;=4,(x5-3)^2 x6gt;=4,x1-3*x2lt;=2, -x1 x2lt;=2,

x1-3*x2lt;=2, x1 x2gt;=2,6gt;=x1 x2gt;=2,1lt;=x3lt;=5, 0lt;=x4lt;=6, 1lt;=x5lt;=5, 0lt;=x6lt;=10, x1gt;=0,x2gt;=0];

options = sdpsettings(verbose,1,solver,bmibnb);

optimize(F,p,options);

* Starting YALMIP bilinear branch amp; bound.

* Lower solver : glpk

* Upper solver : penbmi

Node Upper Gap(%) Lower Open

1 : Inf NaN -3.130E 002 2

2 : -3.100E 002 0.96 -3.130E 002 3 Improved solution

2 Finishing. Cost: -310 Gap: 0.96463%

二次等式约束经常会导致非凸性,但这个问题也可以通过全局求解器来解决。例如,二次等式约束可用于布尔编程(布尔编程是用来解决简单MIQP的,但这是非常低效的,并且我们举这个例子仅仅是为了说明非凸等式约束)。

n = 10;

x = sdpvar(n,1);

Q = randn(n,n);Q = Q*Q/norm(Q)^2;

c = randn(n,1);

objective = x*Q*x c*x;

F = [x.*(x-1)==0, 0lt;=xlt;=1];

options = sdpsettings(verbose,1,solver,bmibnb);

optimize(F,objective,options);

* Starting YALMIP bilinear branch amp; bound.

* Lower solver : glpk

* Upper solver : penbmi

Node Upper Gap(%) Lower Open

1 : -2.967E 000 0.00 -2.967E 000 2 Improved solution

1 Finishing. Cost: -2.9671 Gap: 2.5207e-009%

非凸多项式编程

在YALMIP中的全局求解器主要用于双线性编程,但预处理器是能够把高阶问题转化为双线性编程。例如,变量x3y2可以用变量w和约束条件w == uv,u ==zx,z== x2,v== y2来代替。如果全局解算器具有高次多项式特性,这个转化过程将被自动完成。但是要注意,此转换过程是相当低效的,只有非常小的问题才可以用这种简单的方法来解决。

sdpvar x y

F = [x^3 y^5 lt;= 5, y gt;= 0];

F = [F, -100 lt;= [x y] lt;= 100]; % Always bounded domain

options = sdpsettings(verbose,1,solver,bmibnb);

optimize(F,-x,options)

* Starting YALMIP bilinear branch amp; bound.

* Lower solver : glpk

* Upper solver : penbmi

Node Upper Gap(%) Lower Open

1 : Inf NaN -2.990E 001 2

2 : Inf NaN -2.990E 001 1 Infeasible

3 : Inf NaN -2.763E 001 2

4 : Inf NaN -2.763E 001 3

5 : Inf NaN -1.452E 001 4

6 : Inf NaN -1.452E 001 5

7 : -1.710E 000 171.54 -6.359E 000 4 Improved solution

8 : -1.710E 000 171.54 -6.359E 000 3 Infeasible

9 : -1.710E 000 127.11 -5.155E 000 4 Poor bound

10 : -1.710E 000 127.11 -5.155E 000 3 Infeasible

11 : -1.710E 000 0.00 -1.710E 000 2 Infeasible

11 Finishing. Cost: -1.71 Gap: 1.247e-005%

非凸半定编程

下面我们介绍的是一个经典的BMI问题。

yalmip(clear)

x = sdpvar(1,1);

y = sdpvar(1,1);

t = sdpvar(1,1);

A0 = [-10 -0.5 -2;-0.5 4.5 0;-2 0 0];

A1 = [9 0.5 0;0.5 0 -3 ; 0 -3 -1];

A2 = [-1.8 -0.1 -0.4;-0.1 1.2 -1;-0.4 -1 0];

K12 = [0 0 2;0 -5.5 3;2 3 0];

F = [xgt;=-0.5, xlt;=2, ygt;=-3, ylt;=7];

F = [F, A0 x*A1 y*A2 x*y*K12-t*eye(3)lt;=0];

options = sdpsettings(bmibnb.lowersolver,pensdp,bmibnb.uppersolver,penbmi);

options = sdpsettings(options,solver,bmibnb,bmibnb.lpsolver,glpk);

options = sdpsettings(options,verbose,2,solver,bmibnb);

optimize(F,t,options);

* Starting YALMIP bilinear branch amp; bound

剩余内容已隐藏,支付完成后下载完整资料


资料编号:[498775],资料为PDF文档或Word文档,PDF文档可免费转换为Word

您需要先支付 30元 才能查看全部内容!立即支付

企业微信

Copyright © 2010-2022 毕业论文网 站点地图