Hello, experts, just wondering if MATLAB can solve a non-linear programming efficiently. The decision variable is a vector of N, call it a, a is discrete. Has a linear constraint. The objective is p'a+c'max(a-1,0) is nonlinear form.
Can anybody show an example of code? Thanks.

 채택된 답변

Johan Löfberg
Johan Löfberg 2014년 8월 15일

0 개 추천

fmincon is not applicable since you have integrality constraints.
The model can easily be converted to a mixed-integer linear problem (if c is non-negative using a standard epigraph reformulation of the max operator, otherwise using a big-M model of it), for which there are many solvers available for MATLAB
The MATLAB toolbox YALMIP makes the modelling easy. Install a MILP solver for good performance (otherwise it uses its own naive implementation)
N = 10;
c = rand(N,1);
p = randn(N,1);
a = intvar(N,1);
solvesdp([-5 <= a <= 5],p'*a+c'*max(a-1,0))
double(a)
Note though, I think you can solve this problem analytically.

댓글 수: 3

C Zeng
C Zeng 2014년 8월 15일
Thanks, Johan. Yes, I could transfer it to MILP, and solve it.
Is this toolbox free? Let me find it out.
yes, just google.
Matt J
Matt J 2014년 8월 15일
편집: Matt J 2014년 8월 15일
MATLAB's Optimization Toolbox can solve mixed integer linear programs as of R2014. See intlinprog.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기

태그

질문:

2014년 8월 15일

편집:

2014년 8월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by