Skip to main content

PCMSOptimize

Syntax

int PCMSOptimize(Trip trip)

Parameters

Trip trip – Handle to a trip.

Description

Optimizes the trip by changing the stop order, if necessary. PCMSSetResequence must be called before PCMSOptimize to set whether optimization can change the final stop.

Certain options may prevent or alter optimization. Trips with two or fewer stops cannot be optimized. Trips with Hub Mode enabled using PCMSSetHubMode cannot be optimized. Trips with a fixed destination provided by PCMSSetResequence require at least four stops to be optimized.

Return Values

Returns 1 on success, 0 on an already-optimized trip, and -1 on an error.

Sample Code

printf("  Creating a trip: 08540 -> 90210 -> 12345 -> 08518.");
PCMSAddStop(trip, "08540");
PCMSAddStop(trip, "90210");
PCMSAddStop(trip, "12345");
PCMSAddStop(trip, "08518");
PCMSSetResequence(trip, false);
return PCMSOptimize(trip);

Supported Since: PC*Miler Connect 12

Category: Trip Management

Last updated July 8, 2025.