1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

General purpose solver

  1. Nov 3, 2007 #1
    Can anyone recommend a good general purpose solver for optimisation problems. E.g. something better than Excels' Solver add-in. I'm looking for something that is relatively quick and easy to use, and prefereably can be made to work with Excel spreadsheets without too much effort.

  2. jcsd
  3. Nov 3, 2007 #2
    Mathematica 6.0.

    You can do constrained nonlinear optimization with the maximize and minimize command.

    For example, I want to maximize a profit function of two variables that is not linear subject to the constraints on two item prices, p1 and p2:

    constraint 1
    region of viable prices that leads to non-negative demand:
    [tex]10395 \text{p1}+5150\geq 9983 \text{p2}\land \left(\left(\text{p1}>\frac{3000037}{199980}\land 10 \text{p1}\leq 37 \text{p2}+\frac{3000037}{19998}\right)\lor \left(\text{p2}\geq 0\land 0\leq \text{p1}\land \text{p1}\leq \frac{3000037}{199980}\right)\right)[/tex]

    constraint 2
    budget constraint is equivalent to:
    [tex]236059065 \text{p1}=921404813 \text{p2}+1676144666[/tex]

    And the approximate profit function:
    [tex]-1.31380\times 10^6+133216. \text{p1}-5934.12 \text{p1}^2-172176. \text{p2}+22612.1 \text{p1} \text{p2}-629.842 \text{p2}^2[/tex]

    So the command I enter is this:
    [tex]\text{Maximize}\left[\left\{profit[p1,p2],10395 \text{p1}+5150\geq 9983 \text{p2}\land \left(\left(\text{p1}>\frac{3000037}{199980}\land 10 \text{p1}\leq 37 \text{p2}+\frac{3000037}{19998}\right)\lor \left(\text{p2}\geq 0\land 0\leq \text{p1}\land \text{p1}\leq \frac{3000037}{199980}\right)\right),[/tex][tex]-\frac{20 (236059065 \text{p1}-921404813 \text{p2}-7017594666)}{106829}=1000000\right\},\{\text{p1},\text{p2}\}][/tex]
    The list is of the form {profit[p1,p2], constraint 1, constraint 2} and it gives the EXACT answer which is really long but can be approximated by throwing //N after it.
    [tex]\{2.22971\times 10^6,\{\text{p1}\to 133.135,\text{p2}\to 32.2893\}\}[/tex]So for my fictitious company, the max profit will be about 2.2 million dollars, achieved when the price of the first item is 133.14 and the other is 32.29. Incidentally, this was a basic model of a company that sells a hardcover and softcover edition of a book, the cheaper one being the latter of course.

    In a word: Mathematica 6.0.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook