How to Solve Linear Complementarity Problem (LCP) with MATLAB ?
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Chuguang Pan
el 9 de Jun. de 2025
Comentada: Chuguang Pan
el 10 de Jun. de 2025
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 comentario
Respuesta aceptada
Matt J
el 9 de Jun. de 2025
Editada: Matt J
el 9 de Jun. de 2025
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 comentarios
Torsten
el 9 de Jun. de 2025
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 ?
Más respuestas (0)
Ver también
Categorías
Más información sobre Problem-Based Optimization Setup en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!