Is it possible to add more constraints than the default ones in LSQLIN function?

조회 수: 1 (최근 30일)
I'm solving a constrained linear least-squares problem using lsqlin. I've specified values for C,d,A,b,Aeq and beq. I used all the default constraints that are included in the solver except for the uper and lower bounds.
Axb
Aeqx=beq
I want to add one more constraint to the solver that is different from the above constraints that I already used, Is there a way to specify more constraints in addition to the ones that are by default in the solver?
Any help is appreciated!
  댓글 수: 2
Torsten
Torsten 2023년 1월 26일
편집: Torsten 2023년 1월 26일
Don't you think we need to know the constraint you want to impose in order to be able to give advice ?
John D'Errico
John D'Errico 2023년 1월 26일
There are no default constraints. And you can supply more than one constraint. That is, A and Aeq can be MATRICES, with b and beq being vectors. That means A can have as many rows as you wish, with each row being another constraint. The same applies to Aeq.

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2023년 1월 26일
편집: Matt J 2023년 1월 26일
You can still use lsqlin, but as John said, you can add additional inequality constraints as follows,
Q=-sign(d).*C;
r=zeros(size(d));
Aineq=[A;Q]
bineq=[b;r];
x = lsqlin(C,d,Aineq,bineq,Aeq,beq,lb,ub,x0,options)

추가 답변 (1개)

Torsten
Torsten 2023년 1월 26일
이동: Matt J 2023년 1월 26일
Use "fmincon" with the constraint (C*x).*d >=0 and define this constraint in function "nonlcon".

카테고리

Help CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by