Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to code "arg max f(x) subject to x>0, sum(x)<=MAX"?

61 views
Skip to first unread message

Tezpur Univ

unread,
Feb 5, 2014, 11:01:23 AM2/5/14
to
Hi,
I am trying to code for the following
"arg max f(x) subject to x>0, sum(x)<=MAX"
Where, f(x) is a concave fn in x and say MAX=100. Please show me the direction/link, how do I proceed to implement it in MATLAB?

Thanks
Sanjib

Alan_Weiss

unread,
Feb 5, 2014, 12:10:10 PM2/5/14
to
It depends whether x is scalar or vector. Because you have sum(x), I
suppose x is a vector.

This is a problem that fmincon in Optimization Toolbox can address. Be
careful, fmincon solves min f(x) problems, so put in -f(x) as your
objective function.
http://www.mathworks.com/help/optim/ug/example-nonlinear-constrained-minimization.html
http://www.mathworks.com/help/optim/ug/writing-objective-functions.html#brhkghv-5
http://www.mathworks.com/help/optim/ug/writing-constraints.html#brhkghv-14

Alan Weiss
MATLAB mathematical toolbox documentation
0 new messages