How to Solve Linear Complementarity Problem (LCP) with MATLAB ?
13 次查看(过去 30 天)
显示 更早的评论
I want to use MATLAB for solving Linear Complementarity Problem (LCP) as defined in the following:

what optimization function (e.g., fmincon,lsqnonneg,etc.) should I use, or someone could give me some example.
1 个评论
采纳的回答
Matt J
2025-6-9
编辑:Matt J
2025-6-9
n=5; q=-rand(n,1); M=rand(n); M=(M+M')/2;
smallTolerance=1e-6;
z=optimvar('z',n,'Lower',0);
prob=optimproblem('Objective', z'*M*z + z'*q, "Constraints", M*z+q>=0);
[sol,fval]=solve(prob);
fval
assert(fval<=smallTolerance, "No solution found")
eig(M)', %Not PSD
zOptimal=sol.z %Solutions
omegaOptimal=M*zOptimal+q
4 个评论
Torsten
2025-6-9
Don't you have to use
n=5; q=-rand(n,1); M=rand(n); Msym=(M+M')/2;
smallTolerance=1e-6;
z=optimvar('z',n,'Lower',0);
prob=optimproblem('Objective', z'*Msym*z + z'*q, "Constraints", M*z+q>=0);
[sol,fval]=solve(prob);
fval
assert(fval<=smallTolerance, "No solution found")
eig(Msym)', %Not PSD
zOptimal=sol.z %Solutions
omegaOptimal=M*zOptimal+q
for M being a general nxn matrix ?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!