title: Resource with schedules allocation problem
body: <p>I have a similar to <a href="https://stackoverflow.com/questions/32828059/resource-allocation-algorithm">this</a> task but with some differencies in bold. That is:</p>
  <ul>
  <li>I have a set of J jobs that need to be completed. Jobs are organized into set of directed graphs. Each job can have one or more preceding(parent) jobs that have to be completed before it starts</li>
  <li>All jobs take different times to complete, but the time is known</li>
  <li>I have a set of R human resources. <strong>Important!!! Each resource has a schedule</strong> when this resource is available</li>
  <li>Some jobs <strong>can be preempted</strong> once started. E.g. if a resource is not available at some specific hours then it can process the job after</li>
  <li>A job may has a <strong>predefined amount of resource which can be changed</strong>. If algorithm can't find desired decision (all jobs couldn't be finished at some known date) then we can increase/decrease resources amount. The duration of a job changes proportionally with amount. E.g. J1 require 1 human resource initially and estimated duration 1 hour. If we set 2 human resource than duration decreases to 0.5 hour</li>
  <li>Resources have parameters that match tasks. E.g. If J1 has constraints {A,B} then we can assign resource R1 with permissions {A,B} which satisfied these constraints. If there is no appropriate resources then we can assign any of available.</li>
  </ul>
  <p><strong>My Goal:</strong> Assign as much appropriate resources as possible so that the job would finish at the time.</p>
  <p><em>Is there a way to solve this problem via simplex method? How equatinons would look like. What will be a complexity? Could you please help me to build a math model or share some links. Any help would be appreciate. I can't get close to resource schedules without brute permutation.</em></p>
  <p>I've tried to implement something similar to greedy algorithm:</p>
  <ul>
  <li><p>Firstly I sheduled tasks from job start date without resources calendars considering only relations between tasks (I calculated order for each task which is in chain. Where order 0 - the earliest predecessor)
  E.g.  In chain J1 -&gt; J2 -&gt; J3 J3 must be done after finishing J1 and J2. J1.Order = 0, J2.Order = 1, J3.Order = 3.</p>
  </li>
  <li><p>Then I sorted tasks by order and operations count in chain. First goes the task with higher count of children. Then I sorted by count of required resources. And finally by initial duration of a task</p>
  </li>
  <li><p>For each order I take a task and assign resources with satisfied skills and can do  the task then earlier then better considering their calendars and buisiness into another job</p>
  </li>
  </ul>
  <p>This algorithm doesn't take into account predefined job finish date. I'm worried that it's far away from optimal solution and another approach is needed.
  The greedy algorithm with a proof of correctness would also make the deal for me.</p>