def from_last_state_to_solution(state: State, domain: SchedulingDomain):
    modes = [state.tasks_mode.get(j, 1) for j in sorted(domain.get_tasks_ids())]
    modes = modes[1:-1]
    schedule = {
        j: {
            "start_time": state.tasks_details[j].start,
            "end_time": state.tasks_details[j].end,
        }
        for j in state.tasks_details
    }
    return RCPSPSolution(
        problem=build_do_domain(domain),
        rcpsp_permutation=None,
        rcpsp_modes=modes,
        rcpsp_schedule=schedule,
    )
Exemple #2
0
def feature_n_predecessors(
    domain: SchedulingDomain, cpm, cpm_esd, task_id: int, **kwargs
):
    return len(domain.get_predecessors_task(task_id)) / len(domain.get_tasks_ids())
Exemple #3
0
def feature_all_descendants(
    domain: SchedulingDomain, cpm, cpm_esd, task_id: int, **kwargs
):
    return len(domain.full_successors[task_id]) / len(domain.get_tasks_ids())