google-cloud-optimization overview (1.46.0)

Key Reference Links

Cloud Fleet Routing Description: Is a managed routing service that takes your list of orders, vehicles, constraints, and objectives and returns the most efficient plan for your entire fleet in near real-time.

Cloud Fleet Routing Product ReferenceGitHub Repository (includes samples)Maven artifact

Getting Started

In order to use this library, you first need to go through the following steps:

Use the Cloud Fleet Routing for Java

To ensure that your project uses compatible versions of the librariesand their component artifacts, importcom.google.cloud:libraries-bom and usethe BOM to specify dependency versions. Be sure to remove any versions that youset previously. For more information aboutBOMs, seeGoogle Cloud Platform Libraries BOM.

Maven

Import the BOM in thedependencyManagement section of yourpom.xml file.Include specific artifacts you depend on in thedependencies section, but don'tspecify the artifacts' versions in thedependencies section.

The example below demonstrates how you would import the BOM and include thegoogle-cloud-optimization artifact.

<dependencyManagement><dependencies><dependency><groupId>com.google.cloud</groupId><artifactId>libraries-bom</artifactId><version>26.45.0</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><dependencies><dependency><groupId>com.google.cloud</groupId><artifactId>google-cloud-optimization</artifactId></dependency></dependencies>

Gradle

BOMs are supported by default in Gradle 5.x or later. Add aplatformdependency oncom.google.cloud:libraries-bom and remove the version from thedependency declarations in the artifact'sbuild.gradle file.

The example below demonstrates how you would import the BOM and include thegoogle-cloud-optimization artifact.

implementationplatform('com.google.cloud:libraries-bom:  26.45.0')implementation'com.google.cloud:google-cloud-optimization'

Theplatform andenforcedPlatform keywords supply dependency versionsdeclared in a BOM. TheenforcedPlatform keyword enforces the dependencyversions declared in the BOM and thus overrides what you specified.

For more details of theplatform andenforcedPlatform keywords Gradle 5.x or higher, seeGradle: Importing Maven BOMs.

If you're using Gradle 4.6 or later, addenableFeaturePreview('IMPROVED_POM_SUPPORT') to yoursettings.gradle file. For details, seeGradle 4.6 Release Notes: BOM import.Versions of Gradle earlier than 4.6 don't support BOMs.

SBT

SBTdoesn't support BOMs. You can findrecommended versions of libraries from a particular BOM version on thedashboardand set the versions manually.To use the latest version of this library, add this to your dependencies:

libraryDependencies+="com.google.cloud"%"google-cloud-optimization"%"1.46.0"

Which version ID should I get started with?

For this library, we recommend usingcom.google.cloud.optimization.v1 for new applications.

Understanding Version ID and Library Versions

When using a Cloud client library, it's important to distinguish between two types of versions:

  • Library Version: The version of the software package (the client library) that helps you interact with the Cloud service. These libraries arereleased and updated frequently with bug fixes, improvements, and support for new service features and versions. The version selector atthe top of this page represents the client library version.
  • Version ID: The version of the Cloud service itself (e.g. Cloud Fleet Routing). New Version IDs are introduced infrequently, and often involvechanges to the core functionality and structure of the Cloud service itself. The packages in the lefthand navigation represent packages tiedto a specific Version ID of the Cloud service.

Managing Library Versions

We recommend using thecom.google.cloud:libraries-bom installation method detailed above to streamline dependency managementacross multiple Cloud Java client libraries. This ensures compatibility and simplifies updates.

Choosing the Right Version ID

Each Cloud Java client library may contain packages tied to specific Version IDs (e.g.,v1,v2alpha). For new production applications, usethe latest stable Version ID. This is identified by the highest version numberwithout a suffix (like "alpha" or "beta"). You can read more aboutCloud API versioning strategy here.

Important: Unstable Version ID releases (thosewith suffixes) are subject to breaking changes when upgrading. Use them only for testing or if you specifically need their experimental features.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.