DotNet Reference

DotNet Reference

operations_research_constraint_solver.cs
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 4.0.1
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10 
12 
14  public static long CpRandomSeed() {
16  return ret;
17  }
18 
19  public static long Zero() {
21  return ret;
22  }
23 
24  public static long One() {
26  return ret;
27  }
28 
29  public static void SetAssignmentFromAssignment(Assignment target_assignment, IntVarVector target_vars, Assignment source_assignment, IntVarVector source_vars) {
30  operations_research_constraint_solverPINVOKE.SetAssignmentFromAssignment(Assignment.getCPtr(target_assignment), IntVarVector.getCPtr(target_vars), Assignment.getCPtr(source_assignment), IntVarVector.getCPtr(source_vars));
32  }
33 
34  public static bool AreAllBound(IntVarVector vars) {
37  return ret;
38  }
39 
40  public static bool AreAllBooleans(IntVarVector vars) {
43  return ret;
44  }
45 
46  public static bool AreAllBoundTo(IntVarVector vars, long value) {
49  return ret;
50  }
51 
52  public static long MaxVarArray(IntVarVector vars) {
55  return ret;
56  }
57 
58  public static long MinVarArray(IntVarVector vars) {
61  return ret;
62  }
63 
64  public static long PosIntDivUp(long e, long v) {
66  return ret;
67  }
68 
69  public static long PosIntDivDown(long e, long v) {
71  return ret;
72  }
73 
74  public static long[] ToInt64Vector( int[] input) {
75  global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.ToInt64Vector( input.Length, input );
76  Int64Vector tmpVector = null;
77  if (cPtr != global::System.IntPtr.Zero) {
78  tmpVector = new Int64Vector(cPtr, true);
79  long[] outArray = new long[tmpVector.Count];
80  tmpVector.CopyTo(outArray);
81  return outArray;
82  }
83  return null;
84 }
85 
87  byte[] tmp = new byte[4];
89  System.Runtime.InteropServices.Marshal.Copy(data, tmp, 0, 4);
90  int size = System.BitConverter.ToInt32(tmp, 0);
91  byte[] buf = new byte[size + 4];
92  System.Runtime.InteropServices.Marshal.Copy(data, buf, 0, size + 4);
93  // TODO(user): delete the C++ buffer.
94  try {
95  Google.Protobuf.CodedInputStream input =
96  new Google.Protobuf.CodedInputStream(buf, 4, size);
98  proto.MergeFrom(input);
99  return proto;
100  } catch (Google.Protobuf.InvalidProtocolBufferException /*e*/) {
101  throw new System.Exception(
102  "Unable to parse Google.OrTools.ConstraintSolver.RoutingModelParameters protocol message.");
103  }
104 }
105 
107  byte[] tmp = new byte[4];
109  System.Runtime.InteropServices.Marshal.Copy(data, tmp, 0, 4);
110  int size = System.BitConverter.ToInt32(tmp, 0);
111  byte[] buf = new byte[size + 4];
112  System.Runtime.InteropServices.Marshal.Copy(data, buf, 0, size + 4);
113  // TODO(user): delete the C++ buffer.
114  try {
115  Google.Protobuf.CodedInputStream input =
116  new Google.Protobuf.CodedInputStream(buf, 4, size);
118  proto.MergeFrom(input);
119  return proto;
120  } catch (Google.Protobuf.InvalidProtocolBufferException /*e*/) {
121  throw new System.Exception(
122  "Unable to parse Google.OrTools.ConstraintSolver.RoutingSearchParameters protocol message.");
123  }
124 }
125 
127  string ret = operations_research_constraint_solverPINVOKE.FindErrorInRoutingSearchParameters(search_parameters.CalculateSize(), ProtoHelper.ProtoToByteArray(search_parameters));
128  return ret;
129  }
130 
131  public static DecisionBuilder MakeSetValuesFromTargets(Solver solver, IntVarVector variables, long[] targets) {
132  global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.MakeSetValuesFromTargets(Solver.getCPtr(solver), IntVarVector.getCPtr(variables), targets.Length, targets );
133  DecisionBuilder ret = (cPtr == global::System.IntPtr.Zero) ? null : new DecisionBuilder(cPtr, false);
135  return ret;
136  }
137 
138  public static bool SolveModelWithSat(RoutingModel model, Google.OrTools.ConstraintSolver.RoutingSearchParameters search_parameters, Assignment initial_solution, Assignment solution) {
139  bool ret = operations_research_constraint_solverPINVOKE.SolveModelWithSat(RoutingModel.getCPtr(model), search_parameters.CalculateSize(), ProtoHelper.ProtoToByteArray(search_parameters), Assignment.getCPtr(initial_solution), Assignment.getCPtr(solution));
141  return ret;
142  }
143 
144  // VarTypes
154 
155 }
156 
157 }
static int CST_SUB_VAR_get()
static bool SolveModelWithSat(global::System.Runtime.InteropServices.HandleRef jarg1, int search_parameters_size, byte[] jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4)
static bool AreAllBoundTo(IntVarVector vars, long value)
static bool AreAllBound(IntVarVector vars)
static long One()
void MergeFrom(RoutingSearchParameters other)
static global::System.IntPtr ToInt64Vector(int length1, int[] jarg1)
static long[] ToInt64Vector(int[] input)
static void SetAssignmentFromAssignment(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4)
static readonly int CONST_VAR
static bool AreAllBooleans(IntVarVector vars)
static int TRACE_VAR_get()
static bool Pending
static long PosIntDivUp(long jarg1, long jarg2)
static DecisionBuilder MakeSetValuesFromTargets(Solver solver, IntVarVector variables, long[] targets)
static byte[] ProtoToByteArray(IMessage message)
Definition: ProtoHelper.cs:21
static int DOMAIN_INT_VAR_get()
Definition: Assignment.cs:11
Parameters which have to be set when creating a RoutingModel.
Definition: IntVarVector.cs:19
static long PosIntDivDown(long jarg1, long jarg2)
static bool AreAllBoundTo(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static int OPP_VAR_get()
static long MaxVarArray(IntVarVector vars)
static int VAR_TIMES_CST_get()
Definition: RoutingModel.cs:18
static int BOOLEAN_VAR_get()
static readonly int VAR_ADD_CST
static int UNSPECIFIED_get()
static string FindErrorInRoutingSearchParameters(Google.OrTools.ConstraintSolver.RoutingSearchParameters search_parameters)
static long Zero()
static int VAR_ADD_CST_get()
void MergeFrom(RoutingModelParameters other)
static readonly int CST_SUB_VAR
static long One()
static readonly int VAR_TIMES_CST
static long MaxVarArray(global::System.Runtime.InteropServices.HandleRef jarg1)
static readonly int UNSPECIFIED
static readonly int OPP_VAR
static readonly int TRACE_VAR
static bool AreAllBooleans(global::System.Runtime.InteropServices.HandleRef jarg1)
static Google.OrTools.ConstraintSolver.RoutingModelParameters DefaultRoutingModelParameters()
void CopyTo(long[] array)
static Google.OrTools.ConstraintSolver.RoutingSearchParameters DefaultRoutingSearchParameters()
static string FindErrorInRoutingSearchParameters(int search_parameters_size, byte[] jarg1)
Definition: Assignment.cs:18
static long CpRandomSeed()
static readonly int BOOLEAN_VAR
static long MinVarArray(global::System.Runtime.InteropServices.HandleRef jarg1)
static long PosIntDivUp(long e, long v)
static bool AreAllBound(global::System.Runtime.InteropServices.HandleRef jarg1)
static int CONST_VAR_get()
static System.IntPtr DefaultRoutingModelParameters()
static long PosIntDivDown(long e, long v)
Definition: ProtoHelper.cs:20
static readonly int DOMAIN_INT_VAR
static global::System.Exception Retrieve()
static System.IntPtr DefaultRoutingSearchParameters()
static long Zero()
static global::System.IntPtr MakeSetValuesFromTargets(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int length3, long[] jarg3)
static long MinVarArray(IntVarVector vars)
int Count
static bool SolveModelWithSat(RoutingModel model, Google.OrTools.ConstraintSolver.RoutingSearchParameters search_parameters, Assignment initial_solution, Assignment solution)
static long CpRandomSeed()
static void SetAssignmentFromAssignment(Assignment target_assignment, IntVarVector target_vars, Assignment source_assignment, IntVarVector source_vars)
Parameters defining the search used to solve vehicle routing problems.