simplex
Minimization of a linear objective function of several variables subject to linear and positivity constraints.
[xm, cxm]=simplex(a,b,c)
[xm, cxm]=simplex(a,b,c, ctype)
Inputs
a A real matrix.
b A real vector with the same number of elements as the number of rows in a .
c A real vector with the same number of elements as the number of columns in a .
ctype A vector of integer elements with values in the set (-1,1,0) , with the same number of elements as the number of rows in a .
Outputs
xm A vector that minimzes the objective function c'*x with respect to x subject to the constraints defined below.
cxm The estimated minimum, i.e. c'*xm .


Description
The minimization is subject to the constrints that none of the elements of xm are less than zero, and that the elements of the vector p=a*xm-b satisy p[i]>=0 , p[i]=0 , or p[i]<=0 depending on whether ctype[i]=1 , ctype[i]=0 , or ctype[i]=-1 . If ctype is not specified, it is assumed to be a vector of ones, i.e. the constraint a*xm>=b is satisfied.


Example
>>/*
>	Solve
>		Maximize x1+x2+3x-.5x4
>
>	subject to
>		x1+2x2      <=740
>		x2-7x4      <=0
>		x2-x3+2x4   >=.5
>		x1+x2+x3+x4 =9
>		x1,x2,x3,x4>=0
>*/
>>c=-[1 1 3,-.5]'
>>a=[1 0 2 0 ; 0,2,0,-7;0,1,-1,2;1 1 1 1 ]
>>b=[ 740,0,.5,9]'
>>ctypes=[-1,-1,1,0]'
>>(x,fx)=simplex(a,b,c,ctypes)
>>fx
     -17.0250
>>x
         0
    3.3250
    4.7250
    0.9500

>>a*x-b
 -730.5500
         0
         0
         0