Send feedback
Optimization Service
Stay organized with collections
Save and categorize content based on your preferences.
Optimization
The linear optimization service, used to model and solve linear and mixed-integer linear
programs.
Classes
Methods
Method Return type Brief description
addConstraint(lowerBound, upperBound)
LinearOptimizationConstraint
Adds a new linear constraint in the model.
addConstraints(lowerBounds, upperBounds, variableNames, coefficients)
LinearOptimizationEngine
Adds constraints in batch to the model.
addVariable(name, lowerBound, upperBound)
LinearOptimizationEngine
Adds a new continuous variable to the model.
addVariable(name, lowerBound, upperBound, type)
LinearOptimizationEngine
Adds a new variable to the model.
addVariable(name, lowerBound, upperBound, type, objectiveCoefficient)
LinearOptimizationEngine
Adds a new variable to the model.
addVariables(names, lowerBounds, upperBounds, types, objectiveCoefficients)
LinearOptimizationEngine
Adds variables in batch to the model.
setMaximization()
LinearOptimizationEngine
Sets the optimization direction to maximizing the linear objective function.
setMinimization()
LinearOptimizationEngine
Sets the optimization direction to minimizing the linear objective function.
setObjectiveCoefficient(variableName, coefficient)
LinearOptimizationEngine
Sets the coefficient of a variable in the linear objective function.
solve()
LinearOptimizationSolution
Solves the current linear program with the default deadline of 30 seconds.
solve(seconds)
LinearOptimizationSolution
Solves the current linear program.
Properties
Property Type Description
Status
Status
Status of the solver.
VariableType
VariableType
Type of variables created by the solver.
Properties
Property Type Description
OPTIMAL
Enum
Status when an optimal solution has been found.
FEASIBLE
Enum
Status when a feasible (not necessarily optimal) solution has been found.
INFEASIBLE
Enum
Status when the current model is unfeasible (has no solution).
UNBOUNDED
Enum
Status when the current model is unbound.
ABNORMAL
Enum
Status when it failed to find a solution for unexpected reasons.
MODEL_INVALID
Enum
Status when the model is invalid.
NOT_SOLVED
Enum
Status when LinearOptimizationEngine.solve()
has not been called yet.
Properties
Property Type Description
INTEGER
Enum
Type of variable that can only take integer values.
CONTINUOUS
Enum
Type of variable that can take any real value.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2019-05-20 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{
"lastModified": "Last updated 2019-05-20 UTC.",
"confidential": False
}