# Quadratic Constraint Modification

Answered-
Hi Enrico,

I'll answer each of your questions individually and hopefully catch all of them.

I'm assuming it is not possible to modify the quadratic part of a constraint because there are no functions available for this purpose. Is this correct?

Correct. You could however introduce variables for each quadratic term in constraints that you wanted to modify, eg if you wanted to adjust the coefficient of yz in:

x^2 - yz - z <= 0

the you can formulate as

a - b - z <= 0

a = x^2

b = yzthen you can adjust the coefficient of b with GRBchgcoeffs

Additionally, I wanted to ask if it is possible to use the function GRBchgcoeffs to change the linear part of a quadratic constraint.

No, not currently. But you could use the same approach as above to create a linear constraint that you can use this method with.

is it safe to assume that the indices of the quadratic constraints follow the same order as the linear ones

You can assume the index corresponds to the order they are added but ...

Is it correct to assume that changing the linear coefficients for the constraint with index 2 is equivalent to changing the linear coefficients of the quadratic constraint?

The indices for linear constraints and quadratic constraints are separate sets. In your example, the constraint added will have index 0, the second constraint added (the quadratic) will also have index 0, the last constraint added will have index 1. There will be no constraint with index 2.

- Riley

1 -
Hi Riley,

Thank you so much for your comprehensive response. It was precisely what I needed!

Best regards,

Enrico

0

Please sign in to leave a comment.

## Comments

2 comments