Search code examples
optimizationmathematical-optimizationcplex

How to define min or max to determine the minimum value between tow numbers or in array?


I have recently defined a code for a problem in CPLEX and I have encountered a syntax error when I wanted to get the minimum value in an array. please see the code provided below as an example.

float Y = min (2.3, 3, 4, 2, 13, 45)

I got this error: syntax error, unexpected ',', expecting in


Solution

  • You can use minl

    float Y = minl (2.3, 3, 4, 2, 13, 45);
    
    execute
    {
      writeln(Y);
    }
    

    gives

    2