Topic
  • 5 replies
  • Latest Post - ‏2013-04-18T09:22:48Z by GGR
Hosssein
Hosssein
26 Posts

Pinned topic Error: IloNum is not integer

‏2013-04-15T20:13:54Z |

 

 

 

Hi,

I get this Error from CP optimizer:

Error: IloNum is not integer

 

By debugging, I found out that this error is related to an IloElement Expression in my Objective Function:

 

IloIntVarArray W(env, 5, 0, 9);

PP45= IloNumArray(env, 10);

IloNumExpr OBJECTIVE = IloNumExpr(env,0);

for(i = 0; i < 5; i++)          

{

OBJECTIVE += -IloElement(PP45,W[i]);

}

 

This error happens only when array PP45 contains some fractional values. I also test the following code to build the objective function but got the same error.

for(i = 0; i < 5; i++)          

{

OBJECTIVE += -PP45[W[i]];

}

 

IloElement constraint does not work when PP45 contain float values. Right? Is there any way to handle it?

Thank you

 

 

 

  • GGR
    GGR
    72 Posts
    ACCEPTED ANSWER

    Re: Error: IloNum is not integer

    ‏2013-04-18T09:22:48Z  
    • Hosssein
    • ‏2013-04-17T18:13:45Z

    It is IBM ILOG CPLEX Optimization Studio V12.3.

    Hi Hossein

     

    I think floating point element constraint had problem in this and sooner version

    I suggest you upgrade your system in the last V12.5 version

     

    Hope that helps

     

     

  • GGR
    GGR
    72 Posts

    Re: Error: IloNum is not integer

    ‏2013-04-16T10:09:49Z  

    Hi Hossein

     

    The first argument in the element expression is the index, that is an integer data. So, The behavior of CPO (in fact concert in this case) is correct.

     

    You have to use an IloIntArray or an IloIntVarArray as first argument of the element expression

     

    Hope that helps

  • Hosssein
    Hosssein
    26 Posts

    Re: Error: IloNum is not integer

    ‏2013-04-17T16:57:21Z  
    • GGR
    • ‏2013-04-16T10:09:49Z

    Hi Hossein

     

    The first argument in the element expression is the index, that is an integer data. So, The behavior of CPO (in fact concert in this case) is correct.

     

    You have to use an IloIntArray or an IloIntVarArray as first argument of the element expression

     

    Hope that helps

    well, what if my data matrix (here PP45) contains float values? Actually this matrix contain pricing values of a column generation method and cannot be replaced by IloIntArray.

  • GGR
    GGR
    72 Posts

    Re: Error: IloNum is not integer

    ‏2013-04-17T17:39:31Z  

    Hi Hossein

    I think i made a mistake in the IloElement syntax. The first array is the values and the second array is the index. So the first array can contains floating point values (beside the intention is clearly having an numerical objective term). As well the operator [ ] should work. I see in the documentation:

    public IloNumExprArg IloElement(IloNumArray a, IloIntExprArg x)

    public IloNumExprArg operator[](IloIntExprArg anIntegerExpr) const

    Which version of CPO do you use?

     

    Thanks

     

  • Hosssein
    Hosssein
    26 Posts

    Re: Error: IloNum is not integer

    ‏2013-04-17T18:13:45Z  
    • GGR
    • ‏2013-04-17T17:39:31Z

    Hi Hossein

    I think i made a mistake in the IloElement syntax. The first array is the values and the second array is the index. So the first array can contains floating point values (beside the intention is clearly having an numerical objective term). As well the operator [ ] should work. I see in the documentation:

    public IloNumExprArg IloElement(IloNumArray a, IloIntExprArg x)

    public IloNumExprArg operator[](IloIntExprArg anIntegerExpr) const

    Which version of CPO do you use?

     

    Thanks

     

    It is IBM ILOG CPLEX Optimization Studio V12.3.

  • GGR
    GGR
    72 Posts

    Re: Error: IloNum is not integer

    ‏2013-04-18T09:22:48Z  
    • Hosssein
    • ‏2013-04-17T18:13:45Z

    It is IBM ILOG CPLEX Optimization Studio V12.3.

    Hi Hossein

     

    I think floating point element constraint had problem in this and sooner version

    I suggest you upgrade your system in the last V12.5 version

     

    Hope that helps