Info

此问题已关闭。 请重新打开它进行编辑或回答。

Help with optimizing a function.

1 次查看(过去 30 天)
Marianne
Marianne 2013-11-8
关闭: MATLAB Answer Bot 2021-8-20
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!!

回答(2 个)

Nayan Rawat
Nayan Rawat 2019-6-18
I also need help for a similar problem. por favor.

Nayan Rawat
Nayan Rawat 2019-6-18
see Solving a Mixed Integer Engineering Design Problem Using the Genetic Algorithm in documentation. it might help.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by