Use (linprog) to formulate this objective function?

y1 = sum(a1+b(1)+c1-d1+(n1/S));
y2 = sum(a1+b(1)+c1-d2+(n2/S));
y3 = sum(a1+b(1)+c1-d3+(n3/S));
y4 = sum(a1+b(1)+c1-d4+(n4/S));
y5 = sum(a1+b(1)+c1-d5+(n5/S));
X = 2 * (y1 + y2+ y3+ y4+ y5);
y6 = sum(a2+b(2)+c2-d6+(n6/S));
y7 = sum(a2+b(2)+c2-d7+(n7/S));
y8 = sum(a2+b(2)+c2-d8+(n8/S));
y9 = sum(a2+b(2)+c2-d9+(n9/S));
Y= 1 * (y6 + y7+ y8+ y9);
y = X + Y;
How can I put this objective function to fit (linprog) formula?

8 件のコメント

Matt J
Matt J 2018 年 2 月 9 日
What are the constraints?
Sherif Shokry
Sherif Shokry 2018 年 2 月 9 日
y < = 5
John D'Errico
John D'Errico 2018 年 2 月 9 日
編集済み: John D'Errico 2018 年 2 月 9 日
How many times are you going to ask the same question? By my count, this is at least the third time. b is the unknown, given your other questions. The answer is [0,0], assuming you still have lower bounds on b(1) and b(2). If there are no lower bounds on b, then the minimum is -inf.
A constraint of y<=5 is meaningless, since the only variable is b, and that enters in POSITIVELY. Since you are trying to minimize X+Y, then you want to make b as SMALL as possible. Therefore any upper limit on the y variables is irrelevant.
Sherif Shokry
Sherif Shokry 2018 年 2 月 9 日
編集済み: Sherif Shokry 2018 年 2 月 10 日
John D’Erico Thanks for the answer. By the way, if you think I'm bothering you, you don't want to answer. You don't need to count how many times I am going to ask..
John D'Errico
John D'Errico 2018 年 2 月 10 日
編集済み: John D'Errico 2018 年 2 月 10 日
But apparently you don't seem to read the answers that people give you. Your function is linear in the variables in question. You want to minimize the function, so drive it to -inf if possible. That means you need to make those variables as negative as possible, i.e., as close to -inf as you can. Since you stated earlier they are limited to be no smaller than 0, the solution is [0,0]. Period. Calling fmincon, linprog, GA, PSO, etc., whatever tool you want to try, will not change the fundamental nature of the mathematics. Asking the question multiple times will also not change that nature.
There is no minimum for this function as you pose it now, because you have no constraints that limit the value as you move towards -inf. Linprog cannot solve that problem. Asking the same question multiple times will not create a new mathematical reality. You got the answer. Enough questions.
Sherif Shokry
Sherif Shokry 2018 年 2 月 10 日
Mr. John D'Errico,
Thank you so much for your reply and highly appreciated explanation. Usually, I read the comments so much carefully, but I thought changing the nonlinear optimizer to a linear one may solve the problem. Of course, I know that repeating the question will not create a new mathematical reality. However I did not mean to repeat my question because I'm busy enough to waste my time, I tried to find another way to solve my problem. Also, you have to realize that not all people have this advanced level, maybe they still beginners. Lastly, since I did not tag you in my question and did not mention you, I think you do not have to count how many times I asked since "this is not your business". Regards
John D'Errico
John D'Errico 2018 年 2 月 10 日
編集済み: John D'Errico 2018 年 2 月 10 日
Your problem is linear. Changing the optimizer changes nothing about the problem. There was never any need to use an optimizer, ANY optimizer, to solve the problem in the first place. That was pointed out at least twice to you.
Finding another way to solve a trivially solved problem is silly. Sorry, but it is.
Suppose you brought your car to a mechanic to solve a problem. They fix it, using a screwdriver. Without understanding that the problem was solved, or even asking for help in understanding why it was solved, would you now take your car to a different garage, and ask them to solve the now fixed problem using a hammer?
When you get an answer. Look at what was said. Think about it. If you don't understand the answer, say that, then ask a followup question in the comments. Don't just blindly ask the question again with no thought applied. That insults the person who spent time in answering your question the first time, telling them they wasted their time in answering your question. It also wastes the time of the next person who might answer your question.
And as for my business, I'll tell you that you don't know my business any more than I care about yours.
Sherif Shokry
Sherif Shokry 2018 年 2 月 10 日
Thanks Sir

回答 (0 件)

この質問は閉じられています。

タグ

質問済み:

2018 年 2 月 9 日

コメント済み:

2018 年 2 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by