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
7f3d6101
Commit
7f3d6101
authored
Apr 01, 2019
by
Vladislav Kiselev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Переделаны окна погоды и конфликтующте операции. Добавлена оптимизация.
parent
2e554245
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
27 deletions
+132
-27
src/constraints/conversion_2.mzn
src/constraints/conversion_2.mzn
+98
-15
src/inport/ConversionUtil.java
src/inport/ConversionUtil.java
+34
-12
No files found.
src/constraints/conversion_2.mzn
View file @
7f3d6101
This diff is collapsed.
Click to expand it.
src/inport/ConversionUtil.java
View file @
7f3d6101
...
...
@@ -510,6 +510,28 @@ public class ConversionUtil {
writer
.
write
(
"\n"
);
}
/* Окна погоды. Новый формат. */
private
void
weatherWindowsNewFormat
()
throws
IOException
{
ArrayList
<
ArrayList
<
Boolean
>>
badWeather
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
operationTemplates
.
size
();
i
++)
{
ArrayList
<
Boolean
>
curLine
=
new
ArrayList
<>();
for
(
int
j
=
0
;
j
<
n_intervals
;
j
++)
{
curLine
.
add
(
false
);
}
operationTemplates
.
get
(
i
).
getTimeWindows
().
forEach
(
(
Double
start
,
Double
duration
)
->
{
for
(
int
j
=
(
int
)
Math
.
floor
(
start
);
j
<
(
int
)
Math
.
ceil
(
start
+
duration
);
j
++)
{
curLine
.
set
(
j
,
true
);
}
}
);
badWeather
.
add
(
curLine
);
}
locWrite2DArray
(
writer
,
"bad_weather"
,
badWeather
,
Objects:
:
toString
);
}
/* Непрерывность перемещения и швартовки. */
private
void
operationsContinuity
()
throws
IOException
{
ArrayList
<
Integer
>
operationsDuration
=
integerArray
(
operationTemplates
.
size
(),
0
);
...
...
@@ -994,18 +1016,21 @@ public class ConversionUtil {
}
private
void
conflictingOperationsOnStorageAndOnTypeOnMainObject
()
throws
IOException
{
ArrayList
<
Pair
<
Integer
,
Integer
>>
conflictingPairs
=
new
ArrayList
<>();
ArrayList
<
Set
<
Integer
>>
conflictingOperationsG
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
operationTemplates
.
size
();
i
++)
{
for
(
int
j
=
i
+
1
;
j
<
operationTemplates
.
size
();
j
++)
{
conflictingOperationsG
.
add
(
new
TreeSet
<>());
for
(
int
j
=
0
;
j
<
operationTemplates
.
size
();
j
++)
{
if
(
i
==
j
)
{
continue
;
}
if
((
operationTemplates
.
get
(
i
)
instanceof
LoadingTemplate
)
&&
(
operationTemplates
.
get
(
j
)
instanceof
LoadingTemplate
))
{
LoadingTemplate
op1
=
(
LoadingTemplate
)
operationTemplates
.
get
(
i
);
LoadingTemplate
op2
=
(
LoadingTemplate
)
operationTemplates
.
get
(
j
);
if
((
op1
.
getLoader
()
==
op2
.
getLoader
())
&&
(
op1
.
getStorage
()
==
op2
.
getStorage
())
&&
if
((
op1
.
getStorage
()
==
op2
.
getStorage
())
&&
(
op1
.
getStartLocation
()
==
op2
.
getStartLocation
()))
{
conflicting
Pairs
.
add
(
new
Pair
<>(
i
+
1
,
j
+
1
)
);
conflicting
OperationsG
.
get
(
i
).
add
(
j
+
1
);
}
}
{
// Взаимоисключение операций перемещения и грузообработки с общим деятелем.
...
...
@@ -1020,7 +1045,7 @@ public class ConversionUtil {
if
(((
t1
instanceof
MovingTemplate
)
||
(
t1
instanceof
MooringTemplate
))
&&
(
t2
instanceof
LoadingTemplate
))
{
if
(
getExecutor
(
t1
)
==
getExecutor
(
t2
))
{
conflicting
Pairs
.
add
(
new
Pair
<>(
i
+
1
,
j
+
1
)
);
conflicting
OperationsG
.
get
(
i
).
add
(
j
+
1
);
}
}
}
...
...
@@ -1032,16 +1057,13 @@ public class ConversionUtil {
MooringTemplate
op2
=
(
MooringTemplate
)
operationTemplates
.
get
(
j
);
if
(
op1
.
getStartLocation
()
==
op2
.
getStartLocation
())
{
conflicting
Pairs
.
add
(
new
Pair
<>(
i
+
1
,
j
+
1
)
);
conflicting
OperationsG
.
get
(
i
).
add
(
j
+
1
);
}
}
}
}
}
writer
.
write
(
"n_conflicting_op = "
+
conflictingPairs
.
size
()
+
";\n"
);
writeArray
(
writer
,
"confl_op_1"
,
conflictingPairs
,
Pair:
:
getKey
);
writeArray
(
writer
,
"confl_op_2"
,
conflictingPairs
,
Pair:
:
getValue
);
writer
.
write
(
"\n"
);
writeArray
(
writer
,
"conflicting_operations"
,
conflictingOperationsG
,
ConversionUtil:
:
setToString
);
}
private
void
typifiedResourcesDefinition
()
throws
IOException
{
...
...
@@ -1131,7 +1153,7 @@ public class ConversionUtil {
movingObjectLocationDefinition
();
initialLocations
();
finalLocations
();
weatherWindows
();
weatherWindows
NewFormat
();
conflictingOperationsOnStorageAndOnTypeOnMainObject
();
operationsContinuity
();
...
...
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