Step 11: Add empty objective function and constraints

Shows lines to add objective function and constraints in a model built by columns.

Go to the comment Step 11 in Dietlesson.cs, and add the following lines to create empty columns that will hold the objective and ranged constraints of your problem.


      IObjective cost       = model.AddMinimize();
      IRange[]   constraint = new IRange[nNutrs];
    
      for (int i = 0; i < nNutrs; i++) {
         constraint[i] = model.AddRange(data.nutrMin[i], data.nutrMax[i]);
      }