Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
1.12/5 (3 votes)
See more:
Respected members,

I need to solve a problem using Linear programming : simplex method or any algorithm (without using any sort of Libraries) which comes in category of linear code that is :
CSS
An Example: The Diet Problem
 A student is trying to decide on lowest cost diet that
provides sufficient amount of protein, with two choices:
 steak: 2 units of protein/pound, $3/pound
 peanut butter: 1 unit of protein/pound, $2/pound
 In proper diet, need 4 units protein/day.
Let x = # pounds peanut butter/day in the diet.
Let y = # pounds steak/day in the diet.
Goal: minimize 2x + 3y (total cost)
subject to constraints:
x + 2y ³ 4
x ³ 0, y ³ 0

This is an optimization problem.
• Any solution meeting the nutritional demands is called
a feasible solution
• A feasible solution of minimum cost is called the
optimal solution.

I'm stuck that how do I implement it on C# or Java language .. How do i start quite confused any help will be appreciated.

Thanks
Posted
Updated 15-Dec-14 2:52am
v4
Comments
Tomas Takac 15-Dec-14 9:03am    
What's with all the "checking"? Why do you edit the question like that? The point is other people may have a look on your question if they have a similar problem and can read the solutions. This way you are ruining it for everybody else. Please revert it so we can see your question. This would be more appropriate as a comment to the relevant solution.
Richard Deeming 15-Dec-14 9:40am    
Please don't remove the contents of your question after it's been answered - just accept the solution(s) which helped and leave the question alone.

I've rolled-back your edit.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900