Benson Gou
님이 질문을 제출함. 30 Oct 2019

John D'Errico
님이 답변을 채택함.

Dear All,

I do not know if a code exists in Matlab optimization for the following integer linear programming.

Min ||A*x - b||_1

S.T. x is an integer variable, x>= 0 and x <= 1. A is a 1 x n row vector, and b is a scalar.

Thanks a lot.

Benson

Answer by John D'Errico
on 30 Oct 2019

Edited by John D'Errico
on 30 Oct 2019

Accepted Answer

No. There is no direct code to do so, at least not that I know of. Should I write it? sigh.

But if you spend some time reading, you will find this is just a binary integer linear programming problem. That is...

A 1-norm minimization of that form can be converted into a standard LP problem using slack variables. (Its been many years since I wrote code for that, but I recall doing so.) At that point, it becomes a simple call to intlinprog.

A quick search shows the way...

Benson Gou
on 1 Nov 2019

Because my goal is to solve for the integer variable x, that is why I added x in the objective function. If I do not add it, what solution of x could be? I am very sorry, I am not quite clear.

Thanks a lot.

Benson

John D'Errico
on 4 Nov 2019

Adding x to the objective function means you will get the wrong answer. We told you how to solve it. The objective function includes ONLY the slack variables. You cannot just make the objective function anything you want and have it be correct.

Or, far betteryet, just use Matt's code, as writing code to do somethign for which well written code already exists is just a bad idea. Unless of course, you already completely understand the problem, and how to solve it, AND you have considerable expertise in coding. You have none of that, so it is far better to use Matt's code.

Benson Gou
on 18 Nov 2019 at 20:20

로그인 to comment.

Opportunities for recent engineering grads.

Apply Today
## 댓글 수: 0

로그인 to comment.