博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Minimizing quadratic energies with constant constraints
阅读量:4041 次
发布时间:2019-05-24

本文共 3777 字,大约阅读时间需要 12 分钟。

There are a many different ways to minimize a quadratic energy with constant constraints. I wrote out the exact steps for three such ways:

  1. Separate the energy into knowns and unknowns, then solve for the
    unknowns by setting gradient with respect to those unknowns to zero.
  2. Add additional term to energy that punishes not satisfying the known
    values of your constant constraints in the least squares sense, the
    solve for all variables by setting gradient with respect to all
    variables to zero.
  3. Add additional variables called lagrange multipliers to energy so
    that the problem is no longer to find a minimum but a stationary
    point in the new energy. Such a stationary point guarantees that our
    constraints are met. Find the stationary point by the usual method
    of setting the gradient to zero, this time the gradient is with
    respect to all original variables and these new variables.

The pretty print type-up with MATLAB pseudocode.

A plain text, unicode version:

Quadratic energy

E=ZTQZ+ZTL+C

We want to fix some of the values of Z, we can rearrange the Z’s that are still

free and the ones we want to fix so that Z=[XY] , where X are the free values
and Y are the fixed values;

Split energy into knowns and unknowns

Z=[XY]
or
Z(unknown) = X and Z(known) = Y

E===[XT YT]Q[XY]+[XT YT]L+C[XT 0]Q[XY]+[0 YT]Q[XY]+[XT 0]L+[0 YT]L+C[XT 0]Q[X0]+[XT 0]Q[0Y]+[0 YT]Q[X0]+[0 YT]Q[0Y]+[XT 0]L+[0 YT]L+C

E=[XT 0][Q(unknown,unknown)000][X0]+[XT 0][00Q(unknown,known)0][0Y]+[0 YT][0Q(known,unknown)00][X0]+[0 YT][000Q(known,known)][0Y]+[XT 0]L+[0 YT]L+C

E===XTQ(unknown,unknown)X+XTQ(unknown,known)Y+YTQ(known,unknown)X+YTQ(known,known)Y+XTL(unknown)+YTL(known)+CXTQ(unknown,unknown)X+XTQ(unknown,known)Y+(YTQ(known,unknown)X)T+YTQ(known,known)Y+XTL(unknown)+YTL(known)+Cthe transpose of a scaler is the scaler itselfXTQ(unknown,unknown)X+XTQ(unknown,known)Y+XTQ(known,unknown)TY+YTQ(known,known)Y+XTL(unknown)+YTL(known)+C

E=XTNQX+XTNL+NC

where
NQ=Q(unknown,unknown)
NL=Q(unknown,known)Y+Q(known,unknown)TY+L(unknown)
NC=YTQ(known,known)Y+YTL(known)+C

EX=2NQX+NL

Solve for X with:

X=(2NQ)1NL

Enforce fixed values via soft contraints with high weights

E=ZTQZ+ZTL+C

Add new energy term punishing being far from fixed variables
NE=ZTQZ+ZTL+C+w(Z(known)Y)TI(Z(known)Y)
where w is a large number, e.g. 10000
NE=ZTQZ+ZTL+C+w(ZT[0 YT])[000I(known,known)](Z[0Y])
where W is a diagonal matrix with Wii=0 if iunknown and Wii=w if iknown
NE=ZTQZ+ZTL+C+(ZT[0 YT])W(Z[0Y])
NE=ZTQZ+ZTL+C+ZTWZ2ZTW[0Y]+[0 YT]W[0Y]
NE=ZTNQZ+ZTNL+NC
NQ=Q+W
NL=L2W[0Y]
NC=C+[0 YT]W[0Y]

Differentiate with respect to Z

EZ=2NQZ+NL

Solve for Z with:

Z=0.5NQ1NL
or re-expanded
Z=0.5(Q+W)1(L2W[0Y])

Discard known parts of Z to find X

X=Z(unknown)
But be careful to look at Z(known) - Y to be sure your fixed values are being
met, if not then w is too low. If the X values look like garbage then perhaps
you’re getting numerical error because w is too high.

Lagrange multipliers

We want to minimize

E=ZTQZ+ZTL+C
subject to the constant constraints:
Z(known)=Y
Find stationary point of new energy:
NE=E+λi(ZiYi) ,i∈known
NE=E+[ZT λT]QC[Zλ][ZT λT][02Y]
(notice the 2 because λZ shows up twice in the quadratic part)
where QC=00000I(known,known)0I(known,known)0
NE=[ZT λT]NQ[Zλ]+[ZT λT]NL+C
NQ=[Q000]+QC=Q012I(known,known)012I(known,known)0
NL=[L0]+[0Y]
Differentiate with respect to all variables, including lagrange multipliers
E[Zλ]=2NQ[Zλ]+NL
Solve with
[Zλ]=0.5NQ1NL

Discard fixed values and langrange multipliers.

X = Z(known)
The value of λi is the “force” of the constraint or how hard we had to pull the
energery minimum to meet the constraints. See

转载地址:http://zpxdi.baihongyu.com/

你可能感兴趣的文章
SQL查询优化
查看>>
秒杀系统
查看>>
使用Jsoup抓取页面的数据
查看>>
时间工具类
查看>>
mybatis foreach
查看>>
微信验证域名
查看>>
Java实现微信JS-SDK【一】配置篇
查看>>
java合成图片
查看>>
httpclient 4.3.2 post get的工具类
查看>>
taskExecutor使用
查看>>
微信朋友圈分享
查看>>
eclipse安装JAVA反编译插件
查看>>
ip限制
查看>>
IE6 png 透明
查看>>
列表拖动排序
查看>>
select实例,拼音检索
查看>>
Spring MVC @Transactional注解方式事务失效的解决办法
查看>>
js正则表达式限制文本框只能输入数字,小数点,英文字母
查看>>
Spring事务失效的原因
查看>>
mybatis获取数据库表字段名+数据
查看>>