Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Hedefler, ortak optimizasyon hedeflerini önceden tanımlayan parametrelerdir. Örneğin, en kısa seyahat mesafesi veya süresi, zamanında teslimatlar, sürücüler arasında yük dengeleme. Bu, geliştiricilerin karmaşık özellikleri ve maliyet parametrelerinin tam özelleştirilmesini öğrenmeden önce Route Optimization API'ye katılımını kolaylaştırmak için tasarlanmıştır. (Çok çeşitli hedeflerinizi nasıl tamamen özelleştireceğinizi öğrenmek için "cost model" başlıklı makaleyi inceleyin.)
Ayarlanmışsa ShipmentModel.objectives, maliyet modelinin üzerine tamamen yazar. Bu nedenle, önceden var olan maliyetlerle uyumlu değildir. Her Objective, araçlar, gönderiler veya geçiş özellikleri için önceden tanımlanmış bir dizi maliyetle eşlenir.
TRANSFORM_AND_RETURN_REQUEST çözüm modu belirtildiğinde istek çözülmez, yalnızca doğrulanır ve verilen hedeflere karşılık gelen maliyetlerle doldurulur. Değiştirilen istek, OptimizeToursResponse.processed_request olarak döndürülür. Diğer tüm çözüm modları, çözülen isteği döndürür.
TRANSFORM_AND_RETURN_REQUEST çözüm modu yalnızca OptimizeTours istekleri için geçerlidir ve diğer Rota Optimizasyonu API istekleri için kullanılamaz.
Örnek: ShipmentModel.objectives isteğinde bulunma
İstek göndermeden önce aşağıdaki adımları tamamlayın:
PROJECT_NUMBER_OR_ID değerini Cloud proje numaranız veya kimliğiniz olarak ayarlayın.
Aşağıdaki komut, Route Optimization API'ye bir OptimizeToursRequest gönderir. Bu API, ProcessedRequest alanı ayarlanmış bir OptimizeToursResponse döndürür.
[null,null,["Son güncelleme tarihi: 2025-08-29 UTC."],[],[],null,["\u003cbr /\u003e\n\n| This product or feature is Experimental (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the [Google\n| Maps Platform Service Specific Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms). For more information, see the [launch stage descriptions](/maps/launch-stages).\n\n\u003cbr /\u003e\n\nObjectives are parameters that pre-define common optimization targets, such as\nshortest travel distance or duration, on time deliveries, balancing loads\nbetween drivers. It's meant to make it easier for developers to onboard to Route\nOptimization API before learning the sophications and full customization of cost\nparameters. (See \"[`cost model`](/maps/documentation/route-optimization/concepts/costs)\" for how to fully customize your wide variety of objectives)\n\nWhen set, the [`ShipmentModel.objectives`](/maps/tt/route-optimization/experimental/objectives/reference/rpc/google.maps.routeoptimization.v1#shipmentmodel) overwrite the cost model\ncompletely, therefore they are incompatible with pre-existing costs. Each\n[`Objective`](/maps/tt/route-optimization/experimental/objectives/reference/rpc/google.maps.routeoptimization.v1#objective) maps to a number of predefined costs for vehicles, shipments or\ntransition attributes.\n| **Note:** `OptimizeToursRequests` that have both costs and objectives set are invalid and will be rejected with a validation error.\n\nWhen specifying the [`TRANSFORM_AND_RETURN_REQUEST`](/maps/tt/route-optimization/experimental/objectives/reference/rpc/google.maps.routeoptimization.v1#solvingmode) solving mode,\nthe request is not solved and it is only validated and filled with costs\ncorresponding to the given objectives. The modified request is returned as\n[`OptimizeToursResponse.processed_request`](/maps/tt/route-optimization/experimental/objectives/reference/rpc/google.maps.routeoptimization.v1#optimizetoursresponse). All other solve modes will\nreturn the solved request.\n| **Note:** `TRANSFORM_AND_RETURN_REQUEST` requests are not billed.\n\nThe `TRANSFORM_AND_RETURN_REQUEST` solving mode is only valid for\n`OptimizeTours` requests and is not available for other Route Optimization API\nrequests.\n\nExample: Make a `ShipmentModel.objectives` request\n\nBefore making a request, complete the following steps:\n\n- Ensure you have [Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc) configured as described in [Use OAuth](/maps/documentation/route-optimization/oauth-token).\n- Set \u003cvar label=\"project_number\" translate=\"no\"\u003ePROJECT_NUMBER_OR_ID\u003c/var\u003e to your Cloud\n project number or ID.\n\n The following command sends an `OptimizeToursRequest` to the\n Route Optimization API which returns an `OptimizeToursResponse`. \n\n ```carbon\n curl -X POST 'https://routeoptimization.googleapis.com/v1/projects/\u003cvar label=\"project_number\" translate=\"no\"\u003ePROJECT_NUMBER_OR_ID\u003c/var\u003e:optimizeTours' \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $(gcloud auth application-default print-access-token)\" \\\n --data @- \u003c\u003cEOM\n {\n \"model\": {\n \"shipments\": [\n {\n \"pickups\": [\n {\n \"arrivalLocation\": {\n \"latitude\": 37.42506261000996,\n \"longitude\": -122.09535511930135\n }\n }\n ],\n \"deliveries\": [\n {\n \"arrivalLocation\": {\n \"latitude\": 37.42421503206021,\n \"longitude\": -122.09526063135228\n }\n }\n ]\n }\n ],\n \"vehicles\": [\n {\n \"travelMode\": \"DRIVING\",\n }\n ],\n \"objectives\": [\n {\n \"type\": \"MIN_TRAVEL_TIME\"\n }\n ],\n }\n }\n EOM\n ```\n | **Note:** This example uses the `--data @-` to read a request from standard input. Use `--data @`\u003cvar label=\"curl_filename\" translate=\"no\"\u003eFilename\u003c/var\u003e to read from a file.\n\nExample: Make a `TRANSFORM_AND_RETURN_REQUEST` request\n\nBefore making a request, complete the following steps:\n\n- Ensure you have [Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc) configured as described in [Use OAuth](/maps/documentation/route-optimization/oauth-token).\n- Set \u003cvar label=\"project_number\" translate=\"no\"\u003ePROJECT_NUMBER_OR_ID\u003c/var\u003e to your Cloud\n project number or ID.\n\n The following command sends an `OptimizeToursRequest` to the\n Route Optimization API which returns an `OptimizeToursResponse` with the\n [`ProcessedRequest`](/maps/tt/route-optimization/experimental/objectives/reference/rpc/google.maps.routeoptimization.v1#optimizetoursresponse) field set. \n\n ```carbon\n curl -X POST 'https://routeoptimization.googleapis.com/v1/projects/\u003cvar label=\"project_number\" translate=\"no\"\u003ePROJECT_NUMBER_OR_ID\u003c/var\u003e:optimizeTours' \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $(gcloud auth application-default print-access-token)\" \\\n --data @- \u003c\u003cEOM\n {\n \"model\": {\n \"shipments\": [\n {\n \"pickups\": [\n {\n \"arrivalLocation\": {\n \"latitude\": 37.42506261000996,\n \"longitude\": -122.09535511930135\n }\n }\n ],\n \"deliveries\": [\n {\n \"arrivalLocation\": {\n \"latitude\": 37.42421503206021,\n \"longitude\": -122.09526063135228\n }\n }\n ]\n }\n ],\n \"vehicles\": [\n {\n \"travelMode\": \"DRIVING\",\n }\n ],\n \"objectives\": [\n {\n \"type\": \"MIN_TRAVEL_TIME\"\n }\n ]\n },\n \"solvingMode\": \"TRANSFORM_AND_RETURN_REQUEST\"\n }\n EOM\n ```\n The previous command will produce a similar response to the following. \n\n ```\n {\n \"processedRequest\": {\n \"model\": {\n \"shipments\": [\n {\n \"pickups\": [\n {\n \"arrivalLocation\": {\n \"latitude\": 37.425062610009959,\n \"longitude\": -122.09535511930135\n }\n }\n ],\n \"deliveries\": [\n {\n \"arrivalLocation\": {\n \"latitude\": 37.424215032060211,\n \"longitude\": -122.09526063135228\n }\n }\n ]\n }\n ],\n \"vehicles\": [\n {\n \"travelMode\": \"DRIVING\",\n \"costPerHour\": 30,\n \"costPerTraveledHour\": 330,\n \"costPerKilometer\": 0.2\n }\n ],\n \"objectives\": [\n {\n \"type\": \"MIN_TRAVEL_TIME\"\n }\n ]\n },\n \"solvingMode\": \"TRANSFORM_AND_RETURN_REQUEST\"\n }\n }\n ```\n | **Note:** This example uses the `--data @-` to read a request from standard input. Use `--data @`\u003cvar label=\"curl_filename\" translate=\"no\"\u003eFilename\u003c/var\u003e to read from a file."]]