How to Solve Linear Complementarity Problem (LCP) with MATLAB ?
11 ビュー (過去 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!