From: Conrad on 10 May 2010 15:48 Hello, Is anybody familiar with the syntax for using CPLEX 12.1 in Matlab? I am trying to code this linear programming problem: max (sum( p(t)*(d(t)-c(t)))) subject to s(t) = s(t-1) + 0.75*c(t) - d(t) 0 < s(t) < 2000 0 < d(t) < 200 0 < c(t) < 200 where p(t) is a vector fed to the solver; d(t), c(t) and s(t) are what I want the system to optimize Are there any good resources out there explaining how to do this in Matlab? I have only been able to find old ILOG CPLEX manuals for C++ and Java. Thanks for any help, Conrad
From: Marcus M. Edvall on 11 May 2010 21:16 Hi Conrad, When using TOMLAB /CPLEX you can use this code: toms 100x1 s d c p = rand(100,1); con1 = {s(1) == 0.75*c(1) - d(1)}; con2 = {s(2:end) == s(1:end-1) + 0.75*c(2:end) - d(2:end)}; con3 = {0 <= [s;d;c]; s<=2000; [d;c]<= 200}; sol = ezsolve(-sum(p.*(d-c)),{con1, con2, con3}); You can get a demo from here: http://tomopt.com/scripts/register.php Best wishes, Marcus http://tomopt.com/ http://tomdyn.com/
|
Pages: 1 Prev: wavelet decomposition Next: Read data file with comma (instead of decimal point) |