ILOG CPLEX 11.0 User's Manual > Discrete Optimization > Using Piecewise Linear Functions in Optimization: a Transport Example > Developing a Model > Adding an Objective

The objective is to minimize costs of supplying cars from factories to showrooms, It is added to the model in these lines:

    IloExpr obj(env);
    for(i = 0; i < nbSupply; i++){
      obj += IloSum(y[i]);
    }

    model.add(IloMinimize(env, obj));
    obj.end();