problem.setObjective
| problem.setObjective | 
  Purpose
 
 
 Sets the objective function of the problem.
 
 
  Synopsis
 
 problem.setObjective (expr)
 
  Argument
 
 | 
     expr 
     | 
     A linear or quadratic function of the variables that were added to the problem prior to this call. An error will be returned if any variable in the linear or quadratic part of the objective was not added to the problem via
     addVariable.
     | 
  Example
 
 
 The following example sets the objective function of the problem to
 [2x12 + 3x1x2 + 5x22 + 4x1 + 4]:
 
 x1 = xpress.var () x2 = xpress.var () p = xpress.problem () p.addVariables (x1, x2) p.setObjective (2*x1**2 + 3*x1*x2 + 5*x2**2 + 4*x1 + 4)
  Further information
 
 
  Multiple calls to
 setObjective are allowed, and each replaces the old objective function with a new one.
 
 
  Related topics
 
  
