WIP: futile...

This commit is contained in:
Jean Sirmai 2021-12-18 23:15:19 +01:00
parent 3cb73c7abb
commit 5277401f81
Signed by: jean
GPG Key ID: FB3115C340E057E3
4 changed files with 41 additions and 7 deletions

View File

@ -57,16 +57,21 @@
<space id="initial" date="1630000000" author="Une souris verte,">
<arrow site="0" weight="6" x="0"/>
<arrow site="1" weight="1" x="0"/>
<arrow site="2" weight="9" x="0"/>
<arrow site="2" weight="7" x="1"/>
<arrow site="1" weight="3" x="6"/>
<arrow site="0" weight="1" x="7"/>
<arrow site="1" weight="1" x="7"/>
<arrow site="2" weight="1" x="7"/>
<arrow site="1" weight="3" x="8"/>
<arrow site="1" weight="4" x="14"/>
<arrow site="0" weight="8" x="14"/>
<arrow site="2" weight="5" x="15"/>
<arrow site="1" weight="2" x="17"/>
<arrow site="2" weight="7" x="18"/>
<arrow site="2" weight="9" x="20"/>
<arrow site="0" weight="4" x="20"/>
<arrow site="0" weight="6" x="20"/>
<arrow site="1" weight="4" x="20"/>
</space>

Binary file not shown.

View File

@ -1,4 +1,6 @@
import model
"""
# from anytree import Node, AnyNode, NodeMixin, RenderTree, find_by_attr
# from anytree.exporter import DotExporter from ete3 import Tree
@ -67,7 +69,7 @@ for i in lll:
##
"""
A = Node("A")
A1 = Node("A1", parent=A)
A2 = Node("A2", parent=A)
@ -95,7 +97,7 @@ with open('input.txt', 'r') as f:
for pre, _, node in RenderTree(root):
print("%s%s" % (pre, node.name))
"""
##
@ -105,7 +107,7 @@ print("\n")
print(model.testmodel.get_conditions().get_condition(0).get_coord('x'))
print("\n")
print()
"""
sp = model.testmodel.get_states().get_space(0)
size = model.testmodel.get_parameters().spaceparam.get_dimension().get_x()
@ -113,7 +115,7 @@ sites = int(model.testmodel.get_parameters().spaceparam.get_site_multiplicity())
nb_arrows = int(model.testmodel.get_states().get_space(0).get_nb_arrows())
print("space size = ", size, " nb de sites par cellule = ", sites,
print("\n space size = ", size, " nb de sites par cellule = ", sites,
" nb total de flèches dans l'espace = ", nb_arrows)
print(' | ', end=' ')
@ -152,3 +154,24 @@ for k in range(0, size + 1):
print(k + 1, end=' ' + ' ' * sites * 2)
else:
print(k + 1, end=' ' + ' ' * sites * 2)
print('\n', ' | ', end = "")
for n in range(0, size + 1):
for s in range(0, sites):
arr = 0
for a in range(0, nb_arrows):
if (
sp.get_arrow(a).get_coord("x") == n
and sp.get_arrow(a).get_site() == s
):
arr = sp.get_arrow(a).get_weight()
if arr > 0:
print(str(arr), end=' ')
else:
print('.', end=' ')
print(' | ', end=' ')
print('\n\n', model.testmodel.get_space(0, 0, 0))

View File

@ -268,6 +268,9 @@ class Space:
def get_nb_arrows(self):
return self.nb_arrows
def get_weight(self, cell, site):
return 4096
class States:
__space = []
@ -442,6 +445,9 @@ class Model:
if(child.tag == "transitions"):
self.__transitions = child
def get_space(self, space_id, x_val, site_val):
return testmodel.get_states().get_space(space_id).get_weight(x_val, site_val)
def get_identity(self):
return Identity(self.__identity)
@ -467,8 +473,8 @@ class Model:
self.tree.write("../models/" + name + ".xml", encoding="utf-8")
modelPath = "../models/dimers random walk.automat.xml"
schemaPath = "../schemas/models_0.2.1.automat.xmls"
modelPath = "../models/dimers random walk.xml"
schemaPath = "../schemas/models_0.2.1.xmls"
testmodel = Model(modelPath, schemaPath)