Skip to content

Is there any difference between equality constraint and assignment #940

Discussion options

You must be logged in to vote

This is an optimization problem in 6 variables

x=sdpvar(1,6); 
A=rand(6,6);
C=[0<=A * x<=2]; 
C=[C x([ 2 ,5])==0 ]
optimize(C)

This is an optimization problem in 4 variables

x=sdpvar(1,6); 
x([ 2 ,5])=0
A=rand(6,6);
C=[0<=A * x<=2]; 
optimize(C)

and is a convenient way of writing

x=[sdpvar(1) 0 sdpvar(1) sdpvar(1) 0 sdpvar(1)]
A=rand(6,6);
C=[0<=A * x<=2]; 
optimize(C)

Some solver might be more efficient with equalities in high dimensions, some inefficient and prefer a condensed form, and most likely it makes no difference as the solver will presolve the model anyway to put it in its preferred form

Solvers only solve problems up to specified numerical tolerance, and might thus conside…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Geriro36
Comment options

Answer selected by johanlofberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants