(MatLab) Problem is unbounded when doing the linear programming in matlab [closed]

x + y ≤ 44,
2x + y ≤ 64,
9,000x + 5,000y ≤ 300,000

objective function: 30,000x + 20,000y

I would like to find the Optimal solution in Matlab

But there are error message Problem is unbounded.

Here is my code

A = [1 1;2 1;9 5];

b = [44 64 300];

f = [3 2];

x = linprog(f,A,b)

suppose ans: x=20,y=24

Reference https://www.mathworks.com/help/optim/ug/linprog.html


linprog solve minimization problems.

Citing the linked reference

Reference https://www.mathworks.com/help/optim/ug/linprog.html

Linear programming solver.

Finds the minimum of a problem specified by:

\begin{equation} \min_x f^Tx \quad \text{such that} \begin{cases} A \cdot x \le b, \\ Aeq \cdot x = beq, \\ lb \le x \le ub \end{cases} \end{equation} where $f$, $x$, $b$, $beq$, $lb$, and $ub$ are vectors, and $A$ and $Aeq$ are matrices.

Since you do not specify the boundaries for the variables $x$ and $y$ (for example you add $x \ge 0$, $y \ge 0$) and the constraint gives only an upper bound the minimization problem is unbounded.

In order to maximize the objective function using linprog you have to change the problem into an equivalent minimization problem.

The simplest solution is to multiply the objective function by -1.