Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
TelescopeScheduling
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ADS
TelescopeScheduling
Commits
b1e197dc
Commit
b1e197dc
authored
2 years ago
by
Hamers,G.C.A. (Glenn)
Browse files
Options
Downloads
Patches
Plain Diff
martijn wants another push (small name changes)
parent
f37ae65f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
__pycache__/offline.cpython-310.pyc
+0
-0
0 additions, 0 deletions
__pycache__/offline.cpython-310.pyc
main.py
+1
-1
1 addition, 1 deletion
main.py
offline.py
+7
-5
7 additions, 5 deletions
offline.py
t2_out.txt
+3
-3
3 additions, 3 deletions
t2_out.txt
with
11 additions
and
9 deletions
__pycache__/offline.cpython-310.pyc
+
0
−
0
View file @
b1e197dc
No preview for this file type
This diff is collapsed.
Click to expand it.
main.py
+
1
−
1
View file @
b1e197dc
...
...
@@ -55,7 +55,7 @@ def PrintOutput(filename : str, endTime : float, imageTimes : List[float]):
OUTPUT_FILE
.
writelines
(
reduce
(
lambda
x
,
y
:
x
+
"
\n
"
+
f
"
{
str
(
y
)
}
"
,
imageTimes
,
""
))
if
__name__
==
"
__main__
"
:
testcase
=
5
testcase
=
4
parsedIn
=
ParseInput
(
f
"
t
{
testcase
}
_in.txt
"
)
res
=
LP
.
Solve
(
parsedIn
[
0
],
parsedIn
[
1
])
output_file
=
"
t{}_out.txt
"
.
format
(
testcase
)
...
...
This diff is collapsed.
Click to expand it.
offline.py
+
7
−
5
View file @
b1e197dc
...
...
@@ -13,6 +13,7 @@ def Solve(images, blackouts):
for
image
in
range
(
image_count
):
times
.
append
(
endtime
)
endtime
+=
images
[
image
]
print
(
f
"
No blackboxes, easy solving: end time =
{
endtime
}
, startingtimes =
{
times
}
.
"
)
return
(
endtime
,
times
)
whitebox_count
=
blackout_count
+
1
...
...
@@ -41,6 +42,7 @@ def Solve(images, blackouts):
"""
CONSTRAINTS
"""
# (1) minimize makespan
model
.
setObjective
(
ms
,
GRB
.
MINIMIZE
)
# (3) make sure the starttime and endtime are exactly image size apart
model
.
addConstrs
((
Tf_j
[
j
]
-
Ts_j
[
j
]
==
js
[
j
]
for
j
in
range
(
image_count
)),
...
...
@@ -58,7 +60,7 @@ def Solve(images, blackouts):
for
t
in
range
(
whitebox_count
)),
name
=
"
Eq(17)
"
)
# Xfree_t should be 0 if there is at least one image being processed in whitebox t
#
(17.2)
Xfree_t should be 0 if there is at least one image being processed in whitebox t
model
.
addConstrs
((
gp
.
quicksum
(
X_j_t
[
j
,
t
]
for
j
in
range
(
image_count
))
*
Xfree_t
[
t
]
==
0
...
...
@@ -76,10 +78,10 @@ def Solve(images, blackouts):
for
j
in
range
(
image_count
))
for
t
in
range
(
whitebox_count
)),
name
=
"
Eq(20)
"
)
# (20.
1
) but is upperbounded by the length of the whitebox
# (20.
2
) but is upperbounded by the length of the whitebox
model
.
addConstrs
((
PV_t
[
t
]
<=
white_boxes
[
t
][
1
]
for
t
in
range
(
whitebox_count
)),
name
=
"
Eq(20.
1
)
"
)
name
=
"
Eq(20.
2
)
"
)
# SOLVE AND PRINT THE RESULTS
model
.
optimize
()
...
...
@@ -94,9 +96,8 @@ def Solve(images, blackouts):
for
(
j
,
t
)
in
X_j_t
:
if
X_j_t
[
j
,
t
].
X
>
0
:
print
(
f
"
(im
{
j
}
,wb
{
t
}
) =
{
X_j_t
[
j
,
t
].
X
}
"
)
print
(
"
All
else
are 0
"
)
print
(
"
All
other X_j_t
are 0
"
)
print
(
'
\n
Finish time: %g
'
%
time
)
print
(
'
Whitebox contains:
'
)
for
t
in
PV_t
:
print
(
f
"
wb
{
t
}
is
{
Xfree_t
[
t
].
X
}
empty and holds length
{
PV_t
[
t
].
X
}
of images
"
)
...
...
@@ -120,6 +121,7 @@ def Solve(images, blackouts):
print
(
f
"
Timers after=
{
timers
}
"
)
print
(
f
"
Starts=
{
starts
}
"
)
print
(
'
Finish time: %g
'
%
time
)
else
:
print
(
'
\n
No solution, Check input or constraints! Reason:
'
)
...
...
This diff is collapsed.
Click to expand it.
t2_out.txt
+
3
−
3
View file @
b1e197dc
6.0
0
1.0
2.0
4.5
6.0
\ No newline at end of file
3.0
4.5
\ No newline at end of file
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