This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
forked from rte-france/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouting.i
164 lines (149 loc) · 6.45 KB
/
routing.i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// Copyright 2010-2018 Google LLC
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// TODO(user): Refactor this file to adhere to the SWIG style guide.
%include "ortools/constraint_solver/csharp/constraint_solver.i"
%include "ortools/constraint_solver/csharp/routing_types.i"
%include "ortools/constraint_solver/csharp/routing_index_manager.i"
// We need to forward-declare the proto here, so that PROTO_INPUT involving it
// works correctly. The order matters very much: this declaration needs to be
// before the %{ #include ".../routing.h" %}.
namespace operations_research {
class RoutingModelParameters;
class RoutingSearchParameters;
} // namespace operations_research
// Include the file we want to wrap a first time.
%{
#include "ortools/constraint_solver/routing.h"
#include "ortools/constraint_solver/routing_index_manager.h"
#include "ortools/constraint_solver/routing_parameters.h"
#include "ortools/constraint_solver/routing_parameters.pb.h"
#include "ortools/constraint_solver/routing_types.h"
%}
%module(directors="1") operations_research;
// RoutingModel methods.
DEFINE_INDEX_TYPE_TYPEDEF(
operations_research::RoutingCostClassIndex,
operations_research::RoutingModel::CostClassIndex);
DEFINE_INDEX_TYPE_TYPEDEF(
operations_research::RoutingDimensionIndex,
operations_research::RoutingModel::DimensionIndex);
DEFINE_INDEX_TYPE_TYPEDEF(
operations_research::RoutingDisjunctionIndex,
operations_research::RoutingModel::DisjunctionIndex);
DEFINE_INDEX_TYPE_TYPEDEF(
operations_research::RoutingVehicleClassIndex,
operations_research::RoutingModel::VehicleClassIndex);
namespace operations_research {
// RoutingModel
%unignore RoutingModel;
%typemap(cscode) RoutingModel %{
// Keep reference to delegate to avoid GC to collect them early.
private List<LongToLong> unaryTransitCallbacks;
private LongToLong StoreLongToLong(LongToLong c) {
if (unaryTransitCallbacks == null)
unaryTransitCallbacks = new List<LongToLong>();
unaryTransitCallbacks.Add(c);
return c;
}
private List<LongLongToLong> transitCallbacks;
private LongLongToLong StoreLongLongToLong(LongLongToLong c) {
if (transitCallbacks == null)
transitCallbacks = new List<LongLongToLong>();
transitCallbacks.Add(c);
return c;
}
private List<VoidToVoid> solutionCallbacks;
private VoidToVoid StoreVoidToVoid(VoidToVoid c) {
if (solutionCallbacks == null)
solutionCallbacks = new List<VoidToVoid>();
solutionCallbacks.Add(c);
return c;
}
%}
// Ignored:
%ignore RoutingModel::AddDimensionDependentDimensionWithVehicleCapacity;
%ignore RoutingModel::AddHardTypeIncompatibility;
%ignore RoutingModel::AddMatrixDimension(
std::vector<std::vector<int64> > values,
int64 capacity,
bool fix_start_cumul_to_zero,
const std::string& name);
%ignore RoutingModel::AddSameVehicleRequiredTypeAlternatives;
%ignore RoutingModel::AddTemporalRequiredTypeAlternatives;
%ignore RoutingModel::AddTemporalTypeIncompatibility;
%ignore RoutingModel::CloseVisitTypes;
%ignore RoutingModel::GetAllDimensionNames;
%ignore RoutingModel::GetDeliveryIndexPairs;
%ignore RoutingModel::GetDimensions;
%ignore RoutingModel::GetDimensionsWithSoftAndSpanCosts;
%ignore RoutingModel::GetDimensionsWithSoftOrSpanCosts;
%ignore RoutingModel::GetHardTypeIncompatibilitiesOfType;
%ignore RoutingModel::GetPerfectBinaryDisjunctions;
%ignore RoutingModel::GetPickupIndexPairs;
%ignore RoutingModel::GetSameVehicleRequiredTypeAlternativesOfType;
%ignore RoutingModel::GetTemporalRequiredTypeAlternativesOfType;
%ignore RoutingModel::GetTemporalTypeIncompatibilitiesOfType;
%ignore RoutingModel::HasHardTypeIncompatibilities;
%ignore RoutingModel::HasSameVehicleTypeRequirements;
%ignore RoutingModel::HasTemporalTypeIncompatibilities;
%ignore RoutingModel::HasTemporalTypeRequirements;
%ignore RoutingModel::HasTypeRegulations;
%ignore RoutingModel::MakeStateDependentTransit;
%ignore RoutingModel::RegisterStateDependentTransitCallback;
%ignore RoutingModel::StateDependentTransitCallback;
%ignore RoutingModel::SolveWithParameters(
const RoutingSearchParameters& search_parameters,
std::vector<const Assignment*>* solutions);
%ignore RoutingModel::SolveFromAssignmentWithParameters(
const Assignment* assignment,
const RoutingSearchParameters& search_parameters,
std::vector<const Assignment*>* solutions);
%ignore RoutingModel::TransitCallback;
%ignore RoutingModel::UnaryTransitCallbackOrNull;
// RoutingDimension
%unignore RoutingDimension;
%typemap(cscode) RoutingDimension %{
// Keep reference to delegate to avoid GC to collect them early.
private List<IntIntToLong> limitCallbacks;
private IntIntToLong StoreIntIntToLong(IntIntToLong limit) {
if (limitCallbacks == null)
limitCallbacks = new List<IntIntToLong>();
limitCallbacks.Add(limit);
return limit;
}
private List<LongLongToLong> groupDelayCallbacks;
private LongLongToLong StoreLongLongToLong(LongLongToLong groupDelay) {
if (groupDelayCallbacks == null)
groupDelayCallbacks = new List<LongLongToLong>();
groupDelayCallbacks.Add(groupDelay);
return groupDelay;
}
%}
} // namespace operations_research
%rename("GetStatus") operations_research::RoutingModel::status;
%rename("%(camelcase)s", %$isfunction) "";
// Protobuf support
PROTO_INPUT(operations_research::RoutingSearchParameters,
Google.OrTools.ConstraintSolver.RoutingSearchParameters,
search_parameters)
PROTO_INPUT(operations_research::RoutingModelParameters,
Google.OrTools.ConstraintSolver.RoutingModelParameters,
parameters)
PROTO2_RETURN(operations_research::RoutingSearchParameters,
Google.OrTools.ConstraintSolver.RoutingSearchParameters)
PROTO2_RETURN(operations_research::RoutingModelParameters,
Google.OrTools.ConstraintSolver.RoutingModelParameters)
// TODO(user): Replace with %ignoreall/%unignoreall
//swiglint: disable include-h-allglobals
%include "ortools/constraint_solver/routing_parameters.h"
%include "ortools/constraint_solver/routing.h"