Ejemplo n.º 1
0
 def test_equal_duration(self):
     initial_jobs = [self.job(1, 2), self.job(1, 1), self.job(1, 3)]
     schedule(initial_jobs)
     self.assertEqual(
         initial_jobs,
         [self.job(1, 3), self.job(1, 2),
          self.job(1, 1)])
Ejemplo n.º 2
0
 def test_equal_priority(self):
     initial_jobs = [self.job(3, 1), self.job(2, 1), self.job(1, 1)]
     schedule(initial_jobs)
     self.assertEqual(
         initial_jobs,
         [self.job(1, 1), self.job(2, 1),
          self.job(3, 1)])
Ejemplo n.º 3
0
def simple_avoid_ob(status):
    left, middle, right = status

    print(middle)

    if middle == 0:
        change_flag_nothing()
        car.back()

        scheduler.schedule('avoid_ob', (80, car.rotate_left),
                           (100, change_flag_return), (1, car.go),
                           (250, car.rotate_right), (160, car.go))
Ejemplo n.º 4
0
def cps_tak (k, x, y, z):
    if y >= x:
        schedule (k, z)
    else:
        def kf2 (v8):
            schedule (k, v8)
        def kf5 (v9):
            def kf4 (v10):
                def kf3 (v11):
                    cps_tak (kf2, v9, v10, v11)
                cps_tak (kf3, z-1, x, y)
            cps_tak (kf4, y-1, z, x)
        cps_tak (kf5, x-1, y, z)
Ejemplo n.º 5
0
 def reschedule(self):
     """
     Reschedule all recordings.
     """
     if self.locked:
         # system busy, call again later
         kaa.OneShotTimer(self.reschedule).start(0.1)
         yield False
     self.locked = True
     # get current time (UTC)
     ctime = int(time.time())
     # remove old recorderings
     self.recordings = filter(lambda r: r.start > ctime - 60 * 60 * 24 * 7, self.recordings)
     # run the scheduler to attach devices to recordings
     yield scheduler.schedule(self.recordings)
     # sort by start time
     self.recordings.sort(lambda l, o: cmp(l.start, o.start))
     # save schedule
     self.save_schedule()
     self.print_schedule()
     # Schedule recordings on recorder for the next SCHEDULE_TIMER seconds.
     log.info("schedule recordings")
     for r in self.recordings:
         if r.start < ctime + SCHEDULE_TIMER and r.status == SCHEDULED:
             r.schedule()
     self.locked = False
     yield True
Ejemplo n.º 6
0
def yang(app):
    t_list = []
    for ti in range(len(app.tasks)):
        response_time = app.tasks[ti].response_time()
        t_list.append(tasks.SporadicTask(response_time, response_time * 1000))
    ts = tasks.TaskSystem(t_list)
    fp.bound_response_times(1, ts)

    resources.initialize_resource_model(ts)
    for ti in range(len(app.tasks)):
        for cs in app.tasks[ti].cs:
            ts[ti].resmodel[cs.resource].add_request(cs.duration)
    for t in ts:
        t.partition = 0
    bounds.assign_fp_preemption_levels(ts)

    r_but = buttazzo(a)

    res = bounds.apply_pip_bounds(ts, 1)
    ret = {}
    for n in range(len(app.tasks) -
                   1):  # the blocking time of last task is always 0
        costH = 0
        for h in range(n):
            costH += ts[h].cost
        y_Bn = res.get_blocking_term(
            n) - costH  #cost of all the processes with higher priority

        if y_Bn > r_but[n][0]:
            feasible = False
        else:
            _, feasible, _ = schedule(app, app.tasks[n], r_but[n][1])
        ret[n] = (y_Bn, feasible)
    return ret
Ejemplo n.º 7
0
def main():
    """
    Create, fill, and output a schedule
    """
    
    fix("availability.csv")
    
#    shifts = gen_shifts(2015,8,5,True)

    if argv[4] == 'True':
        is_dst = True
    if argv[4] == 'False':
        is_dst = False

    shifts = gen_shifts(int(argv[1]),int(argv[2]),int(argv[3]),is_dst)

    observers = init_observers('availability.csv',shifts)

    handoff = handoff_dict('handoff.csv')

    finalize_observers(handoff,observers)

    sch = schedule(shifts,observers,pacific)

    sch.schedule()

    with open('sch.txt','w') as f:

        print >>f, sch.text()

    for shift in sorted(sch.keys()):
        print str(shift), sch[shift].name
Ejemplo n.º 8
0
 def reschedule(self):
     """
     Reschedule all recordings.
     """
     if self.locked:
         # system busy, call again later
         kaa.OneShotTimer(self.reschedule).start(0.1)
         yield False
     self.locked = True
     # get current time (UTC)
     ctime = int(time.time())
     # remove old recorderings
     self.recordings = filter(lambda r: r.start > ctime - 60*60*24*7, self.recordings)
     # run the scheduler to attach devices to recordings
     yield scheduler.schedule(self.recordings)
     # sort by start time
     self.recordings.sort(lambda l, o: cmp(l.start,o.start))
     # save schedule
     self.save_schedule()
     self.print_schedule()
     # Schedule recordings on recorder for the next SCHEDULE_TIMER seconds.
     log.info('schedule recordings')
     for r in self.recordings:
         if r.start < ctime + SCHEDULE_TIMER and r.status == SCHEDULED:
             r.schedule()
     self.locked = False
     yield True
Ejemplo n.º 9
0
def avg_feas_sched(app,res):
    count_feasibles = 0
    for t in res:
        _,feasible,_ = schedule(app,t,res[t][1])
        if feasible:
            count_feasibles += 1
    return count_feasibles/(len(app.tasks)-1)
Ejemplo n.º 10
0
 def test_schedule_advanced(self):
     self.assertEqual([TaskBlock(may10_9, may10_17, task6, 2), 
                       TaskBlock(may6_9, may6_17, task6, 1),
                       TaskBlock(may10_1715, may10_1915, task5, 3),
                       TaskBlock(may6_1715, may6_1915, task5, 2),
                       TaskBlock(may3_715, may3_915, task5, 1)], 
         schedule([task5, task6], [block_may2_12_may3_7], start, end, zero, fifteen))
Ejemplo n.º 11
0
def main():
    meetingscheduler.initialize()
    meetingscheduler.reset(100, 10000)
    start = time.time()
    num = meetingscheduler.schedule(0, "")
    end = time.time()
    print(f"C Extension:\nnum: {num}")
    print(f"runtime: {end - start}")
    scheduler.initialize()
    start = time.time()
    scheduler.schedule(0, "")
    end = time.time()
    print(f"Pure Python:\nnum: {num}")
    print(f"runtime: {end - start}")
    scheduler.finalize()
    meetingscheduler.finalize()
Ejemplo n.º 12
0
def star_schedule(args):
    """
    The target function for pool.map() can only take one argument
    so we make that one argument a tuple of args and expand it with
    this wrapper function
    """
    from scheduler import schedule
    return schedule(*args)
Ejemplo n.º 13
0
def star_schedule(args):
    """
    The target function for pool.map() can only take one argument
    so we make that one argument a tuple of args and expand it with
    this wrapper function
    """
    from scheduler import schedule
    return schedule(*args)
Ejemplo n.º 14
0
def simple_avoid_ob_from_ultrasonic(status):
    print(status)
    global avoid_flag
    if status <= 25 and avoid_flag == 0:
        scheduler.cancel('avoid_ob')
        avoid_flag = 1
        change_flag_nothing()
        car.back()
        print('start avoid')
        # scheduler.schedule('avoid_ob', (10, car.rotate_left),
        #                    (45, car.go),
        #                    (1, change_flag_return),
        #                    (120, car.rotate_right),
        #                    (55, car.go))
        scheduler.schedule('avoid_ob', (10, car.rotate_left_90),
                           (0, set_wheel_to_rotate), (0, car.go),
                           (10, change_flag_return))
Ejemplo n.º 15
0
def cps_tak(k, x, y, z):
    if y >= x:
        schedule(k, z)
    else:

        def kf2(v8):
            schedule(k, v8)

        def kf5(v9):
            def kf4(v10):
                def kf3(v11):
                    cps_tak(kf2, v9, v10, v11)

                cps_tak(kf3, z - 1, x, y)

            cps_tak(kf4, y - 1, z, x)

        cps_tak(kf5, x - 1, y, z)
Ejemplo n.º 16
0
def algorithm_calculation_fun(map_info: MapInfo, step_info: StepInfo,
                              mp_pool: multiprocessing.Pool):
    """
    算法主函数,接收服务器下达的对战信息,返回StepCommand对象的json。
    :param mp_pool:
    :param map_info: 地图信息
    :param step_info: 接收服务器发送的对战信息。
    :return: 计算后返回给服务器的下一步指令信息,即StepCommand的json。
    """
    return schedule(map_info, step_info, mp_pool)
Ejemplo n.º 17
0
 def test_mixed_values_and_duplicates(self):
     initial_jobs = [
         self.job(2, 2),
         self.job(2, 2),
         self.job(1, 5),
         self.job(1, 3),
         self.job(4, 2),
         self.job(4, 1)
     ]
     schedule(initial_jobs)
     print initial_jobs
     self.assertEqual(initial_jobs, [
         self.job(1, 5),
         self.job(1, 3),
         self.job(2, 2),
         self.job(2, 2),
         self.job(4, 2),
         self.job(4, 1)
     ])
Ejemplo n.º 18
0
def runSchedule():
    timeSlice = -1
    schedulingMethod = getSchedulingMethod()
    if schedulingMethod != ("FCFS"):
        timeSlice = getTimeSlice()
    printEachStep = getPrintEachStep()

    scheduler.schedule(schedulingMethod, timeSlice, printEachStep)

    print("\n---------------------------\nFinal:\n" + str(scheduler))
    print("Wait times:\n---------------------------\nTotal wait time: " +
          str(scheduler.totalWaitTime()) + "\nAverage wait time: " +
          str(scheduler.averageWaitTime()) + "\n---------------------------")
    print(
        "Processing times:\n---------------------------\nTotal Processing time: "
        + str(scheduler.totalProcessingTime()) +
        "\nAverage Processing time: " +
        str(scheduler.averageProcessingTime()) +
        "\n---------------------------")
Ejemplo n.º 19
0
def subscribe(schedule_script, scheduled):
    # takes script to schedule as parameter
    # clear previous subscriptions
    # asks user which country to subscribe
    # type of data to subscribe
    # create a file containing subscription details
    # schedule given script
    country = input("Country to subscribe: ")
    menu.clear()
    print("Type of Subscription:")
    print("1. Get status by Country")
    print("2. Difference between Latest state and previous one by country")
    type_subscription = int(input("Choose> "))
    menu.clear()
    subscription_data = {'country': country.lower(), 'type': type_subscription}
    with open(constant.SUBSCRIPTION, 'a') as subscription_file:
        subscription_file.writelines(str(subscription_data) + "\n")
    if (isScheduled(scheduled) == 0):
        scheduler.schedule(schedule_script, scheduled)
Ejemplo n.º 20
0
def cps_tak(k, x, y, z):
    v31 = y
    v32 = x
    v6 = v31 >= v32
    if v6:
        v7 = z
        schedule(k, v7)
    else:

        def kf2(v8):
            schedule(k, v8)

        def kf5(v9):
            def kf4(v10):
                def kf3(v11):
                    v12 = cps_tak
                    v12(kf2, v9, v10, v11)

                v17 = z
                v18 = 1
                v13 = v17 - v18
                v14 = x
                v15 = y
                v16 = cps_tak
                v16(kf3, v13, v14, v15)

            v23 = y
            v24 = 1
            v19 = v23 - v24
            v20 = z
            v21 = x
            v22 = cps_tak
            v22(kf4, v19, v20, v21)

        v29 = x
        v30 = 1
        v25 = v29 - v30
        v26 = y
        v27 = z
        v28 = cps_tak
        v28(kf5, v25, v26, v27)
Ejemplo n.º 21
0
def cps_fib (k, n):
    v17 = n
    v18 = 2
    v4 = v17 < v18
    if v4:
        v5 = n
        schedule (k, v5)
    else:
        def kf3 (v7):
            def kf2 (v8):
                v6 = v7 + v8
                schedule (k, v6)
            v11 = n
            v12 = 2
            v9 = v11 - v12
            v10 = cps_fib
            v10 (kf2, v9)
        v15 = n
        v16 = 1
        v13 = v15 - v16
        v14 = cps_fib
        v14 (kf3, v13)
Ejemplo n.º 22
0
def schedule():
    start = time.time()
    results = {}
    params = request.json
    auth_code = params['auth_code']
    min_delta = 60
    max_total = 100

    token = auth.get_fresh_token(auth_code)
    if not token:
        print 'WARNING: bad auth token', auth_code
        results['status'] = 'error'
        results['message'] = 'not authorized'
    else:
        user = token['user_id']
        pid = params['pid']
        when = params['when']
        delta = params['delta']
        total = params['total']
        ok = True

        print 'delta', delta, 'when', when, 'total', total

        if delta != 0 and delta < min_delta:
            results['status'] = 'error'
            results['message'] = "Too frequent a schedule"
            ok = False

        if total > max_total:
            results['status'] = 'error'
            results['message'] = "Too many runs scheduled"
            ok = False

        if ok:
            if delta > 0 and total > 0:
                if scheduler.schedule(auth_code, user, pid, when, delta,
                                      total):
                    results['status'] = 'ok'
                else:
                    results['status'] = 'error'
                    results['message'] = "Can't schedule that job"
            else:
                if scheduler.cancel(user, pid):
                    results['status'] = 'ok'
                else:
                    results['status'] = 'error'
                    results['message'] = "Can't cancel that job"

    results['time'] = time.time() - start
    return jsonify(results)
Ejemplo n.º 23
0
def schedule():
    start = time.time()
    results = {}
    params = request.json
    auth_code = params["auth_code"]
    min_delta = 60
    max_total = 100

    token = auth.get_fresh_token(auth_code)
    if not token:
        print "WARNING: bad auth token", auth_code
        results["status"] = "error"
        results["message"] = "not authorized"
    else:
        user = token["user_id"]
        pid = params["pid"]
        when = params["when"]
        delta = params["delta"]
        total = params["total"]
        ok = True

        print "delta", delta, "when", when, "total", total

        if delta != 0 and delta < min_delta:
            results["status"] = "error"
            results["message"] = "Too frequent a schedule"
            ok = False

        if total > max_total:
            results["status"] = "error"
            results["message"] = "Too many runs scheduled"
            ok = False

        if ok:
            if delta > 0 and total > 0:
                if scheduler.schedule(auth_code, user, pid, when, delta, total):
                    results["status"] = "ok"
                else:
                    results["status"] = "error"
                    results["message"] = "Can't schedule that job"
            else:
                if scheduler.cancel(user, pid):
                    results["status"] = "ok"
                else:
                    results["status"] = "error"
                    results["message"] = "Can't cancel that job"

    results["time"] = time.time() - start
    return jsonify(results)
Ejemplo n.º 24
0
def schedule():
    start = time.time()
    results = {}
    params = request.json
    auth_code = params['auth_code']
    min_delta = 60
    max_total = 100

    token = auth.get_fresh_token(auth_code)
    if not token:
        print 'WARNING: bad auth token', auth_code
        results['status'] = 'error'
        results['message'] = 'not authorized'
    else:
        user = token['user_id']
        pid = params['pid']
        when = params['when']
        delta = params['delta']
        total = params['total']
        ok = True

        print 'delta', delta, 'when', when, 'total', total

        if delta != 0 and delta < min_delta:
            results['status'] = 'error'
            results['message'] = "Too frequent a schedule"
            ok = False

        if total > max_total:
            results['status'] = 'error'
            results['message'] = "Too many runs scheduled"
            ok = False

        if ok:
            if delta > 0 and total > 0:
                if scheduler.schedule(auth_code, user, pid, when, delta, total):
                    results['status'] = 'ok'
                else:
                    results['status'] = 'error'
                    results['message'] = "Can't schedule that job"
            else:
                if scheduler.cancel(user, pid):
                    results['status'] = 'ok'
                else:
                    results['status'] = 'error'
                    results['message'] = "Can't cancel that job"

    results['time'] = time.time() - start
    return jsonify(results)
Ejemplo n.º 25
0
    def do_POST(self):
        content_length = int(
            self.headers['Content-Length'])  # <--- Gets the size of data
        post_data = self.rfile.read(
            content_length)  # <--- Gets the data itself
        logging.info("POST request,\nPath: %s\nHeaders:\n%s\n\nBody:\n%s\n",
                     str(self.path), str(self.headers),
                     post_data.decode('utf-8'))

        self._set_response()
        self.wfile.write("POST request for {}".format(
            self.path).encode('utf-8'))
        received = post_data.decode('utf-8')

        self._last_request = scheduler.schedule(received)
Ejemplo n.º 26
0
def track_detector_callback(status):
    global avoid_flag
    # plan A
    left, middle, right = status
    global last_rotate
    if track_flag == 1:
        if left == 1:
            last_rotate = 1
            # car.set_global_speed(1)
            car.rotate_left()
        elif right == 1:
            last_rotate = 2
            # car.set_global_speed(1)
            car.rotate_right()
        elif middle == 1:
            if last_rotate == 1:
                scheduler.schedule('buchang', (0, car.rotate_right),
                                   (5, car.go))
            if last_rotate == 2:
                scheduler.schedule('buchang', (0, car.rotate_left),
                                   (5, car.go))

            last_rotate = 0
            car.set_global_speed(10)
            car.go()

    elif track_flag == 3:
        pass
    else:
        if middle == 1:
            scheduler.cancel('avoid_ob')
            avoid_flag = 0
            change_flag_normal()
            recover_wheel_to_normal()
            car.rotate_left()
            print('refind road')
Ejemplo n.º 27
0
def addAssignment():
    events = session['events']
    name = request.form['name']
    deadline = datetime.strptime(request.form['deadline'], '%Y-%m-%dT%H:%M')
    start = datetime.strptime(request.form['start'], '%Y-%m-%dT%H:%M')
    priority = int(request.form['priority'])
    blocks = int(request.form['blocks'])
    hours = int(request.form['hours'])
    start_time = datetime.strptime(str(session['start_day']) + ":00",
                                   '%H:%M').time()
    end_time = datetime.strptime(str(session['end_day']) + ":00",
                                 '%H:%M').time()
    leeway = timedelta(hours=session['finish_hours'])
    breaks = timedelta(minutes=session['break'])

    busy_blocks = populateBusyBlocks()
    task = Task(name, deadline, timedelta(hours=hours), blocks, priority,
                start)

    task_blocks = schedule([task], busy_blocks, start_time, end_time, leeway,
                           breaks)
    new_events = addTaskToEvent(task_blocks, session['events'])
    dates = getStartEndDates()
    new_assign = {
        "name": name,
        "blocks": blocks,
        "priority": priority,
        "deadline": deadline,
        "hours": hours
    }
    assignments.append(new_assign)
    assignment_names.append(name)
    print(assignment_names)
    print(new_assign['name'])
    print(new_assign['name'] in assignment_names)

    session['events'] = new_events
    index = session['index']

    return render_template('index.html',
                           start_hour=session['start_day'],
                           end_hour=session['end_day'],
                           events=new_events,
                           dates=dates,
                           index=index,
                           assignments=assignments,
                           assignment_names=assignment_names)
Ejemplo n.º 28
0
def my_form_post():
    text_list = []
    amount_of_courses = int(request.cookies.get('course_amount'))
    for i in range(1, amount_of_courses + 1):
        form_num = 'text' + str(i)
        text_list.append(request.form[form_num])
    final_list = []
    for text in text_list:
        if not text == "":
            final_list.append(text)
    course_list = ""
    for course in final_list[:-1]:
        course_list += (str(course) + ',')
    course_list += str(final_list[-1])
    course_list = course_list.upper()
    #my_url = '/sched'

    real_course_list = course_list.split(',')
    my_combos = scheduler.schedule(real_course_list)
    resp = make_response(redirect('/sched'))
    resp.set_cookie('course_combos', json.dumps(my_combos))
    return resp
Ejemplo n.º 29
0
def cps_print(k, v):
    print(v)
    schedule(k)
Ejemplo n.º 30
0
 def test_mixed_values_and_duplicates(self):
     initial_jobs = [self.job(2,2), self.job(2,2), self.job(1,5), self.job(1,3), self.job(4,2), self.job(4,1)]
     schedule(initial_jobs)
     print initial_jobs
     self.assertEqual(initial_jobs, [self.job(1,5), self.job(1,3), self.job(2,2), self.job(2,2), self.job(4,2), self.job(4,1)])
Ejemplo n.º 31
0
 def processWeather(self):
     self.w = GetWeather()
     scheduler.schedule(self)
Ejemplo n.º 32
0
 def kf2(v8):
     schedule(k, v8)
Ejemplo n.º 33
0
def on_load(connection):
	# Updates the bot every n seconds
	scheduler.schedule(connection, 21600, auto, once=True) 
Ejemplo n.º 34
0
 def start_schedule(self):
     matrix = self.get_matrix()
     scheduler.schedule(*matrix, cpus=3)
Ejemplo n.º 35
0
def cps_print(k, v):
    print(v)
    schedule(k)
Ejemplo n.º 36
0
def schedule(apps, num_frozen_list, model_desc):
    return scheduler.schedule(apps, num_frozen_list, model_desc)
Ejemplo n.º 37
0
from sys import argv

import scheduler

input_file = argv[1]
output_file = argv[2]

# Read text file
with open(input_file) as f:
    lines = f.readlines()

ints_list = []
for line in lines:
    ints_list.append(map(int, line.split(' ')))

runs = []
for ints in ints_list:
    ps = scheduler.purse(ints)
    runs.append(ps)

scheduling_results = []
for run in runs:
    scheduling_results.append(scheduler.schedule(run))

out_f = open(output_file, 'w')
for turnarounds in scheduling_results:
    scheduler.report(out_f, turnarounds)
    out_f.write('\n')
out_f.close()
Ejemplo n.º 38
0
 def kf2 (v8):
     schedule (k, v8)
Ejemplo n.º 39
0
    47 : [6, 7, 0],
    48 : [7, 0, 1],
    49 : [0, 1, 2],
    50 : [1, 2, 3],
    51 : [2, 3, 4],
    52 : [3, 4, 5],
    53 : [4, 5, 6],
    54 : [5, 6, 7],
    55 : [6, 7, 0],
    56 : [7, 0, 1],
    57 : [0, 1, 2],
    58 : [1, 2, 3],
    59 : [2, 3, 4],
    60 : [3, 4, 5],
    61 : [4, 5, 6],
    62 : [5, 6, 7],
    63 : [6, 7, 0],
    64 : [7, 0, 1],
    65 : [0, 1, 2],
    66 : [1, 2, 3],
    67 : [2, 3, 4]
    }

schedule(SLOTS, CHUNKS)

print("Scheduling the following chunks:\n\n{}\n".format(CHUNKS.keys()))

print("\nLogical block dist:\n")
for key in SLOTS:
  print("SLOT {} -> {}".format(key, list(reversed(SLOTS[key]))))
Ejemplo n.º 40
0
import argparse
import scheduler

parser = argparse.ArgumentParser()
parser.add_argument('caption',
                    type=str,
                    help='Caption the image should be published with.')
parser.add_argument('--path', type=str, help='Path to the image file.')
parser.add_argument('--url', type=str, help='Url to the image file.')
parser.add_argument(
    '--tags',
    type=str,
    help=
    'Append the tags in the settings.json file to the caption. Separated by a comma',
    default='')
args = parser.parse_args()
scheduler.schedule(
    url=f"file:///{args.path}" if args.path is not None else args.url,
    caption=args.caption,
    tags=args.tags)
Ejemplo n.º 41
0
 def kf2 (v8):
     v6 = v7 + v8
     schedule (k, v6)
Ejemplo n.º 42
0
                               (sb.duration * interval)),
                (i * spacing) + (spacing / self.margin) + self.margin)
            rect = Rectangle(bl, ur)
            rect_color = color_rgb(int(255 * sb.execution_speed),
                                   int(255 * (1 - sb.execution_speed)), 0)
            rect.setFill(rect_color)
            rect.draw(self.window)
            l = Line(Point(self.margin, i * spacing + self.margin),
                     Point(self.max_x - 1, i * spacing + self.margin))
            l.draw(self.window)
        x_axis.draw(self.window)
        y_axis.draw(self.window)
        self.window.getMouse()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Simulation of a low power scheduling algorithm.")
    parser.add_argument('filename', type=str, help='Name of input file')
    args = parser.parse_args()
    tasks, num_tasks = load_tasks(args.filename)
    a, b = task_set_interval(tasks)

    s = schedule(tasks)
    for t in s:
        print("Schedule task {0} at time {1:.2f} for {2:.2f}"
              " time units with {3:.2f}% processing speed".format(
                  t.task.name, t.start, t.duration, t.execution_speed * 100))
    plotter = SchedulePlotter(s, num_tasks)
    plotter.draw_schedule()
Ejemplo n.º 43
0
 def test_equal_duration(self):
     initial_jobs = [self.job(1,2), self.job(1,1), self.job(1,3)]
     schedule(initial_jobs)
     self.assertEqual(initial_jobs, [self.job(1,3), self.job(1,2), self.job(1,1)])
Ejemplo n.º 44
0
 def test_equal_priority(self):
     initial_jobs = [self.job(3,1), self.job(2,1), self.job(1,1)]
     schedule(initial_jobs)
     self.assertEqual(initial_jobs, [self.job(1,1), self.job(2,1), self.job(3,1)])
Ejemplo n.º 45
0
    weights = [1.0, 100.0, 300.0, 1.0]

    # TODO need to define which variable is considered ("harvest")
    # and when rx is changed, check the adjacent stands for each time period
    # penalize/avoid if they have overlapping harvests.
    adjacency = [None for x in range(stand_data.shape[0])]
    adjacency[4] = (3, 2, 4)  # avoid cutting stand 4 when 1,2,3 have harvests?

    # restrict managment options for certain stands
    # valid_mgmts = [None for x in range(stand_data.shape[0])]
    # valid_mgmts[0] = (0, 1, 2)
    # valid_mgmts[1] = (0, 1, 2)
    # valid_mgmts[2] = (0, 1, 2)

    best, optimal_stand_rxs = schedule(
        stand_data,
        strategies,
        weights,
        variable_names,
        adjacency,
        valid_mgmts,
        temp_min=.1,
        temp_max=5000.0,
        steps=50000,
        report_interval=10000
    )

    print best
    for osrx in optimal_stand_rxs:
        print axis_map['mgmt'][osrx]