windows compilation fixes

This commit is contained in:
Laurent Perron
2016-02-04 05:04:38 -08:00
parent ba0e3e5945
commit 7a7d4cd8dd
8 changed files with 811 additions and 794 deletions

View File

@@ -803,11 +803,13 @@ class NetworkRoutingSolver {
}
// DecisionBuilder.
DecisionBuilder* const db =
solver.MakePhase(decision_vars, Solver::CHOOSE_RANDOM,
[this, &usage_costs](int64 var, int64 value) {
return EvaluateMarginalCost(usage_costs, var, value);
});
Solver::IndexEvaluator2 eval_marginal_cost =
[this, &usage_costs](int64 var, int64 value) {
return EvaluateMarginalCost(usage_costs, var, value);
};
DecisionBuilder* const db = solver.MakePhase(
decision_vars, Solver::CHOOSE_RANDOM, eval_marginal_cost);
// Limits.
if (time_limit != 0 || fail_limit != 0) {
@@ -834,11 +836,8 @@ class NetworkRoutingSolver {
actual_usage_costs));
SearchLimit* const lns_limit =
solver.MakeLimit(kint64max, kint64max, FLAGS_lns_limit, kint64max);
DecisionBuilder* const inner_db =
solver.MakePhase(decision_vars, Solver::CHOOSE_RANDOM,
[this, &usage_costs](int64 var, int64 value) {
return EvaluateMarginalCost(usage_costs, var, value);
});
DecisionBuilder* const inner_db = solver.MakePhase(
decision_vars, Solver::CHOOSE_RANDOM, eval_marginal_cost);
DecisionBuilder* const apply = solver.RevAlloc(new ApplyMaxDiscrepancy);
DecisionBuilder* const max_discrepency_db = solver.Compose(apply, inner_db);

View File

@@ -470,8 +470,8 @@ CONSTRAINT_SOLVER_LIB_OBJS = \
$(SRC_DIR)/constraint_solver/constraint_solver.h: $(GEN_DIR)/constraint_solver/solver_parameters.pb.h
$(OBJ_DIR)/constraint_solver/alldiff_cst.$O:$(SRC_DIR)/constraint_solver/alldiff_cst.cc
$(CCC) $(CFLAGS) -c $(SRC_DIR)/constraint_solver/alldiff_cst.cc $(OBJ_OUT)$(OBJ_DIR)$Sconstraint_solver$Salldiff_cst.$O $(SRC_DIR)/constraint_solver/constraint_solver.h
$(OBJ_DIR)/constraint_solver/alldiff_cst.$O:$(SRC_DIR)/constraint_solver/alldiff_cst.cc $(SRC_DIR)/constraint_solver/constraint_solver.h
$(CCC) $(CFLAGS) -c $(SRC_DIR)/constraint_solver/alldiff_cst.cc $(OBJ_OUT)$(OBJ_DIR)$Sconstraint_solver$Salldiff_cst.$O
$(OBJ_DIR)/constraint_solver/assignment.$O:$(SRC_DIR)/constraint_solver/assignment.cc $(GEN_DIR)/constraint_solver/assignment.pb.h $(SRC_DIR)/constraint_solver/constraint_solver.h
$(CCC) $(CFLAGS) -c $(SRC_DIR)/constraint_solver/assignment.cc $(OBJ_OUT)$(OBJ_DIR)$Sconstraint_solver$Sassignment.$O

View File

@@ -215,6 +215,7 @@ $(GEN_DIR)/com/google/ortools/constraintsolver/RoutingEnums.g.cs: $(SRC_DIR)/con
# Main DLL
$(BIN_DIR)/$(CLR_DLL_NAME).dll: \
$(BIN_DIR)/Google.Protobuf.dll \
$(OBJ_DIR)/swig/linear_solver_csharp_wrap.$O \
$(OBJ_DIR)/swig/constraint_solver_csharp_wrap.$O \
$(OBJ_DIR)/swig/knapsack_solver_csharp_wrap.$O \

View File

@@ -86,7 +86,9 @@ build_third_party: \
install_swig \
install_coin_cbc \
install_glpk \
install_scip
install_scip \
install_bison \
install_csharp_protobuf
bin:
$(MKDIR_P) bin
@@ -288,9 +290,9 @@ dependencies\sources\protobuf-$(PROTOBUF_TAG)\cmake\build\protobuf.sln: dependen
-md dependencies\sources\protobuf-$(PROTOBUF_TAG)\cmake\build
tools\sed -i -e '/\"\/MD\"/d' dependencies\sources\protobuf-$(PROTOBUF_TAG)\cmake\CMakeLists.txt
ifeq ("$(PTRLENGTH)", "64")
cd dependencies\sources\protobuf-$(PROTOBUF_TAG)\cmake\build && cmake -G "Visual Studio 12 2013 Win64" -DBUILD_TESTING=OFF ..
cd dependencies\sources\protobuf-$(PROTOBUF_TAG)\cmake\build && cmake -G "Visual Studio 12 2013 Win64" -Dprotobuf_BUILD_TESTS=OFF ..
else
cd dependencies\sources\protobuf-$(PROTOBUF_TAG)\cmake\build && cmake -G "Visual Studio 12 2013" -DBUILD_TESTING=OFF ..
cd dependencies\sources\protobuf-$(PROTOBUF_TAG)\cmake\build && cmake -G "Visual Studio 12 2013" -protobuf_DBUILD_TESTS=OFF ..
endif
dependencies\sources\protobuf-$(PROTOBUF_TAG)\cmake\CMakeLists.txt:
@@ -426,6 +428,24 @@ dependencies\install\bin\win_bison.exe: dependencies\archives\win_flex_bison-$(B
dependencies\archives\win_flex_bison-$(BISON_FLEX_TAG).zip:
tools\wget -P dependencies\archives http://sourceforge.net/projects/winflexbison/files/win_flex_bison-$(BISON_FLEX_TAG).zip
# Install Java protobuf
install_java_protobuf: dependencies/install/lib/protobuf.jar
dependencies/install/lib/protobuf.jar: dependencies/install/bin/protoc.exe
cd dependencies\\sources\\protobuf-$(PROTOBUF_TAG)\\java && \
..\\..\\..\\install\\bin\\protoc --java_out=src\\main\\java -I..\\src \
..\\src\\google\\protobuf\\descriptor.proto
cd dependencies\\sources\\protobuf-$(PROTOBUF_TAG)\\java\\src\\main\\java && $(JAR_BIN) cvf ..\\..\\..\\..\\..\\..\\install\\lib\\protobuf.jar com\\google\\protobuf\\*java
# Install C# protobuf
install_csharp_protobuf: dependencies/install/bin/Google.Protobuf.dll
dependencies/install/bin/Google.Protobuf.dll:
$(COPY) tools\Google.Protobuf.dll dependencies\\install\\bin
# Clean everything.
clean_third_party:
-$(DEL) Makefile.local

File diff suppressed because it is too large Load Diff

View File

@@ -4287,16 +4287,14 @@ void RoutingModel::CreateFirstSolutionDecisionBuilders(
[this](int64 i, int64 j) { return GetArcCostForFirstSolution(i, j); },
Solver::CHOOSE_STATIC_GLOBAL_BEST);
// Cheapest addition heuristic.
Solver::IndexEvaluator2 eval = [this](int64 i, int64 j) {
return GetArcCostForFirstSolution(i, j);
};
first_solution_decision_builders_[FirstSolutionStrategy::LOCAL_CHEAPEST_ARC] =
solver_->MakePhase(nexts_, Solver::CHOOSE_FIRST_UNBOUND,
[this](int64 i, int64 j) {
return GetArcCostForFirstSolution(i, j);
});
solver_->MakePhase(nexts_, Solver::CHOOSE_FIRST_UNBOUND, eval);
// Path-based cheapest addition heuristic.
first_solution_decision_builders_[FirstSolutionStrategy::PATH_CHEAPEST_ARC] =
solver_->MakePhase(nexts_, Solver::CHOOSE_PATH, [this](int64 i, int64 j) {
return GetArcCostForFirstSolution(i, j);
});
solver_->MakePhase(nexts_, Solver::CHOOSE_PATH, eval);
if (vehicles() == 1) {
DecisionBuilder* fast_one_path_builder =
solver_->RevAlloc(new FastOnePathBuilder(
@@ -4322,20 +4320,19 @@ void RoutingModel::CreateFirstSolutionDecisionBuilders(
[FirstSolutionStrategy::PATH_CHEAPEST_ARC]);
}
// Path-based most constrained arc addition heuristic.
Solver::VariableValueComparator comp = [this](int64 i, int64 j, int64 k) {
return ArcIsMoreConstrainedThanArc(i, j, k);
};
first_solution_decision_builders_
[FirstSolutionStrategy::PATH_MOST_CONSTRAINED_ARC] = solver_->MakePhase(
nexts_, Solver::CHOOSE_PATH, [this](int64 i, int64 j, int64 k) {
return ArcIsMoreConstrainedThanArc(i, j, k);
});
nexts_, Solver::CHOOSE_PATH, comp);
if (search_parameters.use_filtered_first_solution_strategy()) {
first_solution_filtered_decision_builders_
[FirstSolutionStrategy::PATH_MOST_CONSTRAINED_ARC] = solver_->RevAlloc(
new ComparatorCheapestAdditionFilteredDecisionBuilder(
this,
[this](int64 i, int64 j, int64 k) {
return ArcIsMoreConstrainedThanArc(i, j, k);
},
GetOrCreateFeasibilityFilters()));
[FirstSolutionStrategy::PATH_MOST_CONSTRAINED_ARC] =
solver_->RevAlloc(
new ComparatorCheapestAdditionFilteredDecisionBuilder(
this, comp, GetOrCreateFeasibilityFilters()));
first_solution_decision_builders_
[FirstSolutionStrategy::PATH_MOST_CONSTRAINED_ARC] = solver_->Try(
first_solution_filtered_decision_builders_

View File

@@ -60,7 +60,7 @@
%typemap(out) const std::vector<CType>& %{
$result = jenv->New ## JavaTypeName ## Array($1->size());
jenv->Set ## JavaTypeName ## ArrayRegion(
$result, 0, $1->size(), reinterpret_cast<j ## JavaType*>(&(*$1)[0]));
$result, 0, $1->size(), reinterpret_cast<const j ## JavaType*>($1->data()));
%}
%typemap(javaout) const std::vector<CType>& {
return $jnicall;
@@ -91,7 +91,7 @@
%typemap(out) std::vector<CType> %{
const std::vector<CType>& vec = $1;
$result = jenv->New ## JavaTypeName ## Array(vec.size());
jenv->Set ## JavaTypeName ## ArrayRegion($result, 0, vec.size(), vec.data());
jenv->Set ## JavaTypeName ## ArrayRegion($result, 0, vec.size(), reinterpret_cast<const j ## JavaType*>(vec.data()));
%}
%typemap(javaout) std::vector<CType> {
return $jnicall;

View File

@@ -141,7 +141,7 @@ inline RangeMinimumIndexQuery<T, Compare>::RangeMinimumIndexQuery(
template <typename T, typename Compare>
RangeMinimumIndexQuery<T, Compare>::RangeMinimumIndexQuery(std::vector<T> array,
Compare cmp)
: cmp_{std::move(array), std::move(cmp)},
: cmp_({std::move(array), std::move(cmp)}),
rmq_(CreateIndexVector(cmp_.array.size()), cmp_) {}
template <typename T, typename Compare>