IBM ILOG Solver User's Manual > More on Modeling > Reducing Symmetry: Configuring Racks > Model > Cost function

As mentioned earlier, the goal is to minimize the total cost of plugging cards, so the cost variable is constrained in the main function like this:

    // cost constraints
    IloIntVarArray prices(env, nbRack);
    for(i=0;i<nbRack;i++)
      prices[i] = racks[i]->_price;

    IloObjective objective = IloMinimize(env, IloSum(prices));
    model.add(objective);