Skip to content
Snippets Groups Projects

Utility message chooser

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 207 public Collection<Tuple<Message, Connection>> findOtherMessages(
    208 Collection<Message> messages, List<Connection> connections) {
    209 Collection<Tuple<Message, Connection>> chosenMessages = new ArrayList<>();
    210
    211 // Add ordinary messages.
    212 for (Connection con : connections) {
    213 DTNHost neighbor = con.getOtherNode(this.attachedHost);
    214 for (Message m : messages) {
    215 if (!m.isFinalRecipient(neighbor) && this.shouldBeSent(m, neighbor)) {
    216 chosenMessages.add(new Tuple<>(m, con));
    217 }
    218 }
    219 }
    220
    221 // Wrap useful data stored at host in data messages to neighbors and add them to the messages to sent.
    222 chosenMessages.addAll(DatabaseApplicationUtil.createDataMessages(
    • Author Contributor

      Surprising to find this message creation in a "find" method. I would rename this, add the documentation in the javadoc and/or split this methods into two methods

    • Author Contributor

      It's finding the data, then creating the messages for it. Maybe createDataMessages is just not a good name, ran into issues with it in a review before...

    • Author Contributor

      Maybe "select" or "choose". And instead of "other" you could be more specific (e.g. non-direct).

      Also in the simulator data messages are not chosen but generated, so they might even be moved out of the Choosing strategy. Adding it to the collection of messages to be sent could simply be done in the DisasterRouter after getting the result of the choosing strategy.

    • Author Contributor

      We adopted the name with "other" from other routing protocols already implemented in the ONE. So leaving it as it is is more consistent, but confusing. :/ I guess I'll just change it.

      As finding the data includes a choosing, I think the data messages are correct in the message chooser.

    • Please register or sign in to reply
  • Ghost User @ghost started a thread on the diff
  • 612
    613 // Prepare message with medium replications density.
    614 Message popularMessage = new Message(h1, h6, "M1", 0);
    615 h1.createNewMessage(popularMessage);
    616 h0.createNewMessage(popularMessage);
    617 h1.connect(h0);
    618 h1.connect(h5);
    619 this.clock.advance(DisasterRouterTestUtils.RD_WINDOW_LENGTH);
    620 disconnect(h1);
    621 this.updateAllNodes();
    622
    623 // Check that we only send to the neighbor with high encounter value AND high power.
    624 this.mc.reset();
    625 h1.connect(h2);
    626 this.updateAllNodes();
    627 Assert.assertFalse("Should not send to social neighbor with low power value.", this.mc.next());
  • Author Contributor

    Why don't you create release branches for the versions to be simulated? Then the version with the UtilityChooser can already go into master and you have a clearly specified version you use for the simulation. This would also be helpful when going back later for further simulation runs of a configuration/routing version

  • Author Contributor

    @robinopp Have you reviewed this? If yes: Could you assign yourself and remove the needs review label? Thanks.

  • Ghost User assigned to @robinopp

    assigned to @robinopp

  • Author Contributor

    I have reviewed it, but I don't know if it would be better if someone with more knowledge about the simulator reviews it as well. Also I still have to take a closer look on the tests

  • Ghost User added 1 commit

    added 1 commit

    Compare with previous version

  • removed Needs Changes label

  • 519 }
    520
    521 /**
    522 * Checks the provided message-connection tuple list for the existence of a tuple mapping a message with the
    523 * provided ID to a connection where the host which is not {@link #attachedHost} is the provided host.
    524 *
    525 * @param messages List to check.
    526 * @param id Message ID to look for.
    527 * @param host Host to look for.
    528 * @return True if such a message can be found.
    529 */
    530 private boolean messageToHostsExists(Collection<Tuple<Message, Connection>> messages, String id, DTNHost host) {
    531 boolean messageFound = false;
    532 for (Tuple<Message, Connection> tuple : messages) {
    533 if (tuple.getKey().getId().equals(id) && tuple.getValue().getOtherNode(this.attachedHost).equals(host)) {
    534 messageFound = true;
  • removed Needs Review label

  • Ghost User added 1 commit

    added 1 commit

    Compare with previous version

  • Ghost User added 1 commit

    added 1 commit

    Compare with previous version

  • 15 15 ReplicationsDensity.windowLength = 120
    16 16
    17 17 # Parameters for message choosing
    18 # ! TODO: Uncommented this once message choosing is implemented !
    19 # UtilityMessageChooser.dpWeight = 0.95
    20 # UtilityMessageChooser.powerWeight = 0.05
    21 # UtilityMessageChooser.prophetPlusWeight = 0.65
    22 # UtilityMessageChooser.rdWeight = 0.25
  • 234 private double computeUtility(Message m, DisasterRouter otherRouter) {
    235 return this.deliveryPredictabilityWeight * otherRouter.getDeliveryPredictability(m)
    236 + this.powerWeight * otherRouter.remainingEnergyRatio()
    237 + this.replicationsDensityWeight * (1 - this.attachedRouter.getReplicationsDensity(m))
    238 + this.encounterValueWeight * this.attachedRouter.computeEncounterValueRatio(otherRouter);
    239 }
    240
    241 /**
    242 * Determines whether the provided message should be sent to the provided host right now.
    243 * This is only the case if the host is not transferring, does not know the message yet, and the message - host
    244 * pair's utility is sufficiently high.
    245 * @param m Message to check.
    246 * @param otherHost Host to check.
    247 * @return True iff the message should be sent.
    248 */
    249 private boolean shouldBeSent(Message m, DTNHost otherHost) {
    • Author Contributor

      Can we currently only simulate all hosts with DisasterRouter or none? Because it doesn't seem to mix with other routing.

    • Author Contributor

      Yes. A DisasterRouter cannot function if the other host doesn't know things like its delivery predictabilities or its encounter value. Such an assumption (all routers have the same time) is used several times in the ONE already, e.g. in the different MaxProp and Prophet routers.

    • Please register or sign in to reply
  • 448 470 */
    449 471 public void testNonDirectMessageSorting() {
    450 472 // Create messages to sort.
    451 DisasterData data = new DisasterData(DisasterData.DataType.MARKER, 0, 0, new Coord(0, 0));
    452 Message vipDataMessages = new DataMessage(h1, h3, "D1", data, 0, VERY_HIGH_PRIORITY);
    • Author Contributor

      Why was the VIP message removed?

    • Author Contributor

      UpdateAllNodes chooses the data messages according to what is in the database. All those messages are created automatically and get assigned the same priority. I forgot why we were able to put the data messages into the buffer before, but not with the changes, but I do know that there was some problem.

    • Please register or sign in to reply
  • 31 33 public static final int PRIORITY_THRESHOLD = 4;
    32 34 public static final double DP_WEIGHT = 0.8;
    33 35
    36 /* Constants needed for message choosing. */
  • added Needs Changes and removed Needs Review labels

  • added Needs Review and removed Needs Changes labels

  • Ghost User mentioned in merge request !119 (merged)

    mentioned in merge request !119 (merged)

  • Ghost User added 65 commits

    added 65 commits

    • 59c39fcf...663d9a72 - 63 commits from branch master
    • 72cabf02 - Merge remote-tracking branch 'remotes/origin/master' into feature-#354-utility-message-chooser
    • 71d8972c - Merge remote-tracking branch 'remotes/origin/master' into feature-#354-utility-message-chooser

    Compare with previous version

  • Ghost User unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Ghost User changed the description

    changed the description

  • Ghost User added 11 commits

    added 11 commits

    • 71d8972c...5927ad62 - 10 commits from branch master
    • 99142ee0 - Merge remote-tracking branch 'remotes/origin/master' into feature-#354-utility-message-chooser

    Compare with previous version

  • merged

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading