Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'algorithm': 0.04; 'scipy': 0.05; 'variables': 0.07; 'implements': 0.09; 'linear': 0.09; 'positioned': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; "wouldn't": 0.14; 'benjamin': 0.16; 'kern': 0.16; 'nelder- mead': 0.16; 'programmatic': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'underlying': 0.16; 'wrote:': 0.18; 'properly': 0.19; 'solution.': 0.20; 'work,': 0.20; 'programming': 0.22; 'header:User-Agent:1': 0.23; 'interpret': 0.24; "i've": 0.25; 'excel': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'am,': 0.29; 'robert': 0.30; "i'm": 0.30; '(which': 0.31; 'getting': 0.31; 'sep': 0.31; 'anyone': 0.31; 'class': 0.32; 'figure': 0.32; '"the': 0.34; 'problem': 0.35; "can't": 0.35; 'something': 0.35; 'test': 0.35; 'but': 0.35; 'there': 0.35; 'combination': 0.36; 'url:org': 0.36; 'too': 0.37; 'two': 0.37; 'problems': 0.38; 'solving': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'easy': 0.60; 'algorithms': 0.60; 'our': 0.64; 'more': 0.64; 'spot': 0.65; 'world': 0.66; 'believe': 0.68; 'subject': 0.69; 'results': 0.69; 'eco': 0.84; 'forced': 0.84; 'oscar': 0.84; 'termed': 0.84; 'terrible': 0.84; 'url:reference': 0.84; 'vba': 0.84; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robert Kern Subject: Re: Simplex Algorithm Date: Mon, 02 Sep 2013 10:45:07 +0100 References: <1PRUt.242963$ZD2.40442@fx19.iad> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 213.1.240.226 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378115111 news.xs4all.nl 15961 [2001:888:2000:d::a6]:48925 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53465 On 2013-09-02 09:06, Oscar Benjamin wrote: > > On Sep 2, 2013 2:31 AM, "Tommy Vee" wrote: > > > > Anyone know where I can get an easy to use Python class or algorithm for the > Simplex optimization algorithm? I've tried the one in the link below, but I > can't figure out if a) I'm using it properly, or b) where to get the solution. > BTW, I tried some test scenarios using MS Excel's "Solver" and just can't get > this algorithm to match Excel's results (which is spot on). > > > > http://taw9.hubpages.com/hub/Simplex-Algorithm-in-Python > > > > BTW, if I can't something to work, I'm going to be forced to use the VBA > programmatic Excel interface. That wouldn't be too bad, but the data comes from > a DB and getting it properly positioned to use Excel's "Solver" is very painful. > A Python approach would be much cleaner. > > Are you able to use scipy? It has the simplex algorithm (among many others) in > its optimize module: > http://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html Careful. Confusingly, there are two optimization algorithms known as "the simplex algorithm". The one the OP wants is for solving a linear programming problem (minimize a linear combination of variables subject to linear inequality constraints). The simplex algorithm that scipy implements is more properly termed "the Nelder-Mead simplex algorithm" for unconstrained local nonlinear minimization problems without derivative information. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco