Solving a system of equations for the maximum whole number values in MATLAB

Basically my problem is this:

$\displaystyle a_1*p_1+a_2*p_2+a_3*p_3+a_4*p_4 \le K_1$

$\displaystyle b_1*p_1+b_2*p_2+b_3*p_3+b_4*p_4 \le K_2$

$\displaystyle c_1*p_1+c_2*p_2+c_3*p_3+c_4*p_4 \le K_3$

where all the a's, b's, and c's are known constant coefficients, the k's are known constants, and the p's are variables.

I'm also given the equation

$\displaystyle d_1*p_1+d_2*p_2+d_3*p_3+d_4*p_4=total$

Where the d's are known constant coefficients, and total is an unknown constant.

My objective is to use either a "for" or "while" loop to find the values of $\displaystyle p_1, p_2, p_3, p_4$ that produce the highest value for "total"

my initial thoughts were to create a coefficient matrix and a variable matrix multiplied together to get the resultant matrix, then simply divide the resultant matrix by the coefficient matrix to get the values for the variable matrix.

Obviously, this didn't work. So I come to you MathHelpForum.

I'm not looking for a final solution (thus the entirely symbolic problem presented). Simply direction on how to proceed. Whether it be a tip on the proper loop structure to use, or how to set up the matrices properly