Minimization with discrete variable
이전 댓글 표시
I have some discrete variables of motor torque and speed. Ex: motor 1 has 6 Nm torque and 42 rpm, motor 2 has 9 Nm torque and 62 rpm, etc. I have to find the correct motor specification when applied on some mechanism and load and I already had the linearized function of this mechanism. I have to use optimization tool on Matlab. How can I put the discrete variable into matlab and how can I do the optimization? Really need help.
댓글 수: 3
jgg
2016년 1월 12일
I'm unclear what you're trying to do here. Describe, if you can, clearly what the outcome variable you're trying to minimize, what the choice variables are, and how they're related.
Rudi Gunawan
2016년 1월 12일
jgg
2016년 1월 12일
I assume the secondary issue is that you have a very very large number of these so that enumeration is not feasible?
채택된 답변
추가 답변 (2개)
Alan Weiss
2016년 1월 12일
0 개 추천
If you can specify your problem as a mixed-integer linear programming problem, use the intlinprog function. There are several examples on that page that can help you with problem formulation.
If it is impossible to put into the MILP framework, use the ga solver from Global Optimization Toolbox to solve your mixed integer optimization. You might find some help in this example.
Alan Weiss
MATLAB mathematical toolbox documentation
It's a little bit unclear what your objective function is, but suppose it's something like f(A,B) where A and B are your discrete random variables. Provided that you have only a few levels of the random variables, you could make a nice program like this where:
A = [1,2,3,4]; B = [1,2,3,4];
Then, set something like:
a_val = @(x)(1*x(1)+2*x(2)+3*x(3)+4*x(4));
b_val = @(x)(1*x(1)+2*x(2)+3*x(3)+4*x(4));
Then, your objective function is f(a_val(x),b_val(y)) and you have the restriction your lower bound is zero and upper bound is one, and x and y sum to 1. You could then easily use ga to solve this by following the documentation.
An alternative if you have many levels is to make the variable the level:
f(A(la),B(lb))
where la and lb are the levels, and you restrict them to be between 1 and k where k is the number of levels. I think ga would work well here as well.
It's a little hard to give you more direct advice without more information.
댓글 수: 6
Rudi Gunawan
2016년 1월 13일
Rudi Gunawan
2016년 1월 13일
편집: Rudi Gunawan
2016년 1월 13일
Rudi Gunawan
2016년 1월 13일
Torsten
2016년 1월 13일
This should be done in MATLAB, too.
It avoids that you have to calculate 128 values with a table calculator.
Best wishes
Torsten.
Rudi Gunawan
2016년 1월 13일
카테고리
도움말 센터 및 File Exchange에서 Choose a Solver에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!