Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Define a struct (C++) having IloEnv, IloModel, ...

    Posted Thu August 05, 2010 12:16 PM

    Originally posted by: SystemAdmin


    I try to define a structure like this :

    struct CPLEX
    {
    IloEnv env;
    IloModel model(env);
    IloCplex cplex(env);
    IloIntArray2Dimensions y(env);
    IloNumArray3Dimensions x(end);

    };

    It shows some errors when I compile:

    error C2061: syntax error : identifier 'env'

    How I can overcome it; there is methods which add "env" to model, cplex, y, x ... lately.

    Thanks for your suggestion.

    Lessi.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Define a struct (C++) having IloEnv, IloModel, ...

    Posted Thu August 05, 2010 12:26 PM

    Originally posted by: SystemAdmin


    You have to use a constructor. Try this
    struct CPLEX
    {
       IloEnv env;
       IloModel model;
       IloCplex cplex;
       IloIntArray2Dimensions y;
       IloNumArray3Dimensions x;
     
       CPLEX() : env(), model(env), cplex(env), y(env), x(env) {}
    };
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Define a struct (C++) having IloEnv, IloModel, ...

    Posted Thu August 05, 2010 12:55 PM

    Originally posted by: SystemAdmin


    It shows errors like this:

    error C2436: 'x' : member function or nested class in constructor initializer list

    Thanks,

    Lessi.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Define a struct (C++) having IloEnv, IloModel, ...

    Posted Tue July 05, 2011 04:19 AM

    Originally posted by: Keshavarz


    I defined a same structure and created some objects from that but whenever I change the model of any object, it causes changes in the model of other objects also. In the other words there is only one model for all objects. I need separate model for my objects. Where is my fault?
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Define a struct (C++) having IloEnv, IloModel, ...

    Posted Tue July 05, 2011 04:27 AM

    Originally posted by: SystemAdmin


    Can you please post your structure definition here?
    Otherwise we cannot tell whether the problem is in the definition of the structure or in its usage.
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Define a struct (C++) having IloEnv, IloModel, ...

    Posted Tue July 05, 2011 05:43 AM

    Originally posted by: Keshavarz


    Excuse me. I found my fault.
    Thanks,
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Define a struct (C++) having IloEnv, IloModel, ...

    Posted Thu August 05, 2010 12:56 PM

    Originally posted by: SystemAdmin


    error C2436: 'y' : member function or nested class in constructor initializer list
    error C2436: 'cplex' : member function or nested class in constructor initializer list
    error C2436: 'model' : member function or nested class in constructor initializer list
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Define a struct (C++) having IloEnv, IloModel, ...

    Posted Thu August 05, 2010 12:58 PM

    Originally posted by: SystemAdmin


    I am sorry, it works. I remove env but I am forget to remove the parenthesis.

    Thanks,

    Lessi.
    #CPLEXOptimizers
    #DecisionOptimization