Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Cooperative Cuisine Environment
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Social Cognitive Systems
CoCoSy
Cooperative Cuisine Environment
Merge requests
!94
Resolve "Score of order depends on remaining time"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Score of order depends on remaining time"
128-score-of-order-depends-on-remaining-time
into
dev
Overview
0
Commits
11
Pipelines
7
Changes
17
Merged
Fabian Heinrich
requested to merge
128-score-of-order-depends-on-remaining-time
into
dev
1 year ago
Overview
0
Commits
11
Pipelines
7
Changes
1
Expand
Closes
#128 (closed)
0
0
Merge request reports
Compare
version 5
version 5
d8c59b07
1 year ago
version 4
ec1ec758
1 year ago
version 3
548f0f3b
1 year ago
version 2
cdbbfd08
1 year ago
version 1
584c17c0
1 year ago
dev (base)
and
latest version
latest version
937e04bb
11 commits,
1 year ago
version 5
d8c59b07
10 commits,
1 year ago
version 4
ec1ec758
9 commits,
1 year ago
version 3
548f0f3b
5 commits,
1 year ago
version 2
cdbbfd08
4 commits,
1 year ago
version 1
584c17c0
1 commit,
1 year ago
Show latest version
1 file
+
30
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
cooperative_cuisine/scores.py
+
30
−
0
Options
@@ -91,6 +91,12 @@ from cooperative_cuisine.hooks import HookCallbackClass
def
constant_score
(
max_score
:
float
,
time_percentage
:
float
=
1.0
):
"""
Returns the constant score. No time dependence.
Args:
max_score: The maximum score to be returned.
time_percentage: The time percentage. Default is 1.0.
"""
return
max_score
@@ -100,6 +106,17 @@ def linear_score(
time_percentage
:
float
=
1.0
,
round_decimals
:
int
=
0
,
):
"""
Returns the linear score based on the time percentage.
Args:
max_score: Maximum possible score.
min_score_ratio: Minimum score ratio. Default is 0.0.
time_percentage: Time percentage of the order. Default is 1.0.
round_decimals: Number of decimals to round the score to. Default is 0.
Returns: Modified score based on the time percentage.
"""
modified_score
=
float
(
np
.
round
(
max
(
max_score
*
time_percentage
,
max_score
*
min_score_ratio
),
@@ -116,6 +133,19 @@ def stepped_score(
round_decimals
:
int
=
0
,
time_percentage
:
float
=
1.0
,
):
"""
Modifies the score based on a step function based on the time percentage.
Args:
max_score: Maximum possible score.
steps: Steps for the score ratios.
score_ratios: Ratios for the score based on the steps.
round_decimals: Number of decimals to round the score to. Default is 0.
time_percentage: Time percentage of the order. Default is 1.0.
Returns: Modified score based on the time percentage.
"""
if
len
(
steps
)
!=
len
(
score_ratios
):
raise
ValueError
(
"
steps and vals must have the same length
"
)
Loading