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
3bed9686
Commit
3bed9686
authored
Nov 19, 2018
by
Vladislav Kiselev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug with getCurrentValue fixed
parent
c7a14c43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
src/inport/CargoFlow.java
src/inport/CargoFlow.java
+5
-4
src/inport/ConversionUtil.java
src/inport/ConversionUtil.java
+2
-2
No files found.
src/inport/CargoFlow.java
View file @
3bed9686
...
...
@@ -7,6 +7,7 @@ package inport;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.TreeMap
;
/**
*
...
...
@@ -59,7 +60,7 @@ public class CargoFlow {
public
CargoFlow
(
Storage
storage
,
Cargo
cargo
)
{
this
.
storage
=
storage
;
this
.
cargo
=
cargo
;
this
.
flow
=
new
Hash
Map
<>();
this
.
flow
=
new
Tree
Map
<>();
}
public
double
getCurrentValue
(
double
forTime
)
...
...
@@ -70,7 +71,7 @@ public class CargoFlow {
double
prevKey
=
-
1.0
;
for
(
Double
keyTime
:
keyTimes
)
{
if
(
forTime
>
prevKey
&&
forTime
<
keyTime
)
if
(
forTime
>
=
prevKey
&&
forTime
<
keyTime
)
{
res
=
flow
.
get
(
prevKey
);
isFound
=
true
;
...
...
@@ -78,7 +79,7 @@ public class CargoFlow {
}
else
prevKey
=
keyTime
;
}
if
(!
isFound
&&
forTime
>
prevKey
)
if
(!
isFound
&&
forTime
>=
prevKey
)
res
=
flow
.
get
(
prevKey
);
return
res
;
}
...
...
@@ -123,7 +124,7 @@ public class CargoFlow {
}
public
CargoFlow
(
String
s
,
Map
<
Integer
,
Storage
>
mp
,
Map
<
Integer
,
Cargo
>
cp
)
{
this
.
flow
=
new
Hash
Map
<>();
this
.
flow
=
new
Tree
Map
<>();
String
[]
tokens
=
s
.
split
(
";"
);
int
key
=
Integer
.
parseInt
(
tokens
[
0
].
trim
());
storage
=
mp
.
get
(
key
);
...
...
src/inport/ConversionUtil.java
View file @
3bed9686
...
...
@@ -465,7 +465,7 @@ public class ConversionUtil {
int
storageN
=
storNById
.
get
(
flow
.
getStorage
().
getId
());
int
cargoN
=
cargoNById
.
get
(
flow
.
getCargo
().
getId
());
for
(
int
i
=
1
;
i
<
n_intervals
+
2
;
i
++)
{
cargoFlows
.
get
(
storageN
+
movingObjects
.
size
()).
get
(
i
).
set
(
cargoN
,
(
int
)
flow
.
getCurrentValue
(
i
));
cargoFlows
.
get
(
storageN
+
movingObjects
.
size
()).
get
(
i
).
set
(
cargoN
,
(
int
)
flow
.
getCurrentValue
(
i
-
0.1
));
}
}
writer
.
write
(
"cargo_flows = array3d(1..n_obj_with_storage, 0..(n_intervals + 1), 1..n_cargo_types, ["
);
...
...
@@ -501,7 +501,7 @@ public class ConversionUtil {
LoadingTemplate
op
=
(
LoadingTemplate
)
operationTemplates
.
get
(
i
);
int
storageN
=
storNById
.
get
(
op
.
getStorage
().
getId
());
int
shipN
=
mObjToN
.
apply
(
op
.
getLoader
());
int
cargoN
=
0
;
// TODO в TaskCase пока не реализовано, пересмотреть.
int
cargoN
=
cargoNById
.
get
(
op
.
getStorage
().
getCargo
().
getId
());
// TODO в TaskCase пока не реализовано, пересмотреть.
loadingOpDelta
.
add
(-(
int
)
op
.
getIntensity
());
loadingOpN
.
add
(
i
);
...
...
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