Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
  • 1.  cos function with IloNumVar

    Posted Mon January 10, 2011 09:37 AM

    Originally posted by: anahana


    Hi all,

    I created a variable using IloNumVar and want to use it in a cos function. Something like this:

    IloNumVar IloNumVar y1(env, -5.12, 5.12, "y1");
    IloObjective obj = IloMinimize(env, (IloPower(y1,2) - 10*cos(2*IloPi*y1*IloPi/180) + 10));

    However, when compiling the program I get this error message:

    error C2665: 'cos' : none of the 3 overloads could convert all the argument types

    I know the cos function expects a float or a long double as arguments, but can't I use IloNumVar with the cos function?

    Regards,
    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: cos function with IloNumVar

    Posted Mon January 10, 2011 10:05 AM

    Originally posted by: ChrisBr


    Dear anahana,

    Please try to use "IloCos" instead of "cos" if you need to pass a IloNumVar as argument.
    
    
    
    public IloNumExprArg IloCos(
    
    const IloNumExprArg arg)
    


    I hope this helps,

    Chris.
    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: cos function with IloNumVar

    Posted Mon January 10, 2011 04:34 PM

    Originally posted by: anahana


    Dear Chris,

    Thanks for the tip!! It's working just fine. I didn't realize there were trigonometric functions in concert technology. By the way, the IloCos (or any of the other trigonometric functions) does not show up on the Index help documentation, only on the Search tab.

    Regards,
    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: cos function with IloNumVar

    Posted Tue January 11, 2011 08:43 AM

    Originally posted by: rdumeur


    Dear anahana,

    It is indeed a documentation bug that we are, thanks to you, now aware of.

    Cheers,

    Renaud
    #CPOptimizer
    #DecisionOptimization