Second constraint as the absolute value of a previous constraint

I am struggling a lot with the following constraint and can only think of quadratic expressions.

Let: Ax == 2b+1. b is a boolean vector, x is a vector of signs (either 1 or -1).

Now I want to express a new constraint: |Ay| == 2b+1 so if 2b+1==3 then I can have either 3 or -3 and 1 or -1 respectively for the case of 2b+1==1. (y again is a vector of signs).

The difficulty arises because the value also changes on the right hand side. i.e |A*y| == 3 wouldn’t pose any problem. Could I maybe use find to break it into 2 cases like the aforementioned?

This can be easily done with a sign variable but then the constraint will lose its linearity.

Any tip/solution to this?

You haven’t told us the how this constraint comes into play in your optimization problem, how else the variables appear, etc. So I don;t know whether you need to add additional binary varaibles to handle your constraints as conditional constraints.

Read https://optimization.mccormick.northwestern.edu/index.php/Optimization_with_absolute_values and https://ocw.mit.edu/courses/sloan-school-of-management/15-053-optimization-methods-in-management-science-spring-2013/tutorials/MIT15_053S13_tut04.pdf and see whether that helps.

As for handling conditional (logic) constraints, I recommend https://ocw.mit.edu/courses/sloan-school-of-management/15-053-optimization-methods-in-management-science-spring-2013/lecture-notes/MIT15_053S13_lec11.pdf .

it is true I was not precise enough, I didn’t realize it earlier. The links seems helpful.

If my current approach is correct, once I have it working, I will post it with more details for future reference