From 8cfb2b416d7b79cc38dc50f1f16658deaf0b8470 Mon Sep 17 00:00:00 2001
From: Pedro Gonnet <gonnet@google.com>
Date: Thu, 3 Dec 2015 21:05:58 +0100
Subject: [PATCH] fix union.

---
 src/queue.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/queue.c b/src/queue.c
index a5f7488..191500f 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -98,7 +98,7 @@ float queue_task_overlap ( struct qsched *s , qsched_task_t a , qsched_task_t b
   
   /* Return the Jaccard similarity, i.e. the ratio of the intersection
      and the union. */
-  return ((float)res_isect) / res_union;
+  return ((float)res_isect) / (res_union - res_isect);
 }
 
 
@@ -159,6 +159,7 @@ int queue_get ( struct queue *q , struct qsched *s , int insist , int last ) {
         if (qsched_locktask(s, window[ind_max].tid)) {
           tid = window[ind_max].tid;
           ind = window[ind_max].ind;
+          // message("best task has overlap %f.", window[ind_max].score);
           break;
         } else {
           window[ind_max].ind = k;
@@ -177,6 +178,7 @@ int queue_get ( struct queue *q , struct qsched *s , int insist , int last ) {
         if (qsched_locktask(s, window[ind_max].tid)) {
           tid = window[ind_max].tid;
           ind = window[ind_max].ind;
+          // message("best task has overlap %f.", window[ind_max].score);
           break;
         } else {
           window_count -= 1;
-- 
GitLab