-
Notifications
You must be signed in to change notification settings - Fork 2
Single Driver Multiple TimeWindows 12 Stops
Maciej Mionskowski edited this page Oct 28, 2016
·
2 revisions
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/routing"
)
func main() {
client := &route4me.NewClient("11111111111111111111111111111111")
service := &routing.Service{Client: client}
addresses := []*routing.Address{&routing.Address{AddressString: "3634 W Market St, Fairlawn, OH 44333",
//all possible originating locations are depots, should be marked as true
//stylistically we recommend all depots should be at the top of the destinations list
IsDepot: true,
Latitude: 41.135762259364,
Longitude: -81.629313826561,
TimeWindowStart: 0,
TimeWindowEnd: 0,
TimeWindowStart2: 0,
TimeWindowEnd2: 0,
Time: 0,
},
&routing.Address{AddressString: "1218 Ruth Ave, Cuyahoga Falls, OH 44221",
Latitude: 41.135762259364,
Longitude: -81.629313826561,
//together these two specify the time window of a destination
//seconds offset relative to the route start time for the open availability of a destination
TimeWindowStart: 6*3600 + 00*60,
//seconds offset relative to the route end time for the open availability of a destination
TimeWindowEnd: 6*3600 + 30*60,
// Second 'TimeWindowStart'
TimeWindowStart2: 7*3600 + 00*60,
// Second 'TimeWindowEnd'
TimeWindowEnd2: 7*3600 + 20*60,
//the number of seconds at destination
Time: 300,
},
&routing.Address{AddressString: "512 Florida Pl, Barberton, OH 44203",
Latitude: 41.003671512008,
Longitude: -81.598461046815,
TimeWindowStart: 7*3600 + 30*60,
TimeWindowEnd: 7*3600 + 40*60,
TimeWindowStart2: 8*3600 + 00*60,
TimeWindowEnd2: 8*3600 + 10*60,
Time: 300,
},
&routing.Address{AddressString: "512 Florida Pl, Barberton, OH 44203",
Latitude: 41.003671512008,
Longitude: -81.598461046815,
TimeWindowStart: 8*3600 + 30*60,
TimeWindowEnd: 8*3600 + 40*60,
TimeWindowStart2: 8*3600 + 50*60,
TimeWindowEnd2: 9*3600 + 00*60,
Time: 100,
},
&routing.Address{AddressString: "3495 Purdue St, Cuyahoga Falls, OH 44221",
Latitude: 41.162971496582,
Longitude: -81.479049682617,
TimeWindowStart: 9*3600 + 00*60,
TimeWindowEnd: 9*3600 + 15*60,
TimeWindowStart2: 9*3600 + 30*60,
TimeWindowEnd2: 9*3600 + 45*60,
Time: 300,
},
&routing.Address{AddressString: "1659 Hibbard Dr, Stow, OH 44224",
Latitude: 41.194505989552,
Longitude: -81.443351581693,
TimeWindowStart: 10*3600 + 00*60,
TimeWindowEnd: 10*3600 + 15*60,
TimeWindowStart2: 10*3600 + 30*60,
TimeWindowEnd2: 10*3600 + 45*60,
Time: 300,
},
&routing.Address{AddressString: "2705 N River Rd, Stow, OH 44224",
Latitude: 41.145240783691,
Longitude: -81.410247802734,
TimeWindowStart: 11*3600 + 00*60,
TimeWindowEnd: 11*3600 + 15*60,
TimeWindowStart2: 11*3600 + 30*60,
TimeWindowEnd2: 11*3600 + 45*60,
Time: 300,
},
&routing.Address{AddressString: "10159 Bissell Dr, Twinsburg, OH 44087",
Latitude: 41.340042114258,
Longitude: -81.421226501465,
TimeWindowStart: 12*3600 + 00*60,
TimeWindowEnd: 12*3600 + 15*60,
TimeWindowStart2: 12*3600 + 30*60,
TimeWindowEnd2: 12*3600 + 45*60,
Time: 300,
},
&routing.Address{AddressString: "367 Cathy Dr, Munroe Falls, OH 44262",
Latitude: 41.148578643799,
Longitude: -81.429229736328,
TimeWindowStart: 13*3600 + 00*60,
TimeWindowEnd: 13*3600 + 15*60,
TimeWindowStart2: 13*3600 + 30*60,
TimeWindowEnd2: 13*3600 + 45*60,
Time: 300,
},
&routing.Address{AddressString: "367 Cathy Dr, Munroe Falls, OH 44262",
Latitude: 41.148578643799,
Longitude: -81.429229736328,
TimeWindowStart: 14*3600 + 00*60,
TimeWindowEnd: 14*3600 + 15*60,
TimeWindowStart2: 14*3600 + 30*60,
TimeWindowEnd2: 14*3600 + 45*60,
Time: 300,
},
&routing.Address{AddressString: "512 Florida Pl, Barberton, OH 44203",
Latitude: 41.003671512008,
Longitude: -81.598461046815,
TimeWindowStart: 15*3600 + 00*60,
TimeWindowEnd: 15*3600 + 15*60,
TimeWindowStart2: 15*3600 + 30*60,
TimeWindowEnd2: 15*3600 + 45*60,
Time: 300,
},
&routing.Address{AddressString: "559 W Aurora Rd, Northfield, OH 44067",
Latitude: 41.315116882324,
Longitude: -81.558746337891,
TimeWindowStart: 16*3600 + 00*60,
TimeWindowEnd: 16*3600 + 15*60,
TimeWindowStart2: 16*3600 + 30*60,
TimeWindowEnd2: 17*3600 + 00*60,
Time: 50,
},
}
routeParams := &routing.RouteParameters{
AlgorithmType: routing.CVRP_TW_MD,
StoreRoute: false,
Name: "Single Driver Multiple TimeWindows 12 Stops",
RouteDate: time.Now().Unix(),
RouteTime: 5*3600 + 30*60,
Optimize: routing.Distance,
DistanceUnit: routing.Miles,
DeviceType: routing.Web,
TravelMode: routing.Driving,
Metric: routing.Geodesic,
}
optParams := &routing.OptimizationParameters{
Addresses: addresses,
Parameters: routeParams,
}
_, err := service.RunOptimization(optParams)
}
- Activity
- Addressbook
- Routing
- Single Driver Route 10 Stops
- Single Driver Round Trip
- Single Depot Multiple Driver No Time Windows
- Single Depot Multiple Driver Time Windows
- Multiple Depot Multiple Driver
- Multiple Depot Multiple Driver With Time Windows
- Multiple Depot Multiple Driver With Time Windows (24 Stops)
- Tracking
- Geocoding
- Users
- Territories
- Orders
- Vehicles
- Telematics