Matlab Newbie: How to do a simple LP with CPLEX through MATLAB
3 ビュー (過去 30 日間)
古いコメントを表示
Hey guys,
I've never called CPLEX with Matlab and I was wondering how to call cplex to solve an LP?
I have the following inputs:
strings = cell(10,1) that consists of vectors of different lengths
value = cell(10,1) this holds the values of the strings
start = matrix (10,3) this is a 1 or 0 matrix if start(i) is included in string, 0 if not
end = matrix (10,3) this is a 1 or 0 matrix if end(i) is included in string, 0 if not
single = matrix (10,7) this is a 1 or 0 matrix if single(i) is included in string, 0 if not
dual = matrix (10,4) this is a 1 or 0 matrix if dual(i) is included in string, 0 if not
dualvalue = vector (1,4) this holds the values of the 'dual'
decision variable: x(s), which is binary (0,1) if string s is included, 0 if not.
obj fct: is to maximize the sum {value(s)*x(s)} + sum{dualvalue(i)*D(i)}
Constraints:
1. D(i) <= .5*(sum over all s){dual(is)*x(s)} for all i that belongs in dual
2. (sum over all s) single(is)*x(s)<=1 for all i that belongs in single
3. (sum over all s) dual(is)*x(s)<=2 for all i that belongs in dual
4. (sum over all start) x(s) - (sum over all end) x(s) = 0 for all k columns of start
5. (sum over all s) x(s) <= k
I'm using version 7.12.0; looking for the easiest way to do this; if there's an easier way by not calling cplex too, I'm all ears.
Thank you!
Andrew
回答 (1 件)
Titus Edelhofer
2011 年 11 月 18 日
Hi Andrew,
I don't know of a link for calling CPLEX from MATLAB (apart from using system to call CPLEX like any other program). The optimization toolbox comes with linprog to solve linear problems, allthough I must admit I did not scan through your description to look, if your problem is indeed linear ...
Titus
2 件のコメント
Titus Edelhofer
2011 年 11 月 18 日
No, you don't. It will be the result of the call. But I admit that I don't really see from your description, what your variables (to optimize) and what are fixed values (parameters of the optimization problem)...
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!