Writing Objective Functions for Linear or Quadratic Problems
The following solvers handle linear or quadratic objective functions:
linprogandintlinprog: minimizef'x=f(1)*x(1) + f(2)*x(2) +...+ f(n)*x(n).Input the vector
ffor the objective. See the examples in Linear Programming and Mixed-Integer Linear Programming.lsqlinandlsqnonneg: minimize‖
Cx - d‖.Input the matrix
Cand the vectordfor the objective. See Nonnegative Linear Least Squares, Solver-Based.quadprog: minimize1/2 * x'Hx+f'x
=1/2 * (x(1)*H(1,1)*x(1) + 2*x(1)*H(1,2)*x(2) +....
+ x(n)*H(n,n)*x(n)) + f(1)*x(1) + f(2)*x(2) +...+ f(n)*x(n)Input both the vector
fand the symmetric matrixHfor the objective. See Quadratic Programming and Cone Programming.