quadratic_over_affine does not accept adding small positivr number to numerator

18 views
Skip to first unread message

JackJack

unread,
Nov 21, 2025, 7:13:28 PMNov 21
to YALMIP
Dear Professor Johan 

rhs = y*c1 - ((x0 + y0)/y0)*quadratic_over_affine(y^2, x+y); % no error
rhs = y*c1 - ((x0 + y0)/y0)*quadratic_over_affine((y+0.1)^2, x+y); % cause error Error using quadratic_over_affine
quadratic_over_affine does not support linear of constant terms

Why does this error happens and what are the way to counter it 😢?

Thank you and best regard !

Johan Löfberg

unread,
Nov 22, 2025, 2:32:58 AMNov 22
to YALMIP

lazy coding in an almost never used operator I guess

much better to learn how to derive the socp model from the epigraph model (y+0.1)^2 <= t*(x+y), t>=0, x+y>=0, or just write a simple epigraph model and yalmip will derive the socp, here you could do (y+0.1)^2 <= t*z, t>=0,z>=0, z==x+y and yalmip will detect a simple socp-representable model. the variable z is introduced to make the detection possible

if you absolutely want to use it, you will have to introduce a new variable q to replace y+0.1

JackJack

unread,
Nov 23, 2025, 12:09:08 AM (14 days ago) Nov 23
to YALMIP

" if you absolutely want to use it, you will have to introduce a new variable q to replace y+0.1 " -> Well this also does not work 

Johan Löfberg

unread,
Nov 23, 2025, 3:02:13 AM (14 days ago) Nov 23
to YALMIP
I suspect you simply assigned q = y+0.1 instead of defining a new variable q and adding the constraint q == y+0.1

JackJack

unread,
Nov 24, 2025, 3:54:14 AM (12 days ago) Nov 24
to YALMIP
Thank you that is exactly what happens, after using " adding the constraint q == y+0.1  " it work well, but I have the warning 

Warning: One of the constraints evaluates to a DOUBLE variable 

Johan Löfberg

unread,
Nov 24, 2025, 4:43:09 AM (12 days ago) Nov 24
to YALMIP
You will have to show the code as that error makes no sense considering what you are saying you do
Reply all
Reply to author
Forward
0 new messages