Lets say I have a set of items in a set x0, ..., x14
each consisting its own values v0, ..., v14
I am trying to at most 8 items such that I get the maximum value.
I am able to get the following maximization problem
max v0*x0 + ... + v14*x14
s.t.
x0 + ... + x14 <= 8
0 <= x0 <= 1
.
.
0 <= x14 <= 1
However, I need to add another constrains, that is for the items chosen, I should be able to pair them such that their ratio is less than 2.
i.e. lets say that the item chosen is x0, x1, x3, x4, x8, x9, x10, x11
with the maximum value they would also have a configuration of pairing such that,
(v0 * x0)/(v1 * x1) <= 2,
(v3 * x3)/(v9 * x9) <= 2,
(v4 * x4)/(v11 * x11)<= 2,
(v8 * x8)/(v10 * x10)<= 2,
Any idea on how to formulate the above set of constrains?
question from:
https://stackoverflow.com/questions/65829748/adding-constrain-to-check-if-there-exist-a-combination-of-pairs-such-that-it-sta 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…