# The integer linear programming solver does not give me the expected results

2 views (last 30 days)

Show older comments

% A is a matrix N*N of ones and zeros

% B is a matrix N*1 of ones and zeros

N=14 ;

x = optimvar('x',N,1,"Type",'integer','LowerBound',0,'UpperBound',1);

opp = sum(x);

res1=x(7,1)==0;

res2=x(8,1)==0;

p = optimproblem("ObjectiveSense","minimize");

p.Objective = opp;

p.Constraints.Xk = A*x>=B;

p.Constraints.Xx = res1;

p.Constraints.Xc = res2;

Sol = solve(p,"Solver","intlinprog");

%i want to know if my syntax is wrong or what is the problem with the code,

%matrices A and B are saved in my workspace

##### 10 Comments

Mark Stone
on 27 Nov 2022

### Answers (0)

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!