Topic
4 replies Latest Post - ‏2012-12-12T09:01:24Z by mrmag
mrmag
mrmag
28 Posts
ACCEPTED ANSWER

Pinned topic IloCos of a variable

‏2012-12-10T10:28:38Z |
Hello.

I just wonder if it is possible to use IloCos of a variable like in the following example:

IloModel model(env);

IloIntVar a(env,0,360);

model.add(IloMaximize(env,IloCos(a * IloPi / 180.0)));

cout << model << endl;
IloCP cp(model);

if (cp.solve()) {
cout << "cp.getObjValue(): " << cp.getObjValue() << endl;
cout << cp.getValue(a) << endl;
}
Updated on 2012-12-12T09:01:24Z at 2012-12-12T09:01:24Z by mrmag
  • mrmag
    mrmag
    28 Posts
    ACCEPTED ANSWER

    Re: IloCos of a variable

    ‏2012-12-10T10:37:25Z  in response to mrmag
    Results of the run are the following:

    IloModel model0 = {
    obj4 = (cos(0.0174533 * IloIntVar(1)http://0..360 ), IloObjective, Maximize);

    }

    Concert exception caught: IloAlgorithm cannot extract extractables 3, 5, 4 and 0

    So, there is an exception.
    • mrmag
      mrmag
      28 Posts
      ACCEPTED ANSWER

      Re: IloCos of a variable

      ‏2012-12-10T12:00:19Z  in response to mrmag
      Is it possible to have cos and sin expressions in the model?
      • rdumeur
        rdumeur
        89 Posts
        ACCEPTED ANSWER

        Re: IloCos of a variable

        ‏2012-12-10T16:13:38Z  in response to mrmag
        Dear mrmag,

        No, it is not possible to use IloCos in your model. For working around this situation, you will find useful information in this thread:

        http://www.ibm.com/developerworks/forums/thread.jspa?threadID=463202&tstart=0

        Cheers,
        ____________________________________
        Unsubscribe via the "binocular" icon on the web

        Sauf indication contraire ci-dessus:/ Unless stated otherwise above:
        Compagnie IBM France
        Siège Social : 17 avenue de l'Europe, 92275 Bois-Colombes Cedex
        RCS Nanterre 552 118 465
        Forme Sociale : S.A.S.
        Capital Social : 653.242.306,20 €
        SIREN/SIRET : 552 118 465 03644 - Code NAF 6202A
        • mrmag
          mrmag
          28 Posts
          ACCEPTED ANSWER

          Re: IloCos of a variable

          ‏2012-12-12T09:01:24Z  in response to rdumeur
          Hello rdumeur. The table of values helped. Thank you.