Group Abstract Group Abstract

Message Boards Message Boards

0
|
10.2K Views
|
8 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Help/Hints on finding the most "restrictive" equation in a set of equations

Posted 10 years ago

Good morning, I need some help or hints on finding the most "restrictive" equation in a set of equations and inequalities. I have a set of 30 single equations/inequalities in my set, namely:

eqs={y + 0.135456 z >= 78.4807, z >= 51.5464, x + 0.495376 y >= 79.1498, 
 x + 371.686 y >= 34406.8, x + 3.68043 y >= 243.273, 
 x + 0.523148 y + 2.1009 z >= 84.8248, x + 0.532835 y >= 66.3424, 
 x + 0.542384 y >= 75.3277, y + 1.65913 z >= 87.2085, 
 x >= 38.7097, y >= 75.6909, z >= 57.7224, z <= 51.5544, 
 y + 0.135456 z <= 98.1008, z <= 64.4124, y <= 6.25*10^7, 
 x + 2.42904 y + 2.18814 z <= 7260.06, y <= 3.57143*10^7, 
 x + 0.495376 y <= 131.905, x + 371.686 y <= 57372.9, 
 x + 3.68043 y <= 405.455, x + 0.523148 y + 2.1009 z <= 141.417, 
 x + 0.532835 y <= 110.488, x + 0.542384 y <= 125.465, 
 x <= 6.66667*10^7, y <= 166667., y + 1.65913 z <= 109.007, 
 x <= 47.3118, y <= 92.5111, z <= 70.5496}

Finally, I need to solve the whole set. If you apply FullSimplify[And@@eqs], you get False, which is correct; the 12th equation z >= 57.7224 and the 13th equation z <= 51.5544 are conflicting.

Instead of checking all combinations, I would like to have a "smarter" (and faster) way to find conflicting equations which restricts the whole system the most.

I was thinking of adding on equation after another, but this also involves a lot of combinations.

Do you have any ideas or hints? Thank you!

8 Replies

You are correct, I somehow missed that one visually. My solution means it will suffice to remove inequalities 2, 12, 27 in order to have a solvable system. But it does not mean that that is a necessary condition for a solution, and indeed it could be the case that fewer will require removal.

POSTED BY: Daniel Lichtblau

Dear Daniel,

thanks a lot for your work; I have tested this with a few equations. However, your code will also flag equation 27 in my example above, right? If I just eliminate equations 2, 12 and leave 27, I can solve the system using Reduce and Solve.

How should I interpretate your solution? Do I need to remove 2, 12 and 27 to get a solvable system?

POSTED BY: Daniel Lichtblau
POSTED BY: Henrik Schachner

Here is the integer programming method to force a minimum on the number of inequalities violated. The code is almiost the same as before except we make the objective function use 0-1 variables. The 10^6 usage is a heuristic. In general we want something with a quotient much larger than a machine precision ULP, but smaller than the max violation (else we'll have an unsatisfiable system). Stated differently, the result will be optimal unless there is a consistent system from omitting fewer inequalities but accepting a constraint violation larger than 10^6.

e2 = eqs /. {aa_ >= bb_ :> bb - aa, aa_ <= bb_ :> aa - bb};
cvars = Array[c, Length[e2]];
ineqs1 = Thread[cvars >= e2/10^6];
ineqs2 = Thread[0 <= cvars <= 1];
obj = Total[cvars];
allvars = Join[cvars, Variables[e2]];

In[205]:= NMinimize[{obj, 
  Join[ineqs1, ineqs2, {Element[cvars, Integers]}]}, allvars]

(* Out[205]= {2., {16[1] -> 0, 16[2] -> 1, 16[3] -> 0, 16[4] -> 0, 
  16[5] -> 0, 16[6] -> 0, 16[7] -> 0, 16[8] -> 0, 16[9] -> 0, 
  16[10] -> 0, 16[11] -> 0, 16[12] -> 1, 16[13] -> 0, 16[14] -> 0, 
  16[15] -> 0, 16[16] -> 0, 16[17] -> 0, 16[18] -> 0, 16[19] -> 0, 
  16[20] -> 0, 16[21] -> 0, 16[22] -> 0, 16[23] -> 0, 16[24] -> 0, 
  16[25] -> 0, 16[26] -> 0, 16[27] -> 0, 16[28] -> 0, 16[29] -> 0, 
  16[30] -> 0, x -> 38.7097, y -> 92.4653882578, z -> -1.07476935423}} *)

I will remark that this particular solution gives a worse total violation than my previous one, but only requires removal of two inequalities (#2 and #12; this time it's not a matter of checking by eyeball). Also I will say that this approach can be slow in general, although in this example it is quite fast.

POSTED BY: Daniel Lichtblau

Not smart, but a bit interactive:

Manipulate[
 FullSimplify[And @@ (eqs[[choice]])], {{choice, Range[Length[eqs]]}, 
  Range[Length[eqs]], TogglerBar}]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard