Topic
3 replies Latest Post - ‏2014-02-12T12:26:34Z by Rajasekhar Kadambur
Calvin Sun Hainan
Calvin Sun Hainan
20 Posts
ACCEPTED ANSWER

Pinned topic Error message "Scripting runtime error: cannot convert to an integer, "2777734350"."

‏2013-09-26T10:55:25Z |

I have an error message in my OPL script "Scripting runtime error: cannot convert to an integer, "2777734350"."

This is strange as OPL script should have no problem to handle a big integer value up to 9e+15 based on my previous understanding.

The only possible cause I can think about is the data type "var" not allow values as big as 2777734350.

In my script, I have some calculation like this.

int x = 2780000000;

execute {

             var a;

             ......

              x -= a;

}

It looks like OPL script tries to convert the variable "a" from "var" to "int" to do the calculation for "x". However, that fails for some reason.

  • AlexFleischer
    AlexFleischer
    1029 Posts
    ACCEPTED ANSWER

    Re: Error message "Scripting runtime error: cannot convert to an integer, "2777734350"."

    ‏2013-09-26T12:10:09Z  in response to Calvin Sun Hainan

    Hi,

     

    the integer values you can use in scripting are limited to pow(2,31)-1

     

    So for example

     

    int x=ftoi(pow(2,31)-1);
    int x2=x+1000;
     

    execute {
    x=x-1;   // works fine
    x2=x2-1; // does not work
             
               

    }

     

    regards

    • Calvin Sun Hainan
      Calvin Sun Hainan
      20 Posts
      ACCEPTED ANSWER

      Re: Error message "Scripting runtime error: cannot convert to an integer, "2777734350"."

      ‏2013-09-27T01:08:55Z  in response to AlexFleischer

      Thanks. I will change my variable type to float. That should fix the problem.

      Updated on 2013-09-27T01:13:29Z at 2013-09-27T01:13:29Z by Calvin Sun Hainan
  • Rajasekhar Kadambur
    Rajasekhar Kadambur
    30 Posts
    ACCEPTED ANSWER

    Re: Error message "Scripting runtime error: cannot convert to an integer, "2777734350"."

    ‏2014-02-12T12:26:34Z  in response to Calvin Sun Hainan

    I am using lamda values for solving multi-objective problem of order 43!(factorial) and the results is showing this error. will you explain this how to overcome this error.

     

    Warning:  Bound infeasibility column 'id32'.
    Warning:  Bound infeasibility column 'id32'.
    Warning:  -Infinity upper bound ignored.