def test_task_dependencies():
    project = sim.Project("Project with task dependencies")

    project.resources([
        sim.Agent("charlie", ["coder", "leader"]),
        sim.Agent("louis", ["sa", "leader"]),
        sim.Agent("wing", ["leader", "coder", "sa"]),
    ])

    project.define([
        sim.Task("t1", 5, ["leader"], blocked_by="t3"),
        sim.Task("t2", 10, ["sa", "leader"]),
        sim.Task("t3", 20, ["coder"]),
    ])

    project.simulate()
    assert project.get_task("t3").completed_by.name == "charlie"
def test_no_capabilities_for_task():
    project = sim.Project("Project we don't have a capability to complete")

    project.resources([
        sim.Agent("charlie", ["coder", "sa"]),
        sim.Agent("louis", ["sa", "leader"]),
        sim.Agent("wing", ["coder", "sa"]),
    ])

    project.define([
        sim.Task("t1", 10, ["sa", "leader"]),
        sim.Task("t2", 20, ["underwater basket weaving"]),
        sim.Task("t3", 5, ["leader"]),
    ])

    project.simulate()
    assert project.get_task("t2").completed_by == None
def test_multi_dependency_task():
    project = sim.Project("Project with multi-dependency task")

    project.resources([
        sim.Agent("charlie", ["coder", "sa"]),
        sim.Agent("louis", ["sa", "leader"]),
        sim.Agent("wing", ["coder", "sa"]),
    ])

    project.define([
        sim.Task("t1", 10, ["sa", "leader"]),
        sim.Task("t2", 20, ["coder"]),
        sim.Task("t3", 5, ["leader"]),
    ])

    project.simulate()
    assert project.get_task("t1").completed_by.name == "louis"
def test_simple_test():
    project = sim.Project("Simple Project")

    project.resources([
        sim.Agent("charlie", ["coder", "sa", "leader"]),
        sim.Agent("louis", []),
        sim.Agent("wing", ["coder", "sa"]),
    ])

    project.define([
        sim.Task("t1", 10, ["sa"]),
        sim.Task("t2", 20, ["coder"]),
        sim.Task("t3", 5, ["leader"]),
    ])

    project.simulate()
    assert project.get_task("t1").completed_by.name == "charlie"
    assert project.get_task("t2").completed_by.name == "wing"
    assert project.get_task("t3").completed_by.name == "charlie"
예제 #5
0
import project_sim as sim

project = sim.Project("System Lifecycle Plan", speed=0.005)


def addSA():
    sa = sim.Agent("ryan", ["leader"])
    project.add_resource(sim.Agent("ryan", ["leader"]))
    project.assign(sa)


def updateData():
    project.data.append(100)


project.define([
    sim.Task("t1 is a long task name yep", 109, ["sa"], outcome=updateData),
    sim.Task("b1", 25, [], outcome=addSA),
    sim.Task("t2", 112, ["coder"], outcome=updateData),
    sim.Task("t3", 50, ["leader"], outcome=updateData),
])

project.initialState([])

project.add_resource(sim.Agent("charlie", ["coder", "sa", "leader"]))
project.add_resource(sim.Agent("louis", []))
project.add_resource(sim.Agent("wing", ["coder", "sa"]))

project.simulate()
print(project.data)
예제 #6
0
import project_sim as sim

project = sim.Project("test project", speed=0.005)

project.resources([
    sim.Agent("charlie", ["coder", "sa", "leader"]),
    sim.Agent("louis", []),
    sim.Agent("wing", ["coder", "sa"]),
])

project.define([
    sim.Task("t1 is a long task name yep", 109, ["sa"]),
    sim.Task("t2", 112, ["coder"]),
    sim.Task("t3", 50, ["leader"]),
])

project.simulate()