Using values (not solver variables x(1)...) as constraints within a minimization problem?

2 views (last 30 days)
Hi folks,
I've got a minimization problem in matlab where not only the variables that the solver can change should be used as constraints (e.g. Microsoft Excel Solver: There you can set variables that should be changed (like Matlab), their boundaries (like Matlab) and you can set additional values as constraints like some value (not one of the variables that can be changed by the solver) shouldn't be greater than e.g. 5 [ max(value_vector)<=5 ]).
To explain it more precisely:
Do you know the Toyota Prius? It has a specially designed gearbox consisting out of planatary gear sets. One planatary gearset carry the internal combustion engine (ICE) and the 2 motors/generators (MG1 and MG2).
On this website you can see where they are located on that gear set. Now I've got as input values the current power output of the ICE and the traction force on the wheels at some timesteps (this data is stored in a lookup table which is trigger by the simulink clock). With thoose inputs I can calculate the torques of both electric motors at every timestep (in the simulink modell). Now I'd like to minimize the size of both elektric motors (power-wise) by varrying the gear ratio x(1) of the planatary gearset (actually there is another one betweeen the ring gear, yellow on the wibsite, and MG2 which gives me a second variable x(2) ). As additional constraints I would like: none of both eletric motors should have a greater torque than a specific value during the simulation in simulink. My simulink modell includes coefficients also, that means there isn't a arithmetic solution.
Mathematically it's something like this: I would like to minimize
f = x(1) * x(2) + 5
I've got a simulink modell with a Lookup table. This table provides the input value "in_val" for the modell over time. This input value is multiplied with the two variables of the solver x(1) and x(2). The result of this multiplication is saved to the workspace as vector "out_vec" (e.g.
x(1) = 0.5
x(2) = 3
in_val = [2,4,1]
out_val = x(1) * x(2) * in_val
=> out_vec = [3,6,1.5]
). The values in "out_vec" should be less than 5
max(out_vec) <= 5
Otherwise this iteration step does not meet my needs. Is there any way to achieve this with matlab?
Currently I am using the fmincon (optimization toolbox).
I really need help on this one!
Thanks in advance for your help!
Chris

Answers (2)

Matt J
Matt J on 11 Aug 2014
Edited: Matt J on 11 Aug 2014
Your problem is over-parametrized. Both your objective function and the nonlinear constraints depend on x(1) and x(2) through the product z=x(1)*x(2). Due to your bounds 0<=x(i)<=8, the product z can range between 0 and 64, and only one parameter is needed for this. By just setting x(2)=8 and treating x(1) as the only unknown, you can cover this range. The problem then reduces to the 1D optimization
min x1
subject to
(8*in_vec)*x1<=5
0<=x1<=8
If the in_vec(i) are all positive, the solution is x1=0. Otherwise, the constraint (8*in_vec)*x1<=5 is equivalent to some 1D interval [a,b] which can easily be found by simple arithmetic, and the solution is x1=max(a,0).
  2 Comments
Christoph
Christoph on 11 Aug 2014
I think I haven't explained it well enough or I simplyfied my example too much. Do you know the Toyota Prius? It has a specially designed gearbox consisting out of planatary gear sets. One planatary gearset carry the internal combustion engine (ICE) and the 2 motors/generators (MG1 and MG2).
On this website you can see where they are located on that gear set. Now I've got as input values the current power output of the ICE and the traction force on the wheels at some timesteps. With thoose inputs I can calculate the torques of both electric motors at every timestep (in the simulink modell). Back to my example: Now I'd like to minimize the size of both elektric motors (power-wise) by varrying the gear ratio x(1) of the planatary gearset. As additional constraints I would like: none of both eletric motors should have a greater torque than a specific value during the simulation in simulink. My simulink modell includes coefficients also, that means there isn't a arithmetic solution.
I hope this describes my problem better
Matt J
Matt J on 11 Aug 2014
Edited: Matt J on 11 Aug 2014
Describing the physics of your problem only complicates the description of problem for people who aren't physicists :-( If the mathematical structure of the problem is different from what you posted, you should update your post with a more accurate mathematical description.
In particular, it might be worth describing the actual Simulink operations more, if your posted example is just a simplification. So far it looks like all you are doing with Simulink is multiplying numbers together, which is major overkill. Multiplying numbers together is the kind of thing that can be done with matrix arithmetic operations, A.*B

Sign in to comment.


Sean de Wolski
Sean de Wolski on 11 Aug 2014
Edited: Sean de Wolski on 11 Aug 2014
Using A and b equal to the following should enforce your constraint.
I.e. max(out_vec) <= 5
A = eye(2)
b = 5+zeros(2,1)
This makes it so x1 and x2 cannot be greater than 5.
Actually, I suppose you could just use bound constraints as well.
lb = [0 0]
ub = [5 5]
  7 Comments
Sean de Wolski
Sean de Wolski on 11 Aug 2014
If you are using the 'interior-point' algorithm with fmincon, you could try having your objective function return a nan if one of the values is greater than 5. This will force fmincon to take a step back to try to avoid the nan.
Matt J
Matt J on 11 Aug 2014
Edited: Matt J on 11 Aug 2014
you could try having your objective function return a nan if one of the values is greater than 5. This will force fmincon to take a step back to try to avoid the nan.
I don't know if that's a good idea. That would make the domain of the objective function a closed set and therefore non-differentiable. Differentiable objective functions and constraints must have open domains.

Sign in to comment.

Categories

Find more on Get Started with Optimization Toolbox 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!