Exemplo n.º 1
0
  @Override
  protected void PoorGaveMiddle(DreamTaskRecord taskRecord, int change) {
    taskRecord.setReductionStep(Math.max(taskRecord.getAdditionStep(), change));
    taskRecord.setAdditionStep(Math.max(taskRecord.getAdditionStep(), change));

    //        taskRecord.setAdditionStep(change);
  }
Exemplo n.º 2
0
 @Override
 protected void PoorGotPoor(DreamTaskRecord taskRecord, int change) {
   //        if (taskRecord.notUsingAll()) {
   //            taskRecord.setAdditionStep(Math.max(taskRecord.getAdditionStep(), change));
   //        } else {
   taskRecord.setAdditionStep(
       taskRecord.getAdditionStep() + probAdd * change / taskRecord.getAdditionStep());
   //        }
 }
Exemplo n.º 3
0
 @Override
 protected void RichGotPoor(DreamTaskRecord taskRecord, int change) {
   // this is for new tasks : With 0 outcome they usually have precision 100 then they find out it
   // is 0
   if (taskRecord.getTask().getResourceShare() <= algorithm.getMinResource()) {
     taskRecord.setAdditionStep(getInitAdditionStep(taskRecord));
   } else {
     taskRecord.setAdditionStep(Math.max(taskRecord.getReductionStep(), change)); // conservative
   }
 }
Exemplo n.º 4
0
 @Override
 protected void RichGaveMiddle(DreamTaskRecord taskRecord, int change) {
   taskRecord.setAdditionStep(change / 2);
   taskRecord.setReductionStep(change / 2);
 }
Exemplo n.º 5
0
 private int getInitAdditionStep(DreamTaskRecord taskRecord) {
   int init = 10 * algorithm.getMinResource();
   int maxResource = algorithm.getMaxResource();
   int num = algorithm.getTasks().size();
   return Math.min(init, Math.max(0, maxResource / num - taskRecord.getTask().getResourceShare()));
 }
Exemplo n.º 6
0
 @Override
 protected void MiddleGotPoor(DreamTaskRecord taskRecord, int change) {
   taskRecord.setAdditionStep(Math.max(taskRecord.getReductionStep(), change));
 }
Exemplo n.º 7
0
 @Override
 protected void MiddleGotRich(DreamTaskRecord taskRecord, int change) {
   taskRecord.setReductionStep(taskRecord.getReductionStep() + change);
 }
Exemplo n.º 8
0
 @Override
 protected void MiddleGavePoor(DreamTaskRecord taskRecord, int change) {
   taskRecord.setAdditionStep(taskRecord.getAdditionStep() + change);
 }
Exemplo n.º 9
0
 @Override
 protected void RichGaveRich(DreamTaskRecord taskRecord, int change) {
   taskRecord.setReductionStep(
       taskRecord.getReductionStep() + probAdd * change / taskRecord.getReductionStep());
 }
Exemplo n.º 10
0
 @Override
 protected void PoorGotRich(DreamTaskRecord taskRecord, int change) {
   taskRecord.setReductionStep(change / 2);
 }
Exemplo n.º 11
0
 @Override
 protected void PoorGaveRich(DreamTaskRecord taskRecord, int change) {
   taskRecord.setReductionStep(Math.max(taskRecord.getAdditionStep(), change));
   //        taskRecord.setReductionStep(getInitReductionStep(taskRecord));
 }
Exemplo n.º 12
0
 @Override
 protected void RichGavePoor(DreamTaskRecord taskRecord, int change) {
   taskRecord.setAdditionStep(change / 2);
 }