adding multiple capacity vehicle capability#29
Open
Abhishekrana254 wants to merge 1 commit intomapbox:masterfrom
Open
adding multiple capacity vehicle capability#29Abhishekrana254 wants to merge 1 commit intomapbox:masterfrom
Abhishekrana254 wants to merge 1 commit intomapbox:masterfrom
Conversation
daniel-j-h
suggested changes
Aug 7, 2017
| if (!num->IsNumber()) | ||
| throw std::runtime_error{"Expected array element of types Number"}; | ||
|
|
||
| //std::cout<<"hello"<<std::endl; |
Contributor
There was a problem hiding this comment.
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) { |
Contributor
There was a problem hiding this comment.
Why is this function needed?
|
|
||
| struct TSPWorker final : Nan::AsyncWorker { | ||
| using Base = Nan::AsyncWorker; | ||
| struct TSPWorker final { |
Contributor
There was a problem hiding this comment.
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() { |
Contributor
There was a problem hiding this comment.
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 |
| 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"}; |
| 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"}; |
| 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() |
| 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(); |
| std::int32_t vehicleDepot_, // | ||
| std::int32_t timeHorizon_, // | ||
| std::int32_t vehicleCapacity_, // | ||
| std::vector<int64> vehicleCapacity_, // type changed to vector int64 |
Contributor
There was a problem hiding this comment.
Why the change from int32s to int64s?
Author
There was a problem hiding this comment.
it was because the AddDimensionWithVehicleCapacity() takes long long integer array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.