save network
This commit is contained in:
parent
4f7be2c76c
commit
9435484e3f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5
model.py
5
model.py
|
@ -93,6 +93,11 @@ class Model(ap.Model):
|
||||||
self.firm_network = ap.Network(self, G_Firm)
|
self.firm_network = ap.Network(self, G_Firm)
|
||||||
self.product_network = ap.Network(self, G_bom)
|
self.product_network = ap.Network(self, G_bom)
|
||||||
|
|
||||||
|
out_file = open("myfile.json", "w")
|
||||||
|
import json
|
||||||
|
json.dump(nx.adjacency_data(G_Firm), out_file)
|
||||||
|
out_file.close()
|
||||||
|
|
||||||
# init product
|
# init product
|
||||||
for ag_node, attr in self.product_network.graph.nodes(data=True):
|
for ag_node, attr in self.product_network.graph.nodes(data=True):
|
||||||
product = ProductAgent(self, code=ag_node.label, name=attr['Name'])
|
product = ProductAgent(self, code=ag_node.label, name=attr['Name'])
|
||||||
|
|
File diff suppressed because one or more lines are too long
4
orm.py
4
orm.py
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from sqlalchemy import create_engine, inspect
|
from sqlalchemy import create_engine, inspect
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy import Column, Integer, String, ForeignKey, BigInteger, DateTime, PickleType, Boolean
|
from sqlalchemy import Column, Integer, String, ForeignKey, BigInteger, DateTime, PickleType, Boolean, Text
|
||||||
from sqlalchemy.sql import func
|
from sqlalchemy.sql import func
|
||||||
from sqlalchemy.orm import relationship, Session
|
from sqlalchemy.orm import relationship, Session
|
||||||
from sqlalchemy.pool import NullPool
|
from sqlalchemy.pool import NullPool
|
||||||
|
@ -65,6 +65,8 @@ class Sample(Base):
|
||||||
ts_done = Column(DateTime(timezone=True), onupdate=func.now())
|
ts_done = Column(DateTime(timezone=True), onupdate=func.now())
|
||||||
stop_t = Column(Integer, nullable=True)
|
stop_t = Column(Integer, nullable=True)
|
||||||
|
|
||||||
|
firm_network = Column(Text(4294000000), nullable=True)
|
||||||
|
|
||||||
experiment = relationship('Experiment', back_populates='sample', uselist=False)
|
experiment = relationship('Experiment', back_populates='sample', uselist=False)
|
||||||
result = relationship('Result', back_populates='sample', lazy='dynamic')
|
result = relationship('Result', back_populates='sample', lazy='dynamic')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue