Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OPTIS_App
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OPTIS
OPTIS_App
Commits
1b52cd21
Commit
1b52cd21
authored
2 years ago
by
Aleksandra Dimitrova
Browse files
Options
Downloads
Patches
Plain Diff
everything working in docker container except flash messages
parent
150699f0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/dqn.py
+1
-1
1 addition, 1 deletion
backend/dqn.py
backend/petrinet.py
+4
-4
4 additions, 4 deletions
backend/petrinet.py
with
5 additions
and
5 deletions
backend/dqn.py
+
1
−
1
View file @
1b52cd21
...
@@ -68,7 +68,7 @@ def deploy(state):
...
@@ -68,7 +68,7 @@ def deploy(state):
number of the encoded optimal action to take
number of the encoded optimal action to take
"""
"""
model
=
DQN
.
load
(
r
'
..
\
models
\
1687176631
\
2000000
'
)
model
=
DQN
.
load
(
r
'
..
/
models
/
1687176631
/
2000000
'
)
action
,
_
=
model
.
predict
(
state
,
deterministic
=
True
)
action
,
_
=
model
.
predict
(
state
,
deterministic
=
True
)
return
action
return
action
...
...
This diff is collapsed.
Click to expand it.
backend/petrinet.py
+
4
−
4
View file @
1b52cd21
...
@@ -30,7 +30,7 @@ def generate_petri_net():
...
@@ -30,7 +30,7 @@ def generate_petri_net():
# we use an existing event log to create a petri net for our process
# we use an existing event log to create a petri net for our process
# dataframe = pd.read_csv(r'Frontend/static/eventlog.csv', sep=',') #docker
# dataframe = pd.read_csv(r'Frontend/static/eventlog.csv', sep=',') #docker
dataframe
=
pd
.
read_csv
(
r
'
static
\
eventlog.csv
'
,
sep
=
'
,
'
)
#local
dataframe
=
pd
.
read_csv
(
r
'
static
/
eventlog.csv
'
,
sep
=
'
,
'
)
#local
dataframe
[
'
StartTimestamp
'
]
=
pd
.
to_datetime
(
dataframe
[
'
StartTimestamp
'
])
dataframe
[
'
StartTimestamp
'
]
=
pd
.
to_datetime
(
dataframe
[
'
StartTimestamp
'
])
# Sort the event log by case ID and start timestamp, and get only finished cases
# Sort the event log by case ID and start timestamp, and get only finished cases
...
@@ -60,7 +60,7 @@ def process_petri_net():
...
@@ -60,7 +60,7 @@ def process_petri_net():
for
t
in
net
.
transitions
:
for
t
in
net
.
transitions
:
decoration
.
update
({
t
:
{}})
decoration
.
update
({
t
:
{}})
decoration
[
t
].
update
({
"
color
"
:
"
white
"
})
decoration
[
t
].
update
({
"
color
"
:
"
white
"
})
pm4py
.
save_vis_petri_net
(
net
,
initial_marking
,
final_marking
,
bgcolor
=
"
#E6F1FA
"
,
decorations
=
decoration
,
file_path
=
r
"
static
\
process_net.png
"
)
#local
pm4py
.
save_vis_petri_net
(
net
,
initial_marking
,
final_marking
,
bgcolor
=
"
#E6F1FA
"
,
decorations
=
decoration
,
file_path
=
r
"
static
/
process_net.png
"
)
#local
def
decorate_petri_net
(
case
,
name
):
def
decorate_petri_net
(
case
,
name
):
"""
Exports a .png of a petri-net with the trace of the case colored.
"""
Exports a .png of a petri-net with the trace of the case colored.
...
@@ -105,7 +105,7 @@ def decorate_petri_net(case, name):
...
@@ -105,7 +105,7 @@ def decorate_petri_net(case, name):
# pm4py.view_petri_net(net, initial_marking, final_marking, decorations = decoration)
# pm4py.view_petri_net(net, initial_marking, final_marking, decorations = decoration)
print
(
"
made petrinet
"
)
print
(
"
made petrinet
"
)
# pm4py.save_vis_petri_net(net, initial_marking, final_marking, decorations = decoration, file_path = r"Frontend/static/preview_net.png") #docker
# pm4py.save_vis_petri_net(net, initial_marking, final_marking, decorations = decoration, file_path = r"Frontend/static/preview_net.png") #docker
pm4py
.
save_vis_petri_net
(
net
,
initial_marking
,
final_marking
,
bgcolor
=
"
#E6F1FA
"
,
decorations
=
decoration
,
file_path
=
r
"
static
\
preview_net.png
"
)
#local
pm4py
.
save_vis_petri_net
(
net
,
initial_marking
,
final_marking
,
bgcolor
=
"
#E6F1FA
"
,
decorations
=
decoration
,
file_path
=
r
"
static
/
preview_net.png
"
)
#local
def
decorate_petri_net_with_rec
(
case
,
rec
,
name
):
def
decorate_petri_net_with_rec
(
case
,
rec
,
name
):
"""
Exports a .png of a petri-net in which the trace of the case is colored in one color and the recommended activity in another.
"""
Exports a .png of a petri-net in which the trace of the case is colored in one color and the recommended activity in another.
...
@@ -153,7 +153,7 @@ def decorate_petri_net_with_rec(case, rec, name):
...
@@ -153,7 +153,7 @@ def decorate_petri_net_with_rec(case, rec, name):
# pm4py.view_petri_net(net, initial_marking, final_marking, decorations = decoration)
# pm4py.view_petri_net(net, initial_marking, final_marking, decorations = decoration)
# pm4py.save_vis_petri_net(net, initial_marking, final_marking, decorations = decoration, file_path = r"Frontend/static/net.png") #docker
# pm4py.save_vis_petri_net(net, initial_marking, final_marking, decorations = decoration, file_path = r"Frontend/static/net.png") #docker
pm4py
.
save_vis_petri_net
(
net
,
initial_marking
,
final_marking
,
bgcolor
=
"
#E6F1FA
"
,
decorations
=
decoration
,
file_path
=
r
"
static
\
net.png
"
)
#local
pm4py
.
save_vis_petri_net
(
net
,
initial_marking
,
final_marking
,
bgcolor
=
"
#E6F1FA
"
,
decorations
=
decoration
,
file_path
=
r
"
static
/
net.png
"
)
#local
return
rec_name
return
rec_name
# decorate_petri_net(646, 7, "eventlog.csv")
# decorate_petri_net(646, 7, "eventlog.csv")
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment