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


Groups > comp.lang.python > #111764

Algorithm for sequencing a collection of dependent equations

Path csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Malcolm Greene <python@bdurham.com>
Newsgroups comp.lang.python
Subject Algorithm for sequencing a collection of dependent equations
Date Fri, 22 Jul 2016 12:01:13 -0400
Lines 35
Message-ID <mailman.58.1469203276.22221.python-list@python.org> (permalink)
References <1469203273.1522601.673919081.7AC3AFEA@webmail.messagingengine.com>
Mime-Version 1.0
Content-Type text/plain
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de yorg9jfHZgaAWBpTDT0N3gu+M10QKpNP2YfInxnz1VUg==
Return-Path <python@bdurham.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'dependency': 0.07; 'expressions': 0.07; 'received:internal': 0.09; 'translate': 0.15; 'expressions)': 0.16; 'expressions.': 0.16; 'from:addr:python': 0.16; 'language)': 0.16; 'malcolm': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; '&gt;': 0.18; 'dependent': 0.23; 'example': 0.26; 'figure': 0.27; 'least': 0.27; 'sequence': 0.27; 'referencing': 0.29; "i'm": 0.30; "we're": 0.30; 'similar': 0.33; 'structure': 0.34; 'list': 0.34; 'done': 0.35; 'evaluation': 0.36; 'structures': 0.36; 'to:addr :python-list': 0.36; 'received:10': 0.37; 'associated': 0.38; 'received:66': 0.38; 'thank': 0.38; 'data': 0.39; 'to:addr:python.org': 0.40; 'challenge': 0.61; 'determine': 0.61; 'header:Message-Id:1': 0.61; 'ending': 0.63; 'analysis': 0.72; 'evaluate': 0.72; '100': 0.79; 'dsl': 0.84; 'imagine': 0.96
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=bdurham.com; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=Bjx 2ukAhBw8tWCtyaHFnszbFTgA=; b=ZngWdJtpleqz9sVzJOdLSfOVblRF5Dmh0WH 5pV8CMpoIOvBrbZ9v13HPApfvnQ3fUHodFCjjYwsfRjk/g1BRy0OOM7nNqhFla5t B5rKj0Bz4IfBlMuayKA9sMpui4iD9bLMp82XCxUe8l5LS1cal8u6cweCtnw177kA E7bbCEPE=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=Bjx2ukAhBw8tWCtyaHFnszbFTgA=; b=WsyuP 7pJtFSeKIfaGl8Q0Za0p7we8G2xZbvERLgmoQ5mLt/kyu4wtoeqoA5bMySTPpjqt xwLbePWX/QFbInGvDbrwGM9/pjmHnVfLxcFpISKlWDrMSh+jwKbkdim720JkaGBs eqI9rnXxAkwkQF4Dl53OI1OWHVoBQl9tVs4vxc=
X-Sasl-Enc Y64AqdbWO7HbsHIiA+c2xxPh6HCtdhboes21BVPclD1h 1469203273
X-Mailer MessagingEngine.com Webmail Interface - ajax-2ccfea0a
X-Content-Filtered-By Mailman/MimeDel 2.1.22
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
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>
X-Mailman-Original-Message-ID <1469203273.1522601.673919081.7AC3AFEA@webmail.messagingengine.com>
Xref csiph.com comp.lang.python:111764

Show key headers only | View raw


We're working on a DSL (domain specific language) that we translate into
a list of tokenized expressions. My challenge is to figure out how to
sequence evaluation of these expressions so that we evaluate these
expressions in the proper order given that expressions have dependencies
on other expressions.
 
We've done the work to determine the full list of tokens associated with
each expression (after referencing other expressions) and we've detected
expressions that result in loops.
 
Here's an example of expressions and their full list of dependencies:
 
a = b + b + b + c + c   > b, c, d, e, s, t, x
b = c + d + e > c, d, e, s, t, x
c = s + 3 > s, x
d = t + 1 > t
e = t + 2 > t
s = x + 100 > x
t = 10 > None
x = 1 > None
y = 2 > None
 
I'm looking for an algorithm/data structure that will me to start with
the least dependent expression (t, x, y) and move through the list of
expressions in dependency order ending with the expression with the most
dependencies.
 
I imagine that spreadsheets have to perform a similar type of analysis
to figure out how to recalculate their cells.
 
Suggestions on algorithms and/or data structures (some form of graph?)
to support the above goals?
 
Thank you,
Malcolm

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


Thread

Algorithm for sequencing a collection of dependent equations Malcolm Greene <python@bdurham.com> - 2016-07-22 12:01 -0400

csiph-web