Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
vadere
vadere
Commits
b2d5edf1
Commit
b2d5edf1
authored
Feb 24, 2020
by
Benedikt Kleinmeier
Browse files
Merge branch 'add_progress_for_potential_field_distances_brute_force'
parents
eeba22e8
5e913979
Pipeline
#217544
passed with stages
in 150 minutes and 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/models/potential/fields/PotentialFieldDistancesBruteForce.java
View file @
b2d5edf1
...
...
@@ -18,6 +18,8 @@ import org.vadere.util.logging.Logger;
import
java.awt.*
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author Benedikt Zoennchen
...
...
@@ -78,11 +80,37 @@ public class PotentialFieldDistancesBruteForce implements IPotentialField {
if
(!
isInitialized
){
long
ms
=
System
.
currentTimeMillis
();
this
.
cellGrid
.
pointStream
().
forEach
(
p
->
computeDistanceToGridPoint
(
p
));
List
<
Point
>
points
=
this
.
cellGrid
.
pointStream
().
collect
(
Collectors
.
toList
());
int
totalPoints
=
points
.
size
();
int
processedPoints
=
0
;
double
checkpointInPercentage
=
0.0
;
for
(
Point
point
:
points
)
{
checkpointInPercentage
=
printProgressIfCheckpointReached
(
processedPoints
,
totalPoints
,
checkpointInPercentage
);
computeDistanceToGridPoint
(
point
);
processedPoints
++;
}
logger
.
info
(
"floor field initialization time:"
+
(
System
.
currentTimeMillis
()
-
ms
+
"[ms]"
));
}
}
private
double
printProgressIfCheckpointReached
(
int
processedPoints
,
int
totalPoints
,
double
checkpointInPercentage
)
{
double
newCheckpoint
=
checkpointInPercentage
;
double
progressInPercentage
=
((
double
)
processedPoints
/
totalPoints
)
*
100
;
if
(
progressInPercentage
>=
checkpointInPercentage
)
{
logger
.
info
(
String
.
format
(
"Progress: %2.0f%% -> %d/%d [points]"
,
progressInPercentage
,
processedPoints
,
totalPoints
));
double
stepSize
=
10.0
;
newCheckpoint
+=
stepSize
;
}
return
newCheckpoint
;
}
private
void
computeDistanceToGridPoint
(
@NotNull
final
Point
gridPoint
)
{
VPoint
point
=
cellGrid
.
pointToCoord
(
gridPoint
);
double
distance
=
obstacles
.
stream
().
map
(
shape
->
shape
.
distance
(
point
)).
min
(
Double:
:
compareTo
).
orElse
(
Double
.
MAX_VALUE
);
...
...
VadereUtils/src/org/vadere/util/config/VadereConfig.java
View file @
b2d5edf1
...
...
@@ -48,7 +48,8 @@ public class VadereConfig {
private
static
final
String
DEFAULT_CONFIG_DIR
=
".config"
;
// Both variables must not be "final" so that we are able
// to inject another config file from CLI argument "--config-file myconfig.conf".
// to inject another config file from CLI argument "--config-file myconfig.conf"
// via static method "setConfigPath()".
private
static
String
CONFIG_FILENAME
=
"vadere.conf"
;
private
static
Path
CONFIG_PATH
=
Path
.
of
(
DEFAULT_HOME_DIR
,
DEFAULT_CONFIG_DIR
,
CONFIG_FILENAME
);
...
...
@@ -208,7 +209,7 @@ public class VadereConfig {
CONFIG_FILENAME
=
CONFIG_PATH
.
getFileName
().
toString
();
}
// Static
s
etters
// Static
g
etters
/**
* Use Apache Common Configuration API on the returned object to retrieve Vadere's config
...
...
Write
Preview
Supports
Markdown
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