OR-Tools 7.2
Main Page
Namespaces
Classes
Files
File List
File Members
ortools
constraint_solver
csharp
IntervalVarArrayHelper.cs
Go to the documentation of this file.
1
// Copyright 2010-2018 Google LLC
2
// Licensed under the Apache License, Version 2.0 (the "License");
3
// you may not use this file except in compliance with the License.
4
// You may obtain a copy of the License at
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software
9
// distributed under the License is distributed on an "AS IS" BASIS,
10
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
// See the License for the specific language governing permissions and
12
// limitations under the License.
13
14
namespace
Google.OrTools.ConstraintSolver
15
{
16
using
System;
17
using
System.
Collections
.Generic;
18
19
// IntervalVar[] helper class.
20
public
static
class
IntervalVarArrayHelper
21
{
22
// get solver from array of interval variables
23
private
static
Solver
GetSolver(
IntervalVar
[] vars)
24
{
25
if
(vars ==
null
|| vars.Length <= 0)
26
throw
new
ArgumentException(
"Array <vars> cannot be null or empty"
);
27
28
return
vars[0].
solver
();
29
}
30
public
static
DisjunctiveConstraint
Disjunctive
(
this
IntervalVar
[] vars,
31
String name)
32
{
33
Solver
solver = GetSolver(vars);
34
return
solver.
MakeDisjunctiveConstraint
(vars, name);
35
}
36
public
static
Constraint
Cumulative
(
this
IntervalVar
[] vars,
37
long
[] demands,
38
long
capacity,
39
String name)
40
{
41
Solver
solver = GetSolver(vars);
42
return
solver.
MakeCumulative
(vars, demands, capacity, name);
43
}
44
public
static
Constraint
Cumulative
(
this
IntervalVar
[] vars,
45
int
[] demands,
46
long
capacity,
47
String name)
48
{
49
Solver
solver = GetSolver(vars);
50
return
solver.
MakeCumulative
(vars, demands, capacity, name);
51
}
52
}
53
}
// namespace Google.OrTools.ConstraintSolver
Google.OrTools.ConstraintSolver.DisjunctiveConstraint
Definition:
DisjunctiveConstraint.cs:18
Google.OrTools.ConstraintSolver.IntervalVarArrayHelper
Definition:
IntervalVarArrayHelper.cs:20
Google.OrTools.ConstraintSolver.Constraint
Definition:
constraint_solver/Constraint.cs:18
Google.OrTools.ConstraintSolver.Solver.MakeDisjunctiveConstraint
DisjunctiveConstraint MakeDisjunctiveConstraint(IntervalVarVector intervals, string name)
Definition:
constraint_solver/Solver.cs:1675
Google.OrTools.ConstraintSolver.Solver.MakeCumulative
Constraint MakeCumulative(IntervalVarVector intervals, long[] demands, long capacity, string name)
Definition:
constraint_solver/Solver.cs:1689
Google.OrTools.ConstraintSolver.PropagationBaseObject.solver
Solver solver()
Definition:
PropagationBaseObject.cs:50
Collections
Google.OrTools.ConstraintSolver.IntervalVar
Definition:
IntervalVar.cs:18
Google.OrTools.ConstraintSolver
Definition:
Assignment.cs:11
Google.OrTools.ConstraintSolver.IntervalVarArrayHelper.Cumulative
static Constraint Cumulative(this IntervalVar[] vars, int[] demands, long capacity, String name)
Definition:
IntervalVarArrayHelper.cs:44
Google.OrTools.ConstraintSolver.Solver
Definition:
constraint_solver/Solver.cs:18
Google.OrTools.ConstraintSolver.IntervalVarArrayHelper.Disjunctive
static DisjunctiveConstraint Disjunctive(this IntervalVar[] vars, String name)
Definition:
IntervalVarArrayHelper.cs:30
Google.OrTools.ConstraintSolver.IntervalVarArrayHelper.Cumulative
static Constraint Cumulative(this IntervalVar[] vars, long[] demands, long capacity, String name)
Definition:
IntervalVarArrayHelper.cs:36