Optimization Service Stay organized with collections Save and categorize content based on your preferences.
AI-generated Key Takeaways
The linear optimization service is used to model and solve linear and mixed-integer linear programs.
Key classes for this service include
LinearOptimizationConstraint,LinearOptimizationEngine,LinearOptimizationService, andLinearOptimizationSolution.The
LinearOptimizationEngineis used to build the linear program model by adding constraints and variables, and setting the optimization direction.The
LinearOptimizationSolutionprovides methods to retrieve the objective value, the status of the solution, and the values of the variables.The
Statusproperty indicates the result of the solve operation, such asOPTIMAL,FEASIBLE, orINFEASIBLE.
The linear optimization service, used to model and solve linear and mixed-integer linearprograms.
Classes
| Name | Brief description |
|---|---|
Linear | Object storing a linear constraint of the formlowerwherelower andupper are constants,a(i) are constantcoefficients andx(i) are variables (unknowns). |
Linear | The engine used to model and solve a linear program. |
Linear | The linear optimization service, used to model and solve linear and mixed-integer linearprograms. |
Linear | The solution of a linear program. |
Status | Status of the solution. |
Variable | Type of variables created by the engine. |
LinearOptimizationConstraint
Methods
| Method | Return type | Brief description |
|---|---|---|
set | Linear | Sets the coefficient of a variable in the constraint. |
LinearOptimizationEngine
Methods
LinearOptimizationService
Properties
| Property | Type | Description |
|---|---|---|
Status | Status | Status of the solver. |
Variable | Variable | Type of variables created by the solver. |
Methods
| Method | Return type | Brief description |
|---|---|---|
create | Linear | Creates an engine to to solve linear programs (potentially mixed-integer programs). |
LinearOptimizationSolution
Methods
| Method | Return type | Brief description |
|---|---|---|
get | Number | Gets the value of the objective function in the current solution. |
get | Status | Gets the status of the solution. |
get | Number | Gets the value of a variable in the solution created by the last call toLinear. |
is | Boolean | Determines whether the solution is either feasible or optimal. |
Status
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 whenLinear has not been called yet. |
VariableType
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. |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-02 UTC.