 |
vrpRouting
0.3
|
Go to the documentation of this file.
97 vehicle->
id =
get_Idx(tuple, tupdesc, info[0], 0);
123 (errmsg(
"Invalid time window (%d, %d)",
125 errhint(
"Time window start time %d must be "
126 "less than or equal to time window end time %d",
135 ereport(ERROR, (errmsg(
"Invalid speed_factor %lf", vehicle->
speed_factor),
136 errhint(
"Speed factor must be greater than 0")));
153 size_t *total_vehicles,
156 const int column_count,
159 clock_t start_t = clock();
163 const int tuple_limit = 1000000;
172 bool moredata =
true;
173 (*total_vehicles) = total_tuples = 0;
177 while (moredata ==
true) {
178 SPI_cursor_fetch(SPIportal,
true, tuple_limit);
179 if (total_tuples == 0) {
181 info[1].
colNumber = SPI_fnumber(SPI_tuptable->tupdesc,
"start_id");
182 info[2].
colNumber = SPI_fnumber(SPI_tuptable->tupdesc,
"end_id");
184 elog(ERROR,
"At least one out of start_id or end_id must be present");
188 size_t ntuples = SPI_processed;
189 total_tuples += ntuples;
191 if ((*vehicles) == NULL)
199 if ((*vehicles) == NULL) {
200 elog(ERROR,
"Out of memory");
204 SPITupleTable *tuptable = SPI_tuptable;
205 TupleDesc tupdesc = SPI_tuptable->tupdesc;
206 for (t = 0; t < ntuples; t++) {
207 HeapTuple tuple = tuptable->vals[t];
209 &(*vehicles)[total_tuples - ntuples + t], is_plain);
211 SPI_freetuptable(tuptable);
217 SPI_cursor_close(SPIportal);
219 if (total_tuples == 0) {
220 (*total_vehicles) = 0;
224 (*total_vehicles) = total_tuples;
226 time_msg(
"reading vehicles", start_t, clock());
242 int kColumnCount = 10;
245 for (
int i = 0; i < kColumnCount; ++i) {
253 info[1].
name =
"start_id";
254 info[2].
name =
"end_id";
255 info[3].
name =
"capacity";
256 info[4].
name =
"skills";
257 info[5].
name =
"tw_open";
258 info[6].
name =
"tw_close";
259 info[7].
name =
"speed_factor";
260 info[8].
name =
"max_tasks";
261 info[9].
name =
"data";
MatrixIndex end_id
Start location index in matrix.
Duration tw_open
Number of vehicle's skills.
SPIPlanPtr pgr_SPI_prepare(char *sql)
char * spi_getText(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
under development
MatrixIndex get_MatrixIndex(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, MatrixIndex opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
size_t capacity_size
Vehicle's capacity array.
double speed_factor
Time window end time.
Skill * skills
Vehicle's capacity array size.
void pgr_fetch_column_info(Column_info_t info[], int info_size)
Function tells expected type of each column and then check the correspondence type of each column.
struct Vroom_vehicle_t Vroom_vehicle_t
TTimestamp get_PositiveTTimestamp(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TTimestamp opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
Portal pgr_SPI_cursor_open(SPIPlanPtr SPIplan)
int32_t max_tasks
Vehicle travel time multiplier.
Duration get_Duration(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Duration opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
void time_msg(char *msg, clock_t start_t, clock_t end_t)
int32_t spi_getMaxTasks(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
gets the vehicle max tasks value
char * data
Max number of tasks in a route for the vehicle.
int64_t * spi_getPositiveBigIntArr_allowEmpty(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, size_t *the_size)
Function returns the values of specified columns in array.
uint32_t * spi_getPositiveIntArr_allowEmpty(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, size_t *the_size)
Function returns the values of specified columns in array.
Duration tw_close
Time window start time.
size_t skills_size
Vehicle's skills.
Idx get_Idx(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Idx opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
bool column_found(int colNumber)
Check whether the colNumber represent any specific column or NULL (SPI_ERROR_NOATTRIBUTE).
MatrixIndex start_id
The vehicle's identifier.
Amount * capacity
End location index in matrix.
double spi_getFloat8(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
gets value of specified column in double type.