Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
AZULSimu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiaofei Wang
AZULSimu
Commits
5c44cc45
Commit
5c44cc45
authored
5 years ago
by
Xiaofei Wang
Browse files
Options
Downloads
Patches
Plain Diff
上传新文件
parent
4afb5a81
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
AZUL/Monitor.py
+63
-0
63 additions, 0 deletions
AZUL/Monitor.py
with
63 additions
and
0 deletions
AZUL/Monitor.py
0 → 100644
+
63
−
0
View file @
5c44cc45
from
rewardBasedPlayer
import
get_max_difference
class
Monitor
:
LIST
=
[]
def
__init__
(
self
,
move
,
values
,
act_id
,
round_id
,
brunches
,
move_len
,
times
,
nodes
):
self
.
move
=
move
self
.
values
=
values
self
.
act_id
=
act_id
self
.
dv
=
get_max_difference
(
values
,
act_id
)
self
.
round_id
=
round_id
self
.
decrease
=
False
self
.
move_len
=
move_len
self
.
times
=
times
self
.
nodes
=
nodes
#self.search_time = search_time
Monitor
.
LIST
.
append
(
self
)
if
len
(
Monitor
.
LIST
)
>=
2
:
last_monitor
=
Monitor
.
LIST
[
-
2
]
if
self
.
round_id
==
last_monitor
.
round_id
:
self
.
action_id
=
last_monitor
.
action_id
+
1
else
:
self
.
action_id
=
0
self
.
decrease
=
self
.
is_decrease
(
last_monitor
)
else
:
self
.
action_id
=
0
self
.
brunches
=
brunches
def
is_decrease
(
self
,
lm
):
if
self
.
dv
<
lm
.
dv
-
0.1
:
return
True
return
False
def
__str__
(
self
):
# string = 'v:{:4} {:4} dv:{:4} r:{} a:{} b:{:3} {:3} d:{:5}'.format(
# string='r:{} a:{} b:{:3} {:3} l:{:2} t:{:4} n:{:4} d:{:5}'.format(
# string = 'b:{:3} {:3} l:{:2} t:{:4} n:{:4} d:{:1}'.format(
string
=
'
r:{} a:{} dv:{:5} b:{:3} {:3} l:{:2} t:{:4} n:{:4} d:{:1}
'
.
format
(
self
.
round_id
,
self
.
action_id
,
round
(
self
.
dv
,
1
),
self
.
brunches
[
0
],
self
.
brunches
[
1
],
self
.
move_len
,
self
.
times
,
self
.
nodes
,
self
.
decrease
)
return
string
def
MonitorsToString
():
string
=
''
for
m
in
Monitor
.
LIST
:
# string += ('\n' if m.action_id == 0 else '') + str(m)+'\t'
if
m
.
decrease
is
True
:
print
(
"
\033
[0;31;47m{}
\033
[0m
"
.
format
(
str
(
m
)))
else
:
print
(
"
\033
[0;30;47m{}
\033
[0m
"
.
format
(
str
(
m
)))
This diff is collapsed.
Click to expand it.
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