Skip to content

Commit

Permalink
cleanup add requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
mareksubocz committed Oct 20, 2022
1 parent be63164 commit 52268c1
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyrightconfig.json
.python-version
46 changes: 41 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,43 @@
from datasetgenerator import DatasetGenerator
# from datasetgenerator import DatasetGenerator
# import annealing
# import numpy as np
# available_car_speeds = [60, 70, 80, 90, 100, 110]
# dsg = DatasetGenerator(max_length=500, available_car_speeds=available_car_speeds, charging_speed=22)
# length, nodes, stations, chargers = dsg.generate_highway(30)
# car_info = dsg.generate_car_types(2)
# instance = dsg.generate_car_instances(10.0, 0.1)
#
# collision_matrix, im = annealing.instance_to_matrix(instance,car_info, length, nodes, stations, chargers, available_car_speeds, charging_speed=22)
import numpy as np
from datasetgenerator import DatasetGenerator
from datetime import datetime
import utils
import annealing

logdir = 'logdir' + '/' + datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
instance_name = 'a4'
data_path = 'data/{}'.format(instance_name)

car_info, instance_info, _ = utils.load_instance_data(data_path)
dsg = DatasetGenerator(max_length=instance_info['length'], available_car_speeds=instance_info['available_car_speeds'], charging_speed=22, seed=5)

dsg.length = instance_info['length']
dsg.nodes = np.asarray(instance_info['nodes'])
dsg.stations = np.asarray(instance_info['stations'])
dsg.chargers = np.asarray(instance_info['chargers'])
dsg.car_types_battery = car_info['capacity'].values
dsg.car_types_consumptions = car_info.values[:, 1:]

instance, feasible_solution = dsg.generate_car_instances(1000000, 0.1)

collision_matrix, im = annealing.instance_to_matrix(instance,car_info, instance_info['nodes'], instance_info['stations'], instance_info['available_car_speeds'], charging_speed=22)

bqm = annealing.matrix_to_bqm(im, collision_matrix)
sampleset = annealing.bqm_to_sampleset(bqm)

print(sampleset.first.sample)
print(sampleset.first.energy)

dsg = DatasetGenerator(max_length=500, available_car_speeds=[60, 70, 80, 90, 100, 110], charging_speed=22)
length, nodes, stations, chargers = dsg.generate_highway(100)
car_info = dsg.generate_car_types(2)
instance = dsg.generate_car_instances(10.0, 0.1)
filtered_sample = [int(k) for k, v in sampleset.first.sample.items() if v == 1]
print(filtered_sample)
im.loc[filtered_sample]
1 change: 0 additions & 1 deletion plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib

#path = 'logdir/2022-10-03_09-45-46/small_instance'
path = 'logdir/ibmq_kolkata/small_instance'
Expand Down
132 changes: 132 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
anyio==3.6.2
appnope==0.1.3
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.0.8
attrs==22.1.0
backcall==0.2.0
beautifulsoup4==4.11.1
bleach==5.0.1
certifi==2022.9.24
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.3
contourpy==1.0.5
cryptography==38.0.1
cycler==0.11.0
debugpy==1.6.3
decorator==5.1.1
defusedxml==0.7.1
Deprecated==1.2.13
dill==0.3.5.1
dimod==0.11.6
diskcache==5.4.0
dwave-cloud-client==0.10.2
dwave-greedy==0.2.5
dwave-hybrid==0.6.9
dwave-inspector==0.3.0
dwave-neal==0.5.9
dwave-networkx==0.8.12
dwave-ocean-sdk==5.5.0
dwave-preprocessing==0.4.0
dwave-system==1.15.0
dwave-tabu==0.4.5
dwavebinarycsp==0.2.0
entrypoints==0.4
executing==1.1.1
fasteners==0.18
fastjsonschema==2.16.2
Flask==2.2.2
fonttools==4.37.4
homebase==1.0.1
ibm-cloud-sdk-core==3.16.0
ibm-platform-services==0.27.1
idna==3.4
ipykernel==6.16.0
ipython==8.5.0
ipython-genutils==0.2.0
itsdangerous==2.1.2
jedi==0.18.1
Jinja2==3.1.2
jsonschema==4.16.0
jupyter-server==1.21.0
jupyter_client==7.4.3
jupyter_core==4.11.2
jupyterlab-pygments==0.2.2
kiwisolver==1.4.4
MarkupSafe==2.1.1
matplotlib==3.6.0
matplotlib-inline==0.1.6
minorminer==0.2.9
mistune==2.0.4
mpmath==1.2.1
nbclassic==0.4.5
nbclient==0.7.0
nbconvert==7.2.2
nbformat==5.7.0
nest-asyncio==1.5.6
networkx==2.8.7
notebook==6.5.1
notebook_shim==0.2.0
ntlm-auth==1.5.0
numpy==1.23.4
packaging==21.3
pandas==1.5.1
pandocfilters==1.5.0
parso==0.8.3
pbr==5.10.0
penaltymodel==1.0.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.2.0
plucky==0.4.3
ply==3.11
prometheus-client==0.15.0
prompt-toolkit==3.0.31
psutil==5.9.3
ptyprocess==0.7.0
pure-eval==0.2.2
pycparser==2.21
pydantic==1.10.2
Pygments==2.13.0
PyJWT==2.6.0
pyparsing==3.0.9
pyqubo==1.3.0
pyrsistent==0.18.1
PySocks==1.7.1
python-dateutil==2.8.2
pytz==2022.5
pyzmq==24.0.1
qiskit==0.39.0
qiskit-aer==0.11.0
qiskit-ibm-runtime==0.6.2
qiskit-ibmq-provider==0.19.2
qiskit-terra==0.22.0
rectangle-packer==2.0.1
requests==2.28.1
requests-ntlm==1.1.0
retworkx==0.12.0
rustworkx==0.12.0
scipy==1.9.3
seaborn==0.12.1
Send2Trash==1.8.0
six==1.16.0
sniffio==1.3.0
soupsieve==2.3.2.post1
stack-data==0.5.1
stevedore==4.0.1
symengine==0.9.2
sympy==1.11.1
terminado==0.16.0
tinycss2==1.2.1
tornado==6.2
tqdm==4.64.1
traitlets==5.5.0
typing_extensions==4.4.0
urllib3==1.26.12
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==1.4.1
websockets==10.3
Werkzeug==2.2.2
wrapt==1.14.1

0 comments on commit 52268c1

Please sign in to comment.