Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; 'algorithm': 0.04; 'conventions': 0.07; 'conventions.': 0.09; 'linear': 0.09; 'positioned': 0.09; 'variables.': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; "wouldn't": 0.14; 'kern': 0.16; 'programmatic': 0.16; 'solver': 0.16; 'solver,': 0.16; 'to:addr:robert.kern': 0.16; 'to:name:robert kern': 0.16; 'tommy': 0.16; 'language': 0.16; 'wrote:': 0.18; 'options.': 0.19; 'properly': 0.19; 'solution.': 0.20; 'work,': 0.20; 'programming': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'compiled': 0.26; 'excel': 0.26; '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; 'anyone': 0.31; 'class': 0.32; 'figure': 0.32; 'run': 0.32; 'url:python': 0.33; 'sources': 0.33; "can't": 0.35; 'something': 0.35; 'convert': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'url:org': 0.36; 'too': 0.37; 'represent': 0.38; 'thank': 0.38; 'displays': 0.38; 'rather': 0.38; 'itself': 0.39; 'how': 0.40; 'easy': 0.60; 'simple,': 0.60; 'show': 0.63; 'choose': 0.64; 'different': 0.65; 'spot': 0.65; 'to:addr:gmail.com': 0.65; 'between': 0.67; 'results': 0.69; 'forced': 0.84; 'maximized': 0.84; 'vba': 0.84; 'luck': 0.93; 'modelling': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:newsgroups:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=7NrVd0CArFM9GYdzlRqhVIc67irLI9MfWvSHkeHRAbU=; b=BMVKXTHNS8Rlc1FAQ0t8w2Kk3KjEvngTsXr4SVtZ6Ld+M5nq2O7kzOcX85ZyqI2QdH 8TUqTdOvmO+9/oZdiZg2hFNV5vDscB0NFWi/zXb3CVtvMXSzbTgxPOQW8GXBk5230kSf SucLJvS6+38kK0cJn1+QPErt/5GIQv5IYVwAzJ1YpAp9r0DUPs2dUPN5+KBRG3D0ywab aXPQFXTwXnLeg08WNFZ+YKMLfnemJOJ5ADKnYbPB9QoNZPS7ZY/N47t7ekjqM3Wc+Nqt pCiXGmTawduiRR3Thl7o55LOEZv5ZpYUzRvXKndJIcg03ocY4Un2X01vauC/RLllGMaH k3VQ== X-Received: by 10.221.44.136 with SMTP id ug8mr23404905vcb.13.1378134373834; Mon, 02 Sep 2013 08:06:13 -0700 (PDT) Date: Mon, 02 Sep 2013 11:06:11 -0400 From: Tommy Vee User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 Newsgroups: comp.lang.python To: Robert Kern Subject: Re: Simplex Algorithm References: <1PRUt.242963$ZD2.40442@fx19.iad> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: python-list@python.org 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: , Message-ID: Lines: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378134376 news.xs4all.nl 15934 [2001:888:2000:d::a6]:40676 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53494 On 9/2/2013 5:55 AM, Robert Kern wrote: > On 2013-09-02 02:26, 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. > > Can you show some of the test scenarios that you tried? There are > different conventions in how to represent a linear programming problem, > and different solvers may choose different conventions. You may have to > convert between representations. > > You may have better luck with the PuLP interface: > > https://pypi.python.org/pypi/PuLP > > PuLP itself is just a modelling language rather than a solver, but the > sources do contain compiled binaries for the CoinMP solver so it will > work out-of-box on popular platforms, like Windows. > > https://projects.coin-or.org/CoinMP > Thank you, I will definitely look at these and other options. BTW, try the test scenario in the link I sent. Very simple, only 3 variables. Maximize: 2x+3y+2z Constraints: 2x+y+z <=4, x+2y+z <=7, z <= 5 The algorithm displays the Tableau after each pivot, but where is the answer for x, y and z? When I run this in Excel's Solver, I get x=0, y=3, z=1. which is indeed the maximized solution (11).