TurkHITController implements HITController { static int getAdaptiveTarget(int target, CreateTask nextJob) { int adjusted = (int) Math.round(target * (1 + nextJob.pctOverhead)); adjusted = Math.max(adjusted, target + nextJob.minOverhead); adjusted = Math.min(adjusted, target + nextJob.maxOverhead); return adjusted; } @Inject  TurkHITController(
			RequesterServiceExt req, 
			ExperimentDataTracker tracker
			); @Override void setHITType(
			String title, 
			String description,
			String keywords,
			double reward,
			long assignmentDurationInSeconds,
			long autoApprovalDelayInSeconds,			
			QualificationRequirement[] qualRequirements); @Override void setExternalParams(String url, int frameHeight, int lifetime); @Override void postBatchHITs(int target, int minOverhead, int maxOverhead, int minDelay, int maxDelay, double pctOverhead); @Override void disableAndShutdown(); @Override void run(); @Override void disableHIT(String hitId); Integer disableUnassignedAndRemoveFromDB(); int disableUnusedFromDB(); double reviewAndPayWorkers(PaymentPolicy policy); int checkAndDispose();  }
@Test public void testAdaptiveMath() { int num = 400; int min = 10; int max = 50; double overhead = 0.15; CreateTask someTask = new CreateTask(num, min, max, 0, 0, overhead); for( int i = 0; i <= 400; i++ ) { int target = TurkHITController.getAdaptiveTarget(i, someTask); assertTrue(target >= i + min); assertTrue(target <= i + max); assertTrue(target == i + min || target == i + max || target == (int) Math.round(i * (1+overhead) ) ); } }