This discussion is archived
2 Replies Latest reply: Oct 31, 2009 7:12 AM by JosAH RSS

Need Help Finding Resources

843853 Newbie
Currently Being Moderated
I have been given the task at work of creating a linear optimization routine. The questions will be posed in the form:

Create a cow feed mixture at the lowest cost using the following ingredients and that meets the minimum nutritional requirements:
Ingredients:
Name          Cost     Calcium     Iron     Protein          Fat
A          .25     .7     .9     .8          .5
B          .10     .8     .8     1.5          .6
C          .08     .0     .8     .9          .4

Nutritional Requirements:

Calcium >= 10
Iron     >= 12
Protein     >= 15
Fat     <= 7.5
I have determined (correct me if I'm wrong) that this translates into a linear optimization problem using the following calculations:
Minimize 
     .25a + .10b + .08c
Where
     .7a + .8b >= 10
     .9a + .8b + .8c >= 12
     .8a + 1.5b + .9c >=15
     .5a + .6b + .4c <= 7.5
My situation is that any solution I come up with must run in a JDK 1.4.2 environment (this will eventually be incorporated into an SAP Netweaver portal application and believe it or not 90% of the world still uses NetWeaver 2004s which supports a maximum 1.4.2 environment), so this prevents me from using things like the Apache Commons Math package (which ironically enough has EXACTLY what I need in it).

I was desparately hoping not to reinvent the wheel, but I cannot find any open source projects that are helping me with this. I have been through a couple which is tedious (each has such a different API that it's very cumbersome just learning how to use each one) just to find that I'm not getting what I need out of them.

Any resources (either publication or online) that would help me code such a routine in java would be excellent. Event better if anyone has had success locating and using an open source library that is 1.4 compatible to solve such a problem and could point me in that direction.

Best Regards
  • 1. Re: Need Help Finding Resources
    843853 Newbie
    Currently Being Moderated
    Running a google search for "java linear optimization" seems to have found a number of hits. I'm not familiar with any of the packages though, so I'm not sure if they are what you're looking for.

    Likewise, a search for "linear optimization algorithm" turned up a few interesting articles such as the following in case you end up writing the algorithm yourself:
    [http://home.ubalt.edu/ntsbarsh/opre640a/partVIII.htm]

    The wiki entry for Linear programming turned up a number of packages. Although most are not Java, the following has a Java package: [http://www.cs.washington.edu/research/constraints/cassowary/]

    Edited by: jboeing on Sep 30, 2009 9:31 AM
  • 2. Re: Need Help Finding Resources
    JosAH Newbie
    Currently Being Moderated
    Your solution is correct: it's a so called 'blending problem' and it is one of the oldest problems solved by the Simplex algorithm. When you google for "Java simplex" you'll find quite a few implementations of the revised simplex algorithm; curiously enough most implementations are applets; probably for educational purposes ...

    kind regards,

    Jos