Skip to content
Snippets Groups Projects
Commit e822da64 authored by Melanie Bruns's avatar Melanie Bruns
Browse files

Merge branch 'master' into feature-#679-add-min-used-memory-to-plot

parents e985c0ae 9e3208cf
No related branches found
No related tags found
1 merge request!160Add minimum used memory across all hosts to plot
Pipeline #
......@@ -35,4 +35,4 @@ DisasterPrioritization.dpWeight = 0.5
# Parameters for buffer management
DisasterBufferComparator.hopThreshold = 6
DisasterBufferComparator.ageThreshold = 300
DisasterBufferComparator.dpWeight = 1
\ No newline at end of file
DisasterBufferComparator.dpWeight = 0.5
\ No newline at end of file
......@@ -20,9 +20,7 @@ import java.util.stream.Collectors;
* Created by melanie on 07.04.17.
*/
public class LocalDatabase {
/** Utility threshold for deletion is computed using (used db percentage)^{THRESHOLD_EXPONENT}.*/
private static final int THRESHOLD_EXPONENT = 21;
private static final int CUBIC = 3;
private static final int METERS_IN_KILOMETER = 1000;
private static final int SECONDS_IN_HOUR = 3600;
......@@ -117,7 +115,7 @@ public class LocalDatabase {
* @return A threshold between 0 and 1 that is 0 for empty memory and 1 for full memory.
*/
private double computeDeletionThreshold() {
return Math.pow(getUsedMemoryPercentage(), THRESHOLD_EXPONENT);
return Math.pow(getUsedMemoryPercentage(), CUBIC);
}
/**
......
......@@ -36,8 +36,8 @@ public class DatabaseStatisticsTest {
private static final double HALF_AN_HOUR_LATER =3600;
/* Used locations for all DB operations. */
private static final Coord CURR_LOCATION = new Coord(3000, 4000);
private static final Coord CLOSE_TO_CURR_LOCATION = new Coord(4000, 4000);
private static final Coord CURR_LOCATION = new Coord(300, 400);
private static final Coord CLOSE_TO_CURR_LOCATION = new Coord(400, 400);
private static final Coord ORIGIN = new Coord(0,0);
/* Sizes for data items */
......
......@@ -27,10 +27,10 @@ import java.util.List;
public class EpidemicRouterTest extends AbstractRouterTest {
private static int TTL = 300;
private static final int NINE_HOURS = 9 * 60 * 60;
private static final int THREE_HOURS = 10_800;
/* Data base item sizes needed for tests. */
private static final int DB_SIZE = 100;
private static final int DB_SIZE = 50;
private static final int SMALL_SIZE_DIFFERENCE = 2;
private static final String EXPECTED_DATA_MESSAGE = "Data message should have been sent.";
......@@ -330,7 +330,7 @@ public class EpidemicRouterTest extends AbstractRouterTest {
assertEquals("Expected other data item to be sent.", data, message.getData().get(0));
// Add another, large one to replace the original object. It is more useful so it stays in the database.
this.clock.advance(NINE_HOURS);
this.clock.advance(THREE_HOURS);
DisasterData newData = new DisasterData(
DisasterData.DataType.SKILL, DB_SIZE - SMALL_SIZE_DIFFERENCE, SimClock.getTime(), h1.getLocation());
this.setUpAsDataCarrier(h1, newData);
......
......@@ -20,7 +20,7 @@ import java.util.List;
* Created by Britta Heymann on 09.04.2017.
*/
public class LocalDatabaseTest {
private static final int DB_SIZE = 1000;
private static final int DB_SIZE = 100;
/* Used locations for all DB operations. */
private static final Coord CURR_LOCATION = new Coord(300, 400);
......
  • Contributor

    SonarQube analysis reported no issues.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment