0

I have a long arithmetic expression consisted of many operands and parentheses but only two operations, addition and multiplication. Can OPL be used to minimize the critical path?

For instance, given the expression (aa+bb)+(ab+ab)$ whose critical path contains a 2-input multiplication and two 2-input additions, it output $(a+b)(a+b)$ whose critical path is reduced to a 2-input addition and a 2-input multiplication?

Another example: a(b+c+d)+e with a critical path of three 2-input additions and a multiplication changes to an expression such as: ab+aa+ac+d with a critical path of a 2-input multiplication and two 2-input additions?

Thank you.

Robert
  • 1
  • 5

1 Answers1

0

in OPL you can write

using CP;

dvar int a in 0..10;
dvar int b in 0..10;
dvar int c in 0..10;
dvar int d in 0..10;
dvar int e in 0..10;


dexpr int expr=a*(b+c+d)+e;

subject to
{
  expr==9;
}
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15