登录

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

注册

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

找回密码

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

更普遍的范例外文翻译资料

 2022-08-21 11:08  

翻译要求:

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

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


更普遍的范例

混合性的问题有时也是具有两重性的,也就是说问题涉及两双约束和原始的形式。约束在对偶形式S(y)ge;0中自动更改为S(y)minus;X=0,Xge;0, 并且二元化算法会应用于这个新问题。注意问题涉及对偶形式半定约束通常无法获得两重性,除非对偶形式约束很少和小于原始的形式约束。

一个问题涉及接受锥体Xge;C,其中对称不变的量C会自动转换为是标准的原始形式下的一个问题,没有额外的模糊的变量。因此,一个被限制低一点的变量问题通常会减少两重大小,因为没有自由变量或模糊量需要这个锥模型。实践证明,简单数据绑定约束的类型Xge;L其中L是一个大型的负数可以导致为了把它写成一个简单的LP锥而试图改变执行相关的变量的问题。从本质上看,将包含大量双重成本。原始问题{min cTx, Ax=b, xge;-L}将转化为 {min cTz, Az=b AL, zge;0}和双倍的 {min (b AL)Ty, ATyle;c}。如果你想避免翻译LP视锥细胞的检测(从而把涉及变量作为自由变量),在第四个双重性的论点上。

问题涉及二阶锥约束也可以被二元化。一个约束的类型

x = sdpvar(n,1);
F = [cone(x(2:end),x(1))];

是一个二阶约束的标准原始形式。如果你的锥约束违反了这种形式,模糊量将被引入,除了解释二阶锥,就像在半定的例子里。注意,你需要一个能够解决二阶锥约束本身的非解算器为了恢复原来的变量(一般地,SeDuMi和SDPT3混合半定二阶锥问题, 或Mosek纯二阶锥问题)。

注解

你的解算器能够返回原始和双变量变量的重建工作。所有SDP解算器支持这一点,除了LMILAB。

原始矩阵(X与Y在以上举例中)必须定义在一个简单的调用,以使原始结构的检测。换句话说,一种约束 [Xgt;=0]X是用代码定义x = sdpvar(10,1);X = [x(1) x(6);x(6) x(2)] 不会被归类为原始矩阵,但随着矩阵约束三个自由变量的对偶形式。

二元化

出于完整性的考虑, 一个叫原始形式的功能是可用的。这个函数接受一个优化问题的对偶形式,并返回一个YALMIP模型的原始形式。考虑以下SDP 3自由变量, 1等式约束,1 SDP维度2的约束。

C = eye(2);
A1 = randn(2,2);A1 = A1*A1;
A2 = randn(2,2);A2 = A2*A2;
A3 = randn(2,2);A3 = A3*A3;
y = sdpvar(3,1);

obj = -sum(y) % Maximize sum(y) i.e. minimize -sum(y)
F = [C-A1*y(1)-A2*y(2)-A3*y(3) gt;= 0, y(1) y(2)==1]

一个模型的原始形式((注意目标函数的否定,原始形式假设目标函数应该最大化)

[Fp,objp,free] = primalize(F,-obj);Fp

| ID| Constraint| Type|

| #1| Numeric value| Matrix inequality 2x2|
| #2| Numeric value| Equality constraint 3x1|

这个问题现在可以用原始的形式解决,并且原始变量是从双重的等式约束中改造出来的(放在最后)。注意,原始函数返回一个目标函数,应该最小化。

optimize(Fp,objp);
assign(free,dual(Fp(end)));

为什么不使原始模型具有两重性。

[Fd,objd,X,free] = dualize(Fp,objp);Fd

| ID| Constraint| Type|

| #1| Numeric value| Matrix inequality 2x2|
| #2| Numeric value| Equality constraint 1x1|

从原始形式中获得模型通常比原来的模型更复杂,因此,通常是没有理由使模型二元化。

但是有一些情况下,它可能是有意义的。考虑KYP的问题的例子:

n = 50;
A = randn(n);A = A - max(real(eig(A)))*eye(n)*1.5; % Stable dynamics
B = randn(n,1);
C = randn(1,n);

t = sdpvar(1,1);
P = sdpvar(n,n);

obj = t;
F = [kyp(A,B,P,blkdiag(C*C,-t)) lt;= 0]

最初的问题有466个变量和1个半定约束。如果我们使这个问题二元化,一个有关1276与1326变量等式约束是可获得的。这意味着有效的变量数量很低(自由度)。

[Fp,objp] = primalize(F,-obj);Fp

| ID| Constraint| Type|

| #1| Numeric value| Matrix inequality 51x51|
| #2| Numeric value| Equality constraint 1276x1|

length(getvariables(Fp))
ans =
1326

相比之下,让我们先解决原来的问题。

optimize(F,obj)
ans =
yalmiptime: 0.2410
solvertime: 32.4150
info: No problems detected (SeDuMi)
problem: 0

二元化大约需要相同的时间才能解决(这问题实例之间可以不同)。

optimize(Fp,objp)
ans =
yalmiptime: 0.3260
solvertime: 32.2530
info: No problems detected (SeDuMi)
problem: 0

那么为什么我们要执行二元化? 我们先让YALMIP删除等式约束!

optimize(Fp,objp,sdpsettings(removeequalities,1))
ans =
yalmiptime: 2.6240
solvertime: 1.1860
info: No problems detected (SeDuMi)
problem: 0

半定规划的实际处理时间的大幅减少是要付出代价的。删除等式约束和得到降低基础较少的变量需要计算矩阵的QR分解维度1326到1276。更多的,解决问题后,另一个必须解决线性方程组以恢复原来的解决方案。总储蓄的计算时间尽管很高但足够促进二元化。

3.4 Multiparametric编程

本教程需要不确定型工具箱(MPT)。

YALMIP可以用来计算明确解决方案的线性二次接口程序的不确定型工具箱(MPT)。本教程采取读

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


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

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

企业微信

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