# LinearSystem

Artifact: [androidx.constraintlayout:constraintlayout-core](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/core/LinearSystem.java+class:androidx.constraintlayout.core.LinearSystem) Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

*** ** * ** ***


```
public class LinearSystem
```

<br />

*** ** * ** ***

Represents and solves a system of linear equations.

## Summary

| ### Constants |
|---|---|
| `static final boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#DEBUG() = false` |
| `static final boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#FULL_DEBUG() = false` |

| ### Public fields |
|---|---|
| `static long` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#ARRAY_ROW_CREATION()` |
| `static long` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#OPTIMIZED_ARRAY_ROW_CREATION()` |
| `static boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#OPTIMIZED_ENGINE()` |
| `static boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#SIMPLIFY_SYNONYMS()` |
| `static boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#SKIP_COLUMNS()` |
| `static boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#USE_BASIC_SYNONYMS()` |
| `static boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#USE_DEPENDENCY_ORDERING()` |
| `static boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#USE_SYNONYMS()` |
| `boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#graphOptimizer()` |
| `boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#hasSimpleDefinition()` |
| `boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#newgraphOptimizer()` |
| `static https://developer.android.com/reference/androidx/constraintlayout/core/Metrics` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#sMetrics()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#LinearSystem()()` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#addCenterPoint(androidx.constraintlayout.core.widgets.ConstraintWidget,androidx.constraintlayout.core.widgets.ConstraintWidget,float,int)( https://developer.android.com/reference/androidx/constraintlayout/core/widgets/ConstraintWidget widget, https://developer.android.com/reference/androidx/constraintlayout/core/widgets/ConstraintWidget target, float angle, int radius )` Add the equations constraining a widget center to another widget center, positioned on a circle, following an angle and radius |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#addCentering(androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,int,float,androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,int,int)( https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b, int m1, float bias, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable c, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable d, int m2, int strength )` Add an equation of the form (1 - bias) \* (a - b) = bias \* (c - d) |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#addConstraint(androidx.constraintlayout.core.ArrayRow)(https://developer.android.com/reference/androidx/constraintlayout/core/ArrayRow row)` Add the equation to the system |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#addEquality(androidx.constraintlayout.core.SolverVariable,int)(https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a, int value)` Add an equation of the form a = value |
| `https://developer.android.com/reference/androidx/constraintlayout/core/ArrayRow` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#addEquality(androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,int,int)(https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b, int margin, int strength)` Add an equation of the form a = b + margin |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#addGreaterBarrier(androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,int,boolean)( https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b, int margin, boolean hasMatchConstraintWidgets )` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#addGreaterThan(androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,int,int)( https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b, int margin, int strength )` Add an equation of the form a \>= b + margin |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#addLowerBarrier(androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,int,boolean)( https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b, int margin, boolean hasMatchConstraintWidgets )` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#addLowerThan(androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,int,int)( https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b, int margin, int strength )` Add an equation of the form a \<= b + margin |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#addRatio(androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,float,int)( https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable c, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable d, float ratio, int strength )` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#addSynonym(androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,int)(https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b, int margin)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#createErrorVariable(int,java.lang.String)(int strength, https://developer.android.com/reference/java/lang/String.html prefix)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#createExtraVariable()()` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#createObjectVariable(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html anchor)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/ArrayRow` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#createRow()()` |
| `static https://developer.android.com/reference/androidx/constraintlayout/core/ArrayRow` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#createRowDimensionPercent(androidx.constraintlayout.core.LinearSystem,androidx.constraintlayout.core.SolverVariable,androidx.constraintlayout.core.SolverVariable,float)( https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem linearSystem, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable variableA, https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable variableC, float percent )` Create a constraint to express A = C \* percent |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#createSlackVariable()()` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#displayReadableRows()()` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#displayVariablesReadableRows()()` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#fillMetrics(androidx.constraintlayout.core.Metrics)(https://developer.android.com/reference/androidx/constraintlayout/core/Metrics metrics)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/Cache` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#getCache()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#getMemoryUsed()()` |
| `static https://developer.android.com/reference/androidx/constraintlayout/core/Metrics` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#getMetrics()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#getNumEquations()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#getNumVariables()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#getObjectVariableValue(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html object)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#minimize()()` Minimize the current goal of the system. |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#removeRow(androidx.constraintlayout.core.ArrayRow)(https://developer.android.com/reference/androidx/constraintlayout/core/ArrayRow row)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem#reset()()` Reset the LinearSystem object so that it can be reused. |

## Constants

### DEBUG

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static final boolean DEBUG = false
```

### FULL_DEBUG

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static final boolean FULL_DEBUG = false
```

## Public fields

### ARRAY_ROW_CREATION

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static long ARRAY_ROW_CREATION
```

### OPTIMIZED_ARRAY_ROW_CREATION

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static long OPTIMIZED_ARRAY_ROW_CREATION
```

### OPTIMIZED_ENGINE

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static boolean OPTIMIZED_ENGINE
```

### SIMPLIFY_SYNONYMS

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static boolean SIMPLIFY_SYNONYMS
```

### SKIP_COLUMNS

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static boolean SKIP_COLUMNS
```

### USE_BASIC_SYNONYMS

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static boolean USE_BASIC_SYNONYMS
```

### USE_DEPENDENCY_ORDERING

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static boolean USE_DEPENDENCY_ORDERING
```

### USE_SYNONYMS

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static boolean USE_SYNONYMS
```

### graphOptimizer

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public boolean graphOptimizer
```

### hasSimpleDefinition

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public boolean hasSimpleDefinition
```

### newgraphOptimizer

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public boolean newgraphOptimizer
```

### sMetrics

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static Metrics sMetrics
```

## Public constructors

### LinearSystem

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public LinearSystem()
```

## Public methods

### addCenterPoint

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void addCenterPoint(
    ConstraintWidget widget,
    ConstraintWidget target,
    float angle,
    int radius
)
```

Add the equations constraining a widget center to another widget center, positioned on a circle, following an angle and radius

| Parameters |
|---|---|
| `float angle` | from 0 to 360 |
| `int radius` | the distance between the two centers |

### addCentering

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void addCentering(
    SolverVariable a,
    SolverVariable b,
    int m1,
    float bias,
    SolverVariable c,
    SolverVariable d,
    int m2,
    int strength
)
```

Add an equation of the form (1 - bias) \* (a - b) = bias \* (c - d)

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a` | variable a |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b` | variable b |
| `int m1` | margin 1 |
| `float bias` | bias between ab - cd |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable c` | variable c |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable d` | variable d |
| `int m2` | margin 2 |
| `int strength` | strength used |

### addConstraint

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void addConstraint(ArrayRow row)
```

Add the equation to the system

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/ArrayRow row` | the equation we want to add expressed as a system row. |

### addEquality

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void addEquality(SolverVariable a, int value)
```

Add an equation of the form a = value

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a` | variable a |
| `int value` | the value we set |

### addEquality

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public ArrayRow addEquality(SolverVariable a, SolverVariable b, int margin, int strength)
```

Add an equation of the form a = b + margin

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a` | variable a |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b` | variable b |
| `int margin` | margin used |
| `int strength` | strength used |

### addGreaterBarrier

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void addGreaterBarrier(
    SolverVariable a,
    SolverVariable b,
    int margin,
    boolean hasMatchConstraintWidgets
)
```

### addGreaterThan

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void addGreaterThan(
    SolverVariable a,
    SolverVariable b,
    int margin,
    int strength
)
```

Add an equation of the form a \>= b + margin

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a` | variable a |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b` | variable b |
| `int margin` | margin |
| `int strength` | strength used |

### addLowerBarrier

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void addLowerBarrier(
    SolverVariable a,
    SolverVariable b,
    int margin,
    boolean hasMatchConstraintWidgets
)
```

### addLowerThan

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void addLowerThan(
    SolverVariable a,
    SolverVariable b,
    int margin,
    int strength
)
```

Add an equation of the form a \<= b + margin

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable a` | variable a |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable b` | variable b |
| `int margin` | margin |
| `int strength` | strength used |

### addRatio

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void addRatio(
    SolverVariable a,
    SolverVariable b,
    SolverVariable c,
    SolverVariable d,
    float ratio,
    int strength
)
```

### addSynonym

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void addSynonym(SolverVariable a, SolverVariable b, int margin)
```

### createErrorVariable

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public SolverVariable createErrorVariable(int strength, String prefix)
```

### createExtraVariable

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public SolverVariable createExtraVariable()
```

### createObjectVariable

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public SolverVariable createObjectVariable(Object anchor)
```

### createRow

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public ArrayRow createRow()
```

### createRowDimensionPercent

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static ArrayRow createRowDimensionPercent(
    LinearSystem linearSystem,
    SolverVariable variableA,
    SolverVariable variableC,
    float percent
)
```

Create a constraint to express A = C \* percent

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/LinearSystem linearSystem` | the system we create the row on |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable variableA` | variable a |
| `https://developer.android.com/reference/androidx/constraintlayout/core/SolverVariable variableC` | variable c |
| `float percent` | the percent used |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/ArrayRow` | the created row |

### createSlackVariable

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public SolverVariable createSlackVariable()
```

### displayReadableRows

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void displayReadableRows()
```

### displayVariablesReadableRows

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void displayVariablesReadableRows()
```

### fillMetrics

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void fillMetrics(Metrics metrics)
```

### getCache

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public Cache getCache()
```

### getMemoryUsed

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public int getMemoryUsed()
```

### getMetrics

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public static Metrics getMetrics()
```

### getNumEquations

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public int getNumEquations()
```

### getNumVariables

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public int getNumVariables()
```

### getObjectVariableValue

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public int getObjectVariableValue(Object object)
```

### minimize

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void minimize()
```

Minimize the current goal of the system.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

### removeRow

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void removeRow(ArrayRow row)
```

### reset

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
public void reset()
```

Reset the LinearSystem object so that it can be reused.