1

Given that I have an conditional expression like: a > 9, do you know if a library exists, which can negate the condition correctly to: a <= 9. ?

The problem: I have a constraint solver, lp_solve, which I feed with constraints, i.e. conditions. Then it calculates a solution for me, i.e. a number satisfying the constraints. But sometimes I need a number that does not satisfy the constraints. That's the reason why I need a library that can negate conditional expressions.

BTW. lp_solve only supports the following relational operators: "<" "<=" "=" ">" ">=". Which unfortunately excludes the ! or NOT, which would have been a nice feature in my case.

EDIT: Another approach on solving this could be first calculating the maximum solution, i.e. the maximum number satisfying the constraints, and then the minimum, hence choose a number not included in the interval [min , max]. Is this better than logical negation?.

Best regards, Kaj.

dynamokaj
  • 471
  • 7
  • 19
  • `!(a>9)` . Ok, now more serious: What´s about `&&` and `||` ? You mentioned only `!` – deviantfan Mar 08 '14 at 12:20
  • lp_solve supports && in the sense that you can feed it with both the conditional expression on the LHS and the RHS of the binary operator &&. Since the solution provided by lp_solve always satisfy all the given constraints. However || is not directly supported. You cannot give lp_solve two constraint and tell it that it is sufficient to satisfy only one of them. But maybe this mechanism could be build on top by feeding it with constraints in another way. – dynamokaj Mar 08 '14 at 12:28

0 Answers0