Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Conversion
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Vladislav Kiselev
Conversion
Commits
b50e372f
Commit
b50e372f
authored
Nov 13, 2018
by
Vladislav Kiselev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Окна непогоды и тест на них
parent
b5d74a62
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
3 deletions
+82
-3
src/inport/ConversionUtil.java
src/inport/ConversionUtil.java
+23
-3
test/conversion_0.mzn
test/conversion_0.mzn
+10
-0
test/shortest_path_with_weather.ipp
test/shortest_path_with_weather.ipp
+49
-0
No files found.
src/inport/ConversionUtil.java
View file @
b50e372f
...
...
@@ -193,7 +193,7 @@ public class ConversionUtil {
Function
<
MovingObject
,
Integer
>
mObjToN
=
(
MovingObject
obj
)
->
mObjNumberById
.
get
(
obj
.
getId
());
ArrayList
<
OperationTemplate
>
operationTemplates
=
new
ArrayList
<>(
task
.
getTemplates
());
{
{
// Операции прибытия/отбытия в локацию.
ArrayList
<
ArrayList
<
ArrayList
<
Integer
>>>
arrivalOp
=
new
ArrayList
<>();
ArrayList
<
ArrayList
<
ArrayList
<
Integer
>>>
departureOp
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
movingObjects
.
size
();
i
++)
{
...
...
@@ -231,10 +231,29 @@ public class ConversionUtil {
initialStates
.
set
(
mObjToN
.
apply
(
state
.
getVessel
()),
locationNumberById
.
get
(
new
Pair
<>(
state
.
getLocation
().
getId
(),
false
)));
}
writeArray
(
writer
,
"initial_m_obj_loc"
,
initialStates
,
(
Integer
p
)
->
p
+
1
);
writer
.
write
(
"\n"
);
}
// TODO окна погоды.
{
// Окна погоды.
ArrayList
<
Integer
>
bw_op
=
new
ArrayList
<>();
ArrayList
<
Integer
>
bw_start
=
new
ArrayList
<>();
ArrayList
<
Integer
>
bw_fin
=
new
ArrayList
<>();
writer
.
write
(
"\n"
);
for
(
int
i
=
0
;
i
<
operationTemplates
.
size
();
i
++)
{
final
int
id
=
i
;
operationTemplates
.
get
(
i
).
getTimeWindows
().
forEach
(
(
Double
start
,
Double
duration
)
->
{
bw_op
.
add
(
id
+
1
);
bw_start
.
add
((
int
)
Math
.
ceil
(
start
));
bw_fin
.
add
((
int
)
Math
.
floor
(
start
+
duration
));
}
);
}
writer
.
write
(
"n_bad_weather_windows = "
+
bw_op
.
size
()
+
";\n"
);
writeArray
(
writer
,
"bw_op"
,
bw_op
);
writeArray
(
writer
,
"bw_start"
,
bw_start
);
writeArray
(
writer
,
"bw_fin"
,
bw_fin
);
writer
.
write
(
"\n"
);
}
{
// Непрерывность перемещения.
ArrayList
<
Integer
>
operationsDuration
=
integerArray
(
operationTemplates
.
size
(),
0
);
ArrayList
<
Boolean
>
isMovingObj
=
new
ArrayList
<>();
...
...
@@ -260,6 +279,7 @@ public class ConversionUtil {
writeArray
(
writer
,
"final_m_obj_loc"
,
finalStates
,
(
Integer
p
)
->
p
+
1
);
}
{
// Наличие всех ресурсов на месте.
// TODO покрывается "Конфликтующими операциями".
ArrayList
<
Set
<
Integer
>>
operationsResources
=
new
ArrayList
<>();
ArrayList
<
Integer
>
operationsStartLoc
=
integerArray
(
operationTemplates
.
size
(),
0
);
for
(
int
i
=
0
;
i
<
operationTemplates
.
size
();
i
++)
{
...
...
test/conversion_0.mzn
View file @
b50e372f
...
...
@@ -108,6 +108,16 @@ constraint forall (t in 0..(n_intervals + 1), i in 1..n_conflicting_op) (
(
op_status
[
confl_op_2
[
i
],
t
]
->
not
op_status
[
confl_op_1
[
i
],
t
])
);
% Окна непогоды.
int
:
n_bad_weather_windows
;
array
[
1
..
n_bad_weather_windows
]
of
1
..
n_operations
:
bw_op
;
array
[
1
..
n_bad_weather_windows
]
of
0
..
(
n_intervals
+
1
)
:
bw_start
;
array
[
1
..
n_bad_weather_windows
]
of
0
..
(
n_intervals
+
1
)
:
bw_fin
;
% Включительно.
constraint
forall
(
i
in
1
..
n_bad_weather_windows
)
(
forall
(
t
in
bw_start
[
i
]
..
bw_fin
[
i
])
(
op_status
[
bw_op
[
i
],
t
]
==
0
)
);
% Критерий оптимизации
array
[
0
..
(
n_intervals
+
1
)]
of
var
bool
:
is_not_terminated
;
constraint
(
is_not_terminated
[
0
]
==
0
/\
is_not_terminated
[
n_intervals
+
1
]
==
0
);
...
...
test/shortest_path_with_weather.ipp
0 → 100644
View file @
b50e372f
Cargoes
0; Груз1
Berths
1;Raid
2;Pier 1
3;Pier 2
4;Pier 3
5;Pier 4
6;Pier 5
7;Pier 6
Storages
Bunkers
Tows
Loading Equipments
Transport Ships
11;Ship 1;0.0
12;Ship 2;0.0
Templates
101;mov;[]; 11;1;4;[];3.0
102;mov;[]; 11;1;2;[];4.0
103;mov;[]; 11;1;5;[];10.0
104;mov;[5:1];11;2;3;[];9.0
105;mov;[]; 11;3;1;[];5.0
106;mov;[4:2];11;4;6;[];2.0
107;mov;[]; 11;5;6;[];1.0
108;mov;[]; 11;6;3;[];7.0
109;mov;[]; 11;6;7;[];5.0
110;mov;[]; 11;7;3;[];3.0
Cargo Flows
Initial Vessel State
11;1
12;1
Initial Storage State
0;11;0.0
0;12;0.0
Final Vessel State
11;3
12;1
Final Storage State
0;11;0.0
0;12;0.0
Task Properties
30.0;0
Solution
15.0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment