Tabnine Logo
TripStructureUtils$Subtour
Code IndexAdd Tabnine to your IDE (free)

How to use
TripStructureUtils$Subtour
in
org.matsim.core.router

Best Java code snippets using org.matsim.core.router.TripStructureUtils$Subtour (Showing top 20 results out of 315)

origin: matsim-org/matsim

final ArrayList<Candidate> choiceSet = new ArrayList<Candidate>();
for ( Subtour subtour : subtours ) {
  if ( !subtour.isClosed() ) {
    continue;
      subtour.getTrips().get( 0 ).getOriginActivity().getFacilityId() !=null ?
          subtour.getTrips().get( 0 ).getOriginActivity().getFacilityId() :
          subtour.getTrips().get( 0 ).getOriginActivity().getLinkId();
    subtour.getTrips().size() == 1 ?
      singleTripSubtourModes :
      chainBasedModes;
        trips.subList(
          0,
          trips.indexOf( subtour.getTrips().get( 0 ) )),
        mode);
    if (lastDestination != null) {
origin: matsim-org/matsim

          new Subtour(
              subtourStartIndex,
              subtourEndIndex,
new Subtour(
    0,
    trips.size(),
origin: matsim-org/matsim

private List<Subtour> getRootSubtoursWithMode(final Plan plan) {
  final Collection<Subtour> allSubtours = TripStructureUtils.getSubtours( plan , tripRouter.getStageActivityTypes() );
  final List<Subtour> roots = new ArrayList<Subtour>();
  for ( Subtour s : allSubtours ) {
    if ( s.getParent() != null ) continue;
    if ( !containsMode( s ) ) continue;
    roots.add( s );
  }
  return roots;
}
origin: matsim-org/matsim

  new Subtour(
        Arrays.asList(
          new Trip( act1 , trip1 , act2 ),
        true);
final Subtour rootSubtour2 =
  new Subtour(
        Arrays.asList(
          new Trip( act4 , trip4 , act5 ),
  new Subtour(
        Arrays.asList(
          new Trip( act5 , trip5 , act6 ),
origin: matsim-org/matsim

  new Subtour(
        Arrays.asList(
          new Trip( act1 , trip1 , act2 ),
        true);
final Subtour childSubtour1 =
  new Subtour(
        Arrays.asList(
          new Trip( act2 , trip2 , act3 ) ),
        true);
final Subtour childSubtour2 =
  new Subtour(
        Arrays.asList(
          new Trip( act4 , trip4 , act5 ) ),
origin: matsim-org/matsim

if ( !mutated.contains( s.getParent() ) ) {
  nMutatedWithoutMutatedFather++;
for ( Trip t : s.getTrips() ) {
  Assert.assertEquals(
      "unexpected mutated trip length",
origin: matsim-org/matsim

trips.add( tripObject );
childrenSubtours.add(
    new Subtour(
      Collections.singletonList( tripObject ),
      true) );
new Subtour(
    trips,
    true);
origin: matsim-org/matsim

    );
  for ( final Subtour s : subtours ) {
    if ( s.getParent() != null ) continue; // is not a root tour
    boolean isFirstTrip = true;
    for ( final Trip t : s.getTrips() ) {
for ( final SubtourRecord record : vehicularTours ) {
  final Subtour s = record.subtour;
  assert s.getParent() == null;
  final Id anchor = s.getTrips().get( 0 ).getOriginActivity().getFacilityId()!=null ?
    s.getTrips().get( 0 ).getOriginActivity().getFacilityId() :
    s.getTrips().get( 0 ).getOriginActivity().getLinkId();
origin: matsim-org/matsim

if ( !mutated.contains( s.getParent() ) ) {
  nMutatedWithoutMutatedFather++;
for ( Trip t : s.getTrips() ) {
  Assert.assertEquals(
      "unexpected mutated trip length",
if (subtour.getChildren().isEmpty()) {
  checkSubtour(subtour);
} else {
origin: matsim-org/matsim

  new Subtour(
        Arrays.asList(
          new Trip( act1 , trip1 , act2 ),
        true);
final Subtour secondSubtour =
  new Subtour(
        Arrays.asList(
          new Trip( act3 , trip3 , act4 ),
origin: matsim-org/matsim

boolean containsMutatedMode = false;
for (Trip trip : mutated.getTripsWithoutSubSubtours()) {
  if ( expectedMode.equals( trip.getLegsOnly().get( 0 ).getMode() ) ) {
    assertTrue(
if ( !mutateds.contains( s.getParent() ) ) {
  nMutatedWithoutMutatedFather++;
origin: matsim-org/matsim

  new Subtour(
        Arrays.asList(
          new Trip( act1 , trip1 , act2 ),
        false);
final Subtour childSubtour =
  new Subtour(
        Arrays.asList(
          new Trip( act2 , trip2 , act3 ) ),
origin: matsim-org/matsim

  new Subtour(
        Arrays.asList(
          new Trip( act1 , trip1 , act2 ),
        true);
final Subtour childSubtour =
  new Subtour(
        Arrays.asList(
          new Trip( act2 , trip2 , act3 ) ),
origin: matsim-org/matsim

plan,
Arrays.asList(
  new Subtour(
    Arrays.asList(
      new Trip( act1 , trip1 , act2 ),
origin: matsim-org/matsim

boolean atLeastOneSubtourWithDifferentChainBasedModes = false;
if (subtour.getChildren().isEmpty()) {
  String modePreviousTripSameSubtour = null;
  for (Trip trip: subtour.getTrips()) {
origin: matsim-org/matsim

Activity home2 = createActivityFromLocationId(anchorAtFacilities, fact, "home", createId(2,anchorAtFacilities));
plan.addActivity(home2);
Subtour subtour1 = new Subtour(
    Arrays.asList(
      new Trip(somewhereElse, Collections.<PlanElement>singletonList(leg1), home1),
      new Trip(work, Collections.<PlanElement>singletonList(leg3), home2)),
    false);
Subtour subtour2 = new Subtour(Arrays.asList(
    new Trip(home1, Collections.<PlanElement>singletonList(leg2), work),
    new Trip(work, Collections.<PlanElement>singletonList(leg3), home2)), true);
origin: matsim-org/matsim

plan.addActivity(somewhereElse);
Subtour subtour1 = new Subtour(
    Arrays.asList(
      new Trip(home1, Collections.<PlanElement>singletonList(leg2), work),
      new Trip(home2, Collections.<PlanElement>singletonList(leg1), somewhereElse)),
    false);
Subtour subtour2 = new Subtour(Arrays.asList(
    new Trip(home1, Collections.<PlanElement>singletonList(leg2), work),
    new Trip(work, Collections.<PlanElement>singletonList(leg3), home2)), true);
origin: matsim-org/matsim

@Override
public void run(final Plan plan) {
  final List<Id> vehs = new ArrayList<Id>(
    vehicleRessources.identifyVehiclesUsableForAgent(
        plan.getPerson().getId() ) );
  // make sure order is deterministic
  Collections.sort( vehs );
  final List<Subtour> rootSubtours = getRootSubtoursWithMode( plan );
  if ( rootSubtours.isEmpty() ) return;
  final Subtour toHandle = rootSubtours.get( random.nextInt( rootSubtours.size() ) );
  final Id veh = vehs.get( random.nextInt( vehs.size() ) );
  for ( Trip t : toHandle.getTrips() ) {
    if ( !identifyMainMode( t ).equals( mode ) ) continue;
    for ( Leg l : t.getLegsOnly() ) {
      if ( !(l.getRoute() instanceof NetworkRoute) ) continue;
      final NetworkRoute route = (NetworkRoute) l.getRoute();
      route.setVehicleId( veh );
    }
  }
}
origin: matsim-org/matsim

/*for tests*/ double calcOverlap(final GroupPlans gps) {
  final List<SubtourRecord> tours = getVehicularToursSortedByStartTime( gps );
  double overlap = 0;
  for ( final SubtourRecord tour : tours ) {
    Id veh = null;
    for ( final Trip t : tour.subtour.getTrips() ) {
      veh = getVehicle( t );
      if ( veh != null ) break;
    }
    
    for ( final VehicleRecord vr : tour.possibleVehicles ) {
      if ( vr.id.equals( veh ) ) {
        overlap += Math.max( 0 , vr.availableFrom - tour.startTime );
        if ( vr.availableFrom < tour.endTime ) {
          vr.availableFrom = tour.endTime;
        }
        break;
      }
    }
  }
  return overlap;
}
origin: matsim-org/matsim

@Test
public void testFatherhood() throws Exception {
  for (Fixture f : allFixtures( useFacilitiesAsAnchorPoint )) {
    final Collection<Subtour> subtours = TripStructureUtils.getSubtours( f.plan , CHECKER);
    for (Subtour s : subtours) {
      for ( Subtour child : s.getChildren() ) {
        assertEquals(
            "[anchorAtFacilities="+f.useFacilitiesAsAnchorPoint+"] "+
            "wrong father!",
            child.getParent(),
            s);
      }
      if ( s.getParent() != null ) {
        assertTrue(
            "[anchorAtFacilities="+f.useFacilitiesAsAnchorPoint+"] "+
            "father does not have subtour has a child",
            s.getParent().getChildren().contains( s ));
      }
    }
  }
}
org.matsim.core.routerTripStructureUtils$Subtour

Most used methods

  • getTrips
  • <init>
  • getParent
  • isClosed
  • areChildrenCompatible
  • contains
  • equals
  • getChildren
  • getTripsWithoutSubSubtours

Popular in Java

  • Start an intent from android
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getApplicationContext (Context)
  • setScale (BigDecimal)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now