Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #90700

Re: Python: How to find out values of all feasible x under constraints.

X-FeedAbuse http://nntpfeed.proxad.net/abuse.pl feeded by 78.192.65.63
Path csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!news.muarf.org!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'url:pypi': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'skip:[ 20': 0.04; 'subject:Python': 0.06; 'pypi': 0.07; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:How': 0.10; 'python': 0.11; 'language.': 0.14; 'appreciated!': 0.16; 'code?': 0.16; 'feasible': 0.16; 'hint': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:under': 0.16; 'subject:values': 0.16; 'x_1': 0.16; 'x_2': 0.16; 'language': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'example': 0.22; 'header:User-Agent:1': 0.23; 'own.': 0.24; 'mention': 0.26; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'forgot': 0.30; 'code': 0.31; 'libraries': 0.31; 'subject:all': 0.32; 'url:python': 0.33; 'maybe': 0.34; 'etc': 0.35; 'there': 0.35; 'url:ie': 0.36; 'url:org': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'our': 0.64; 'interest': 0.64; 'dear': 0.65; 'charset:windows-1252': 0.65; 'received:as9105.com': 0.84; 'received:dsl.as9105.com': 0.84; 'received:dynamic.dsl.as9105.com': 0.84; 'subject:find': 0.84; 'zhang': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Python: How to find out values of all feasible x under constraints.
Date Sat, 16 May 2015 01:16:04 +0100
References <12da2c70-fd4e-430b-83d2-fad4ac1e3f8f@googlegroups.com> <mj4p69$je7$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 80-44-148-0.dynamic.dsl.as9105.com
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
In-Reply-To <mj4p69$je7$1@ger.gmane.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.52.1431735384.17265.python-list@python.org> (permalink)
Lines 45
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1431735384 news.xs4all.nl 2835 [2001:888:2000:d::a6]:44371
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:90700

Show key headers only | View raw


On 15/05/2015 13:35, Mark Lawrence wrote:
> On 15/05/2015 04:58, Xiang Zhang wrote:
>> Dear all,
>>
>> I am writing a code using Python now.
>>
>> I want to know how to find out values of all feasible x under
>> constraints.
>>
>> x = [x_1, x_2, x_3,..., x_10]
>>
>>
>> constraints:
>> x_i = 0,1,2,3 or 4,          where i=1,2,....10
>> x_1 + x_2 + x_3 +...+x_10 <= 15
>>
>> How to find out all the feasible solutions x (domain of x) using
>> python, like [0,0,0,0,0,0,0,0,0,0], [1,1,1,1,1,1,1,1,1,1] etc ? What
>> should be the code?
>>
>> Any hint or help would be highly appreciated!
>>
>> Sincerely,
>>
>> Xiang Zhang
>>
>
> There are several constraint libraries on pypi if you don't want to roll
> your own.  See for example
> https://pypi.python.org/pypi/python-constraint/1.2
>

Forgot to mention this http://numberjack.ucc.ie/

Maybe of general interest see also http://www.csplib.org/ 
http://www.hakank.org/constraint_programming_blog/



-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Python: How to find out values of all feasible x under constraints. Xiang Zhang <zhangxiangsunny@gmail.com> - 2015-05-14 20:58 -0700
  Re: Python: How to find out values of all feasible x under constraints. Peter Otten <__peter__@web.de> - 2015-05-15 09:47 +0200
  Re: Python: How to find out values of all feasible x under constraints. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-15 13:35 +0100
  Re: Python: How to find out values of all feasible x under constraints. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-16 01:16 +0100

csiph-web