# fmincon for optimal solution

6 views (last 30 days)
Stanley Cheng on 11 Jul 2014
Commented: Stanley Cheng on 14 Jul 2014
Hi everyone,
I have a question about optimization as follows:
the object is to maximize sum_F=(F(1)^2+F(2)^2+F(3)^2)
However, it subjects to these constraints:
1. A*lambda=B-C*F;
2. torque=D-E*lambda;
3. the absolute value of each element in torque <=max_torque;
4. G1(torque)<=120;
5. G2(torque)<=120;
6. G3(torque)<=200;
7. G5(torque)<=200;
where
A is a 4*6 matrix,
lambda is a 6*1 vector,
B is a 4*1 vector,
C is a 4*3 matrix,
F is the 3*1 vector,
both torque and D are the 6*1 vector,
E is the 6*6 matrix,
and F is the unknown variable, whose three elements are to be maximized,
A,B,C,D and E are all known variables, lambda is the intermediate variables.
G(1) ~ G(5) are five scalars which are the functions of torque. Because of the complex relations in the constraint 1 and 2, G(1)~G(5) cannot be expressed by F directly, and they are expressed by torque.
anyone knows how to solve it in matlab ? Can it be solved by fmincon?
THX very much!

Brian B on 11 Jul 2014
So F, lambda, and torque are the variables, correct? Define
x = [F; lambda; torque].
Then you can rearrange constraints (1)-(2) so they take the form M*x = b. The constraints (3) are simple bounds. The remaining constraints are apparently nonlinear. fmincon can solve this kind of problem.
You might be able to simplify the problem easily. Is the matrix E invertible? If so you can solve constraint (2) for lambda and substitute the result into (1). This eliminates the variables lambda while keeping (3) as simple bounds. If |E is singular, you can eliminate torque. In this case (3) turns into a set of linear inequalities. In all cases, fmincon is applicable.
Stanley Cheng on 14 Jul 2014
Hi Brian,
THX so much! We make it!

### Categories

Find more on Problem-Based Optimization Setup 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!