Skip to content

Conversation

@Abhishekrana254
Copy link

No description provided.

if (!num->IsNumber())
throw std::runtime_error{"Expected array element of types Number"};

//std::cout<<"hello"<<std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The debug prints and the include above have to go before we can merge this


// our function for changing js array into vector of long long int

template <typename Vector> inline auto makeVectorFromJsNumberArray1(v8::Local<v8::Array> array) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this function needed?


struct TSPWorker final : Nan::AsyncWorker {
using Base = Nan::AsyncWorker;
struct TSPWorker final {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove this and no longer initialize the base class below? The base class already stores the callback, there should be no need to store it here.

}

void Execute() override {
void Execute() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please inherit from the NAN AsyncWorker and keep the overrides here and below.

std::int32_t depotNode;
std::int32_t timeHorizon;
std::int32_t vehicleCapacity;
std::vector<int64> vehicleCapacity; // type changed to vector
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

if (static_cast<std::int32_t>(array->Length()) != n)
throw std::runtime_error{"Array dimension do not match size"};
// if (static_cast<std::int32_t>(array->Length()) != n)
// throw std::runtime_error{"Array dimension do not match size"};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why commented out?

else if(!costMatrixOk) throw std::runtime_error{"ERROR TYPE 2"};
else if(!durationMatrixOk) throw std::runtime_error{"ERROR TYPE 3"};
else if(!timeWindowsVectorOk) throw std::runtime_error{"ERROR TYPE 4"};
else if(!demandMatrixOk) throw std::runtime_error{"ERROR TYPE 5"};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on here?

auto depotNodeOk = !maybeDepotNode.IsEmpty() && maybeDepotNode.ToLocalChecked()->IsNumber();
auto timeHorizonOk = !maybeTimeHorizon.IsEmpty() && maybeTimeHorizon.ToLocalChecked()->IsNumber();
auto vehicleCapacityOk = !maybeVehicleCapacity.IsEmpty() && maybeVehicleCapacity.ToLocalChecked()->IsNumber();
auto vehicleCapacityOk = !maybeVehicleCapacity.IsEmpty() && maybeVehicleCapacity.ToLocalChecked()->IsArray(); // IsNumber() changed to IsArray()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

depotNode = Nan::To<std::int32_t>(maybeDepotNode.ToLocalChecked()).FromJust();
timeHorizon = Nan::To<std::int32_t>(maybeTimeHorizon.ToLocalChecked()).FromJust();
vehicleCapacity = Nan::To<std::int32_t>(maybeVehicleCapacity.ToLocalChecked()).FromJust();
//vehicleCapacity = Nan::To<std::int32_t>(maybeVehicleCapacity.ToLocalChecked()).FromJust();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why commented out?

std::int32_t vehicleDepot_, //
std::int32_t timeHorizon_, //
std::int32_t vehicleCapacity_, //
std::vector<int64> vehicleCapacity_, // type changed to vector int64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change from int32s to int64s?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was because the AddDimensionWithVehicleCapacity() takes long long integer array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants