const float b = 0.15;
const unsigned int p = 4;
static void compute(float* cost,float* flow_free_time,float* Volume,float* capacity,float* weight,
int size){
for (int i =0; i < size; i++){
weight[i] = 0.6 * cost[i] + 0.4 * flow_free_time[i]*(1 + b*powf(Volume[i]/capacity[i],p));
}
}
extern "C" {
void weight_average(float* cost,float* flow_free_time,float* Volume,float* capacity,float* weight,
int size) {
compute(cost,flow_free_time,Volume,capacity,weight,size);
}
}