//VrptwAlgorithm.h
#ifndef _VrptwAlgorithm_h_
#define _VrptwAlgorithm_h_
#include "VrptwAlgorithmUtil.h"
#include "LogAlgorithm.h"
class LogVRPResult;
class LogVRPData;
extern "C" VRPTWEXPORT LogAlgorithm * VrptwAlgorithmFactory();
class VRPTWEXPORT VrptwAlgorithm : public LogAlgorithm
{
private:
int maxNbNodes; // Maximum number of Nodes
int maxNbVehicles; // Maximum number of Vehicles
typedef struct{
int *str;//[NODE_MAX+VEHICLE_MAX]/*ストリングモデル(両端のデポは含まず) 07/12/10*/
} ANS;
int DemandNo; /*デマンド数*/
int *DemandQ; //[NODE_MAX]; /*デマンド量 07/12/10*/
int *initialTime; //[NODE_MAX]; /*時間枠の開始時刻 08/02/13*/
int *durationTime; //[NODE_MAX]; /*時間枠の終了時刻 08/02/13*/
int *serviceTime; //[NODE_MAX]; /*サービスにかかる時間 08/02/13*/
double **CostMx;//[NODE_MAX][NODE_MAX]; /*コスト行列(通過時の) 07/12/10*/
int StrLength; /*ストリングモデル長*/
int **EachV_Route;//[NODE_MAX][VEHICLE_MAX]; /*081019修正*/
bool executionError;
QString message;
};
#endif
//VrptwAlgorithm.cpp
#include "GKFleetVehicle.h"
#include "GKClient.h"
#include <time.h>
#include <math.h>
void VrptwAlgorithm::setData( LogVRPData* data )
{
//allocating demand memory
DemandQ = (int*)calloc( DemandNo+1, sizeof(int) );
//setting up DemandQ values
QMap< uint, GKLogVertex* >::const_iterator iter, iterEnd;
iterEnd = data->getVertexs().end();
for( iter = data->getVertexs().begin(); iter != iterEnd; ++iter ){
//trying to convert a GKLogVertex into a GKClient
GKClient * client = dynamic_cast<GKClient*>( iter.value() );
if( client != NULL ){//the vertex is a client
DemandQ[iter.key()] = data->getClientProperty( client ).getDemand();
}else{//the vertex is a depot
DemandQ[iter.key()] = 0;
}
}