agrignard / ReChamp

Project for the Champs Elysées project
1 stars 3 forks source link

JAVA ERROR NIL!!!!!! #54

Closed agrignard closed 4 years ago

agrignard commented 4 years ago

BOn on essaie de tester comme il faut avant de commiter, ca me pette à al geule quand je change d'état....

2 occurrences in 2 agents at cycle 428: Java error: nil value detected in current_path <- as_path(([road(current_road)]) + list(new_path.edges),driving_road_network); NullPointerException: null when applying the edges operator on null in current_path <- as_path(([road(current_road)]) + list(new_path.edges),driving_road_network); in if first(intersection where (each.location = location)) != target_intersection { if new_path = nil { write 'car ' + int(self) ; write (('origin: ' + location) + ' ') + (intersection where (each.location = location)) ; write 'dest: ' + target_intersection ; write li ; write old_path ; ask world { do pause ; }

}

current_path <- as_path(([road(current_road)]) + list<road>(new_path.edges),driving_road_network);
targets <- ([location]) + targets;

}

in if target_intersection in possible_targets[currentSimuState] { truc <- 1; point save_location <- location; location <- last(road(current_road).shape.points); list li <- [first(intersection where (each.location = location)),target_intersection]; path path new_path <- self.compute_path(graph:driving_road_network, target:target_intersection); if first(intersection where (each.location = location)) != target_intersection { if new_path = nil { write 'car ' + int(self) ; write (('origin: ' + location) + ' ') + (intersection where (each.location = location)) ; write 'dest: ' + target_intersection ; write li ; write old_path ; ask world { do pause ; }

    }

    current_path <- as_path(([road(current_road)]) + list<road>(new_path.edges),driving_road_network);
    targets <- ([location]) + targets;
}

location <- save_location;
trace <+ road(current_road).to_display;
road_trace <+ road(current_road);
if road(current_road).to_display  {
}

}else { truc <- 2; trace <+ road(current_road).to_display; road_trace <+ road(current_road); current_path <- as_path([road(current_road)],driving_road_network); final_target <- last(road(current_road).shape.points); int j <- targets index_of final_target; targets <- [final_target]; trace <+ road(current_road).to_display; road_trace <+ road(current_road); }

in else { trace <+ road(current_road).to_display; road_trace <+ road(current_road); int truc <- 0; if target_intersection in possible_targets[currentSimuState] { truc <- 1; point save_location <- location; location <- last(road(current_road).shape.points); list li <- [first(intersection where (each.location = location)),target_intersection]; path path new_path <- self.compute_path(graph:driving_road_network, target:target_intersection); if first(intersection where (each.location = location)) != target_intersection { if new_path = nil { write 'car ' + int(self) ; write (('origin: ' + location) + ' ') + (intersection where (each.location = location)) ; write 'dest: ' + target_intersection ; write li ; write old_path ; ask world { do pause ; }

        }

        current_path <- as_path(([road(current_road)]) + list<road>(new_path.edges),driving_road_network);
        targets <- ([location]) + targets;
    }

    location <- save_location;
    trace <+ road(current_road).to_display;
    road_trace <+ road(current_road);
    if road(current_road).to_display  {
    }

}else  {
    truc <- 2;
    trace <+ road(current_road).to_display;
    road_trace <+ road(current_road);
    current_path <- as_path([road(current_road)],driving_road_network);
    final_target <- last(road(current_road).shape.points);
    int j <- targets index_of final_target;
    targets <- [final_target];
    trace <+ road(current_road).to_display;
    road_trace <+ road(current_road);
}

if self.use_blocked_road()  {
    trace <+ road(current_road).to_display;
    road_trace <+ road(current_road);
    write (((('' + int(self)) + ' is updating at step ') + cycle) + ' target possible ') + (target_intersection in possible_targets[currentSimuState]) ;
    write (((((('current road ' + current_road) + ' to display? ') + road(current_road).to_display) + ' choice ') + truc) + ' target ') + target_intersection ;
    write 'road trace: ' + road_trace ;
    write ('trace ' + trace) + '
    ' ;
}

}

in if not(road(current_road).to_display) { fade_count <- 15; }else { trace <+ road(current_road).to_display; road_trace <+ road(current_road); int truc <- 0; if target_intersection in possible_targets[currentSimuState] { truc <- 1; point save_location <- location; location <- last(road(current_road).shape.points); list li <- [first(intersection where (each.location = location)),target_intersection]; path path new_path <- self.compute_path(graph:driving_road_network, target:target_intersection); if first(intersection where (each.location = location)) != target_intersection { if new_path = nil { write 'car ' + int(self) ; write (('origin: ' + location) + ' ') + (intersection where (each.location = location)) ; write 'dest: ' + target_intersection ; write li ; write old_path ; ask world { do pause ; }

        }

        current_path <- as_path(([road(current_road)]) + list<road>(new_path.edges),driving_road_network);
        targets <- ([location]) + targets;
    }

    location <- save_location;
    trace <+ road(current_road).to_display;
    road_trace <+ road(current_road);
    if road(current_road).to_display  {
    }

}else  {
    truc <- 2;
    trace <+ road(current_road).to_display;
    road_trace <+ road(current_road);
    current_path <- as_path([road(current_road)],driving_road_network);
    final_target <- last(road(current_road).shape.points);
    int j <- targets index_of final_target;
    targets <- [final_target];
    trace <+ road(current_road).to_display;
    road_trace <+ road(current_road);
}

if self.use_blocked_road()  {
    trace <+ road(current_road).to_display;
    road_trace <+ road(current_road);
    write (((('' + int(self)) + ' is updating at step ') + cycle) + ' target possible ') + (target_intersection in possible_targets[currentSimuState]) ;
    write (((((('current road ' + current_road) + ' to display? ') + road(current_road).to_display) + ' choice ') + truc) + ' target ') + target_intersection ;
    write 'road trace: ' + road_trace ;
    write ('trace ' + trace) + '
    ' ;
}

}

in if current_road != nil { trace <+ road(current_road).to_display; road_trace <+ road(current_road); if not(road(current_road).to_display) { fade_count <- 15; }else { trace <+ road(current_road).to_display; road_trace <+ road(current_road); int truc <- 0; if target_intersection in possible_targets[currentSimuState] { truc <- 1; point save_location <- location; location <- last(road(current_road).shape.points); list li <- [first(intersection where (each.location = location)),target_intersection]; path path new_path <- self.compute_path(graph:driving_road_network, target:target_intersection); if first(intersection where (each.location = location)) != target_intersection { if new_path = nil { write 'car ' + int(self) ; write (('origin: ' + location) + ' ') + (intersection where (each.location = location)) ; write 'dest: ' + target_intersection ; write li ; write old_path ; ask world { do pause ; }

            }

            current_path <- as_path(([road(current_road)]) + list<road>(new_path.edges),driving_road_network);
            targets <- ([location]) + targets;
        }

        location <- save_location;
        trace <+ road(current_road).to_display;
        road_trace <+ road(current_road);
        if road(current_road).to_display  {
        }

    }else  {
        truc <- 2;
        trace <+ road(current_road).to_display;
        road_trace <+ road(current_road);
        current_path <- as_path([road(current_road)],driving_road_network);
        final_target <- last(road(current_road).shape.points);
        int j <- targets index_of final_target;
        targets <- [final_target];
        trace <+ road(current_road).to_display;
        road_trace <+ road(current_road);
    }

    if self.use_blocked_road()  {
        trace <+ road(current_road).to_display;
        road_trace <+ road(current_road);
        write (((('' + int(self)) + ' is updating at step ') + cycle) + ' target possible ') + (target_intersection in possible_targets[currentSimuState]) ;
        write (((((('current road ' + current_road) + ' to display? ') + road(current_road).to_display) + ' choice ') + truc) + ' target ') + target_intersection ;
        write 'road trace: ' + road_trace ;
        write ('trace ' + trace) + '
        ' ;
    }

}

to_update <- false;

}

in action update { list list if current_road != nil { trace <+ road(current_road).to_display; road_trace <+ road(current_road); if not(road(current_road).to_display) { fade_count <- 15; }else { trace <+ road(current_road).to_display; road_trace <+ road(current_road); int truc <- 0; if target_intersection in possible_targets[currentSimuState] { truc <- 1; point save_location <- location; location <- last(road(current_road).shape.points); list li <- [first(intersection where (each.location = location)),target_intersection]; path path new_path <- self.compute_path(graph:driving_road_network, target:target_intersection); if first(intersection where (each.location = location)) != target_intersection { if new_path = nil { write 'car ' + int(self) ; write (('origin: ' + location) + ' ') + (intersection where (each.location = location)) ; write 'dest: ' + target_intersection ; write li ; write old_path ; ask world { do pause ; }

                }

                current_path <- as_path(([road(current_road)]) + list<road>(new_path.edges),driving_road_network);
                targets <- ([location]) + targets;
            }

            location <- save_location;
            trace <+ road(current_road).to_display;
            road_trace <+ road(current_road);
            if road(current_road).to_display  {
            }

        }else  {
            truc <- 2;
            trace <+ road(current_road).to_display;
            road_trace <+ road(current_road);
            current_path <- as_path([road(current_road)],driving_road_network);
            final_target <- last(road(current_road).shape.points);
            int j <- targets index_of final_target;
            targets <- [final_target];
            trace <+ road(current_road).to_display;
            road_trace <+ road(current_road);
        }

        if self.use_blocked_road()  {
            trace <+ road(current_road).to_display;
            road_trace <+ road(current_road);
            write (((('' + int(self)) + ' is updating at step ') + cycle) + ' target possible ') + (target_intersection in possible_targets[currentSimuState]) ;
            write (((((('current road ' + current_road) + ' to display? ') + road(current_road).to_display) + ' choice ') + truc) + ' target ') + target_intersection ;
            write 'road trace: ' + road_trace ;
            write ('trace ' + trace) + '
            ' ;
        }

    }

    to_update <- false;
}

}

in do update ; in ask first(100,shuffle(car where each.to_update)) { do update ; }

in ask first(100,shuffle(car where each.to_update)) { do update ; }

in reflex update_cars { ask first(100,shuffle(car where each.to_update)) { do update ; }

}

in agents car1405, Simulation 0

agrignard commented 4 years ago

ca viendrait pas ce commit par hasard? https://github.com/agrignard/ReChamp/commit/3b16fbf3e1ed95ae0851606026e04e842c41c000

Ca marchait hier

agrignard commented 4 years ago
Screen Shot 2020-01-24 at 11 25 45
agrignard commented 4 years ago

car 645 origin: {486.1107737827115,982.7025999240577,0.0} [intersection(1423)] dest: intersection(296) [intersection(1423),intersection(296)] nil