Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Unknown variable appears in the model

    Posted 06/23/10 05:06 PM

    Originally posted by: SystemAdmin


    I write some code to model an optimization problem:

    //create two dimensions NxN array
    IloIntArray2Dimensions y(env);
                    for(int i=0;i<nbNodes;i++)
                    {
                            y.add(IloIntVarArray(env,nbNodes));
                    }
     
    //assign name to variables
    IloIntArray2Dimensions y(env);
                    for(int i=0;i<nbNodes;i++)
                    {
                            y.add(IloIntVarArray(env,nbNodes));
                    }
     
                    for(int i=0;i<nbNodes;i++)
                            for(int j=0;j<nbNodes;j++)
                            {
                                    y[i][j]=IloIntVar(env,0,1);
                                    sprintf(name,"y_%d.%d",i,j);
                                    y[i][j].setName(name);
                            }
     
                    //define objective function
                    IloExpr exprobjective(env);
                    for(int i=0;i<nbNodes;i++)
                            for(int j=0;j<nbNodes;j++)
                                    if (capacity[i][j] > 0)
                                    {
                                            exprobjective+=fixedcost[i][j]*y[i][j];  
                                    }
    //add objective function
                    model.add(IloMinimize(env,exprobjective));
                    exprobjective.end();
    


    and I export the model to a .lp file:

    \Problem name: IloCplex

    Minimize
    obj: 3173 y_0.3 + ... + 5242 y_9.7 + id103
    Bounds
    0 <= y_0.3 <= 1
    ....
    0 <= y_9.7 <= 1
    id103 = 0
    Binaries
    y_0.3 ... y_9.7
    End


    My problem is that : I do not know where the constraint (variable) id103 = 0 comes from. I only have some integer variables; an objective function and I already assigned a name to these integer variables. If I remove the objective function, nothing appears in .lp file.

    Thanks for your suggestion.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Unknown variable appears in the model

    Posted 06/23/10 05:10 PM

    Originally posted by: SystemAdmin


    Sorry for the mistake during the copy/paste, the first 4 line of the source code is repeated.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Unknown variable appears in the model

    Posted 06/23/10 06:45 PM

    Originally posted by: SystemAdmin


    If I uncomment other constraints and comment objective expression, the unknown variable disappeared, so this problem relates to the objective function. But I have not understood why.

    Thanks for your comments,

    Lessi.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Unknown variable appears in the model

    Posted 06/23/10 07:08 PM

    Originally posted by: SystemAdmin


    id103 (CPLEX's internal name) is a continuous variable that represents the constant term of your objective function. The model constrains it to be zero. Had you specified a nonzero value for the constant in the objective function, id103 would have been constrained to that value. It is nothing to worry about.

    /Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Unknown variable appears in the model

    Posted 06/23/10 11:48 PM

    Originally posted by: SystemAdmin


    Thanks for your explanation, It is clear to me now.

    Lessi.
    #CPLEXOptimizers
    #DecisionOptimization