Linear optimization with sums in the objective function
6 views (last 30 days)
Show older comments
Hello everybody,
I am trying currently to solve a linear problem in Matlab. For the solution I am taking the cplex solver.
My problem is how to hand sums in the objective function as well as in the constraints. All examples are for straight linear problems like:
obj function: 2x+3y (min)
4x + 2 y >= 10
Therefore I would write in matlab:
f = [2; 3];
A = [4 2];
b=10;
[x,z,exitflag,output,lambda] = linprog(f,A,b,Aeq,beq,lb,ub);
Pls keep in mind, that the example isn´t complete.
How I have to change f for sums.
For example the objective function is: sum(i)(sum(j)(pi*xij))
So this means I am having a double sum where p only changes for the different i and x changes for i and j.
But how can I bring the xij into the objective function f?
p=[ 10 13 14]
f=[p(i) ] is that correct? How does Matlab know that I need for x a consideration for xi and xj?
Any help would be very appreciated
0 Comments
Answers (2)
See Also
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!