# Help with optimizing a function.

1 view (last 30 days)
Marianne on 8 Nov 2013
Answered: Nayan Rawat on 18 Jun 2019
I want to maximize the following function;
function y=wage3(x0,x1,x2) y(x) = -(x0*@logx0-x0)/3+(x1*@logx1-x1)/3-(x1*@logx1-x1)/6+(x2*@logx2-x2)/6+3*@logx0-(x1*@logx0)/3+(3*x0*@logx0)/6-(x2*@logx0)/6
This is a function that I want to optimize given the following constraint;
x0(1+h10+h20)+h11+h22*c2 =3*h11+6*h22
where h11=(c1-c0)/3 h10=1-(c1-c0)/3 h22=(c2-c0)/6 h20=1-(c2-c0)/6
x0,x1,x2 can only take on discrete values [1,2,3,4,5,6]. What I want to do is to fix x0 at one value (1,2,...6) and vary x1,x2 to find the combination yielding the highest y.
I have multiple problems;
1. I am told that "Undefined function 'mtimes' for input arguments of type 'function_handle'" when trying to run wage(1,2,2) (just random values). 2. I have no idea how to tell matlab to use the constraint I want. How do I save the constraint, how do I use it?
Very thankful for help!!

Nayan Rawat on 18 Jun 2019
I also need help for a similar problem. por favor.