Decision Optimization

 View Only
  • 1.  Difference IloNumVar, IloIntVar

    Posted Mon March 21, 2016 04:14 PM

    Originally posted by: JorisK


    When programming in C++, is there any difference between these two (i.e. does Cplex treat them differently):

    IloNumVar x(env, 0, 17, IloNumVar::Int);
    IloIntVar y(env, 0, 17);

    similarly, are these treated differently:

    IloIntVar u(env, 0,1);

    IloBoolVar w(env, varName);

    The reason I'm asking is that I have a cut separation routine that takes a Map<Edge, IloNumVar> which maps an Edge in a graph to a variable. I've two different models: in the first model, the variables corresponding with the edges are continues (IloNumVars), whereas in the second model the variables are boolean (IloBoolVar). For both models, I could use the same separation routine if I would declare the variables as IloNumVars.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Difference IloNumVar, IloIntVar

    Posted Tue March 22, 2016 02:10 AM

    CPLEX treats 'IloNumVar(..., IloNumVar::Int)' and 'IloIntVar(...)' the same.

    'IloNumIntVar(...)' and 'IloBoolVar(...)' are treated differently, but that really is a tiny implementation detail.

    Note that in your case you should be fine anyway: IloIntVar and IloBoolVar are subclasses of IloNumVar, so you can put them into the same map anyway. Also note that IloNumVar, IloIntVar, IloBoolVar are only handle classes, so the values in your map don't have to be pointers or references to make use of inheritance.


    #CPLEXOptimizers
    #DecisionOptimization