> Discrete Optimization > Transport: Piecewise Linear Optimization > Developing a Model > Adding Constraints

According to the description of the problem, the supply of cars from the factories must meet the demand of the showrooms. At the same time, it is important not to ship cars that are not in demand; in terms of this model, the demand should meet the supply as well. Those ideas are represented as constraints added to the model, like this:

    for(i = 0; i < nbSupply; i++){
      x[i] = IloNumVarArray(env, nbDemand, 0, IloInfinity, ILOFLOAT);
      y[i] = IloNumVarArray(env, nbDemand, 0, IloInfinity, ILOFLOAT);
    }
 
    for(i = 0; i < nbSupply; i++){      // supply must meet demand
      model.add(IloSum(x[i]) == supply[i]);
    }
    for(j = 0; j < nbDemand; j++){      // demand must meet supply
      IloExpr v(env);
      v.end();
    }