Exemplo n.º 1
0
    rA = Resource(s, 'A', [A, B, C])
    rB = Resource(s, 'B', [D, E, F])
    rmap = dict([(start(t), t.resourceName())
                 for t in s.tasks] + [(end(t), t.resourceName())
                                      for t in s.tasks])

    s.graph.latex(outfile=open('tex/ex/d_precedence_graph.tex', 'w'),
                  width=9,
                  sep=3,
                  resources=rmap)
    s.graph.latex(outfile=open('tex/ex/d_precedence_graph_lb.tex', 'w'),
                  width=9,
                  sep=3,
                  lb=[start(D)],
                  resources=rmap)
    s.graph.latex(outfile=open('tex/ex/d_precedence_graph_ub.tex', 'w'),
                  width=9,
                  sep=3,
                  ub=[end(A)],
                  resources=rmap)
    s.latex(outfile=open('tex/ex/d_scheduling_instance.tex', 'w'),
            precedences=True,
            windows=False)

    ex.writeFile('graph_demo',
                 [['d_scheduling_instance'], ['d_precedence_graph']])
    ex.writeFile('graph_bound_demo', [[
        'd_precedence_graph', 'd_precedence_graph_lb', 'd_precedence_graph_ub'
    ]])
#
Exemplo n.º 2
0
            animated=True,
            mandatory=True,
            profile=[res],
            precedences=False,
            profp=-.000001,
            rows=[[A, F], [E], [B], [C], [D]])

    tt = Timetabling(res)

    s.save()
    while True:
        if not tt.propagate():
            break

        s.latex(outfile,
                animated=True,
                precedences=False,
                pruning=True,
                rows=[[A, F], [E], [B], [C], [D]])
        s.latex(outfile,
                animated=True,
                mandatory=True,
                profile=[res],
                precedences=False,
                profp=-.000001,
                rows=[[A, F], [E], [B], [C], [D]])

        s.save()

    ex.writeFile('timetabling_demo', 'd_timetabling', scale=.3)
Exemplo n.º 3
0
    resA = Resource(s, 'A', [A, B, C])
    resB = Resource(s, 'B', [D, E, F])
    resC = Resource(s, 'C', [G, H, I])

    span = 25

    s.setMakespanUB(span)

    # rows = s.rowsFromPaths()
    rows = [[A], [B], [C], [D], [E], [F], [G], [H], [I]]

    random.seed(12345)
    bnb = BranchAndBound(s)

    printsched = lambda x: s.latex(outfile=outfile,
                                   ub=True,
                                   lb=True,
                                   animated=True,
                                   windows=False,
                                   rows=rows,
                                   width=span,
                                   horizon=span,
                                   decisions=[(d.tasks[int(d.value())], d.
                                               tasks[1 - int(d.value())])
                                              for d in x.decisions])
    bnb.search(limit=None,
               executeOnNode=printsched,
               executeOnSolution=printsched)

    ex.writeFile('branchandbound_demo', 'd_branchandbound_trace')
Exemplo n.º 4
0
    s.latex(outfile, animated=True, windows=False)

    A << B
    E << C
    E << A
    C << F

    s.latex(outfile, animated=True, windows=False)
    s.latex(outfile,
            animated=True,
            windows=True,
            precedences=False,
            rows=[[E], [A], [C], [B], [F], [D]],
            shifts=([''] * 5 + ['Left']))

    b1 = Resource(s, 'A', capacity=6, init=[B, F])
    b2 = Resource(s, 'B', capacity=6, init=[A, C, D, E])

    s.latex(outfile, animated=True, windows=False)

    s.setDemand(A, 3)
    s.setDemand(B, 4)
    s.setDemand(C, 3)
    s.setDemand(D, 2)
    s.setDemand(E, 1)
    s.setDemand(F, 1)

    s.latex(outfile, animated=True, windows=False)

    ex.writeFile('basic_demo', 'd_basic', scale=.5)
Exemplo n.º 5
0
from PySched import *
import PySched.examples as ex
                
if __name__ == '__main__':
    outfile = open('tex/ex/d_edgefinding.tex', 'w')
    
    s = Schedule()
    
    A = Task(s,duration=4,release=0,duedate=25,label='A')
    B = Task(s,duration=3,release=1,duedate=9,label='B')
    C = Task(s,duration=3,release=1,duedate=9,label='C')
    D = Task(s,duration=5,release=7,duedate=14,label='D')
    
    
    res = Resource(s, 'A', [A,B,C,D])
    ef = EdgeFinding(res)
    
    s.latex(outfile, animated=True)
    
    while True:
        
        s.save()
        
        if not ef.propagate():
            break

        s.latex(outfile, animated=True, precedences=True, windows=True, rows=[[A],[B],[C],[D]], pruning=True, decisions=False)

    ex.writeFile('edgefinding_demo', 'd_edgefinding', scale=.45)
Exemplo n.º 6
0
    Resource(s, name='C', init=example)

    treefile = open('tex/ex/d_theta_tree.tex', 'w')
    schedfile = open('tex/ex/d_theta.tex', 'w')

    s.latex(schedfile, animated=True, rows=[[t] for t in example])

    tt = theta.ThetaTree(example)

    s.latex(schedfile, animated=True, rows=[[t] for t in tt.tasks])
    s.latex(schedfile,
            animated=True,
            rows=[[t] for t in tt.tasks],
            tasks=[],
            stop='-')

    for i, t in enumerate(sorted_example):
        t.rank = i

    for i, t in enumerate(sorted_example):
        schedfile.write('\\uncover<%i->{' % (i + 3))
        schedfile.write(t.strInterval(row=t.rank, mode='Left'))
        schedfile.write('}\n')

    tt.exec2latex(example, output=treefile)

    ex.writeFile('thetatree_demo', ['d_theta', 'd_theta_tree'],
                 headers=['colorschedfigure', 'downthreelvltree'],
                 scale=.45)