Google OR-Tools
v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
LinearExpr.java
Go to the documentation of this file.
1
// Copyright 2010-2024 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
package
com.google.ortools.modelbuilder;
15
17
public
interface
LinearExpr
extends
LinearArgument {
19
int
numElements
();
20
22
int
getVariableIndex
(
int
index);
23
25
double
getCoefficient
(
int
index);
26
28
double
getOffset
();
29
31
static
LinearExprBuilder
newBuilder
() {
32
return
new
LinearExprBuilder
();
33
}
34
36
static
LinearExpr
constant
(
double
value) {
37
return
newBuilder
().
add
(value).
build
();
38
}
39
41
static
LinearExpr
term
(
LinearArgument
expr,
double
coeff) {
42
return
newBuilder
().
addTerm
(expr, coeff).
build
();
43
}
44
46
static
LinearExpr
affine
(
LinearArgument
expr,
double
coeff,
double
offset) {
47
return
newBuilder
().
addTerm
(expr, coeff).
add
(offset).
build
();
48
}
49
51
static
LinearExpr
sum
(
LinearArgument
[] exprs) {
52
return
newBuilder
().
addSum
(exprs).
build
();
53
}
54
56
static
LinearExpr
weightedSum
(
LinearArgument
[] exprs,
double
[] coeffs) {
57
return
newBuilder
().
addWeightedSum
(exprs, coeffs).
build
();
58
}
59
}
com.google.ortools.modelbuilder.LinearExprBuilder
Definition
LinearExprBuilder.java:20
com.google.ortools.modelbuilder.LinearExprBuilder.addWeightedSum
LinearExprBuilder addWeightedSum(LinearArgument[] exprs, double[] coeffs)
Definition
LinearExprBuilder.java:56
com.google.ortools.modelbuilder.LinearExprBuilder.build
LinearExpr build()
Definition
LinearExprBuilder.java:78
com.google.ortools.modelbuilder.LinearExprBuilder.addTerm
LinearExprBuilder addTerm(LinearArgument expr, double coeff)
Definition
LinearExprBuilder.java:39
com.google.ortools.modelbuilder.LinearExprBuilder.addSum
LinearExprBuilder addSum(LinearArgument[] exprs)
Definition
LinearExprBuilder.java:49
com.google.ortools.modelbuilder.LinearExprBuilder.add
LinearExprBuilder add(LinearArgument expr)
Definition
LinearExprBuilder.java:29
com.google.ortools.modelbuilder.LinearArgument
Definition
LinearArgument.java:21
com.google.ortools.modelbuilder.LinearExpr
Definition
LinearExpr.java:17
com.google.ortools.modelbuilder.LinearExpr.weightedSum
static LinearExpr weightedSum(LinearArgument[] exprs, double[] coeffs)
Definition
LinearExpr.java:56
com.google.ortools.modelbuilder.LinearExpr.getCoefficient
double getCoefficient(int index)
com.google.ortools.modelbuilder.LinearExpr.constant
static LinearExpr constant(double value)
Definition
LinearExpr.java:36
com.google.ortools.modelbuilder.LinearExpr.term
static LinearExpr term(LinearArgument expr, double coeff)
Definition
LinearExpr.java:41
com.google.ortools.modelbuilder.LinearExpr.getOffset
double getOffset()
com.google.ortools.modelbuilder.LinearExpr.getVariableIndex
int getVariableIndex(int index)
com.google.ortools.modelbuilder.LinearExpr.sum
static LinearExpr sum(LinearArgument[] exprs)
Definition
LinearExpr.java:51
com.google.ortools.modelbuilder.LinearExpr.affine
static LinearExpr affine(LinearArgument expr, double coeff, double offset)
Definition
LinearExpr.java:46
com.google.ortools.modelbuilder.LinearExpr.numElements
int numElements()
com.google.ortools.modelbuilder.LinearExpr.newBuilder
static LinearExprBuilder newBuilder()
Definition
LinearExpr.java:31
ortools
java
com
google
ortools
modelbuilder
LinearExpr.java
Generated by
1.12.0