0

I am repeating a question (non-negative integer solutions to system of linear equations in mathematica) here for MATLAB.

Say I have a system of linear equations and inequalities (or boundary). I want ALL possible non-negative integer solutions of the system. In Mathematica, the function is reduce. But I am not sure whether MATLAB has a similar function.

Example:

Problem:

 x1 + x3 + x4 = 3
 x2 + x3 = 3
 x1, x2, x3, x4 >= 0 

Solution:

 x1   x2     x3    x4
 3     3     0     0
 2     2     1     0
 1     1     2     0
 0     0     3     0
 2     3     0     1
 1     2     1     1
 0     1     2     1
 1     3     0     2
 0     2     1     2
 0     3     0     3
  • It looks like [`intlinprog`](https://www.mathworks.com/help/optim/ug/intlinprog.html) in the Optimization Toolbox can do this: you can ask for integer solutions and use 0 as the lower bound. – Ahmed Fasih Apr 19 '18 at 04:16
  • Isn't it only providing a single solution?. I am looking for all solutions. I will edit the question with an example. – Midhun Kathanaruparambil Apr 19 '18 at 13:36

0 Answers0