# The classowary Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

# The classowary Reference Manual

This is the classowary Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 04:20:20 2022 GMT+0.

## 1 Introduction

```## About Classowary
Classowary is an implementation of the linear constraint solver toolkit "Cassowary"(https://overconstrained.io). It is a variant of the simplex solver algorithm, specifically designed to allow adding, removing, and updating constraints quickly. This makes it a good candidate for layout computations.

## How To
After loading Classowary you will likely want to create a local nickname in your package for ``org.shirakumo.classowary``. We will assume that this nickname is called ``cass`` for this tutorial.

:: common lisp
(defvar *solver* (cass:make-solver))

(cass:with-variables (a b c) *solver*
(cass:constrain *solver* (<= 0 a))
(cass:constrain *solver* (<= a 10))
(cass:constrain *solver* (= b (* (+ 1 a) 5)))
(cass:constrain *solver* (= (+ 3 (* 2 c)) (+ a b)))
(cass:update-variables *solver*)
(values (cass:value a) (cass:value b) (cass:value c)))
;; => 0 5 1
::

As you can see, the solver picked only one of many possible solutions. When the system is underconstrained, it isn't predictable which solution you will get, but it should always fulfil all constraints that were given. If the system is overconstrained, Cassowary will try to match them as closely as possible according to each constraint's strength.

Cassowary also allows you to "suggest" a value for a variable. This means that the solver will try to keep the variable to this value if possible.

:: common lisp
(cass:with-variables (a b c) *solver*
(cass:make-suggestable a)
(cass:suggest a 5)
(cass:update-variables *solver*)
(values (cass:value a) (cass:value b) (cass:value c)))
;; => 5 30 16
::

This is typically how you will want to impose additional constraints imposed by the user such as when they explicitly move or resize something.

Naturally you can impose additional constraints at a later point as well.

:: common lisp
(cass:with-variables (a b c) *solver*
(cass:constrain *solver* (<= a (/ c 4)) :name 'a)
(cass:update-variables *solver*)
(values (cass:value a) (cass:value b) (cass:value c)))
;; => 1 10 4
::

As you can see, with this additional constraint the solver was no longer able to fulfil our suggested value exactly. We can easily remove the offending constraint again.

:: common lisp
(cass:delete-constraint (cass:find-constraint 'a *solver*))
::

Instead of using the ``constrain`` and ``with-variables`` macros, you can also dynamically build the variables and constraints through ``make-variable``, ``make-constraint``, ``add-term``, ``relation``, and ``add-constraint``. When building constraints and variables, you should make sure to pass the ``:name`` argument so that you can retrieve them from the solver later, or keep references of your own somewhere.

Should a solver or constraint get into a bad state, you can attempt to clear their state out with ``reset-solver`` and ``reset-constraint`` respectively.

The Cassowary algorithm is described in the paper "The Cassowary Linear Arithmetic Constraint Solving Algorithm: Interface and Implementation" by Badros and Borning. You can find the website of the original implementation "here"(https://constraints.cs.washington.edu/cassowary/).

This implementation is largely based on the "Amoeba implementation"(https://github.com/starwing/amoeba) by Xavier Wang.

: https://constraints.cs.washington.edu/cassowary/cassowary-tr.pdf

```

## 2 Systems

The main system appears first, followed by any subsystem dependency.

Previous: , Up: Systems   [Contents][Index]

### 2.1 classowary

An implementation of the Cassowary linear constraint solver toolkit

Maintainer

Nicolas Hafner <shinmera@tymoon.eu>

Author

Nicolas Hafner <shinmera@tymoon.eu>

zlib

Version

1.0.0

Dependency

documentation-utils (system).

Source
Child Components

## 3 Files

Files are sorted by type and then listed depth-first from the systems components trees.

Previous: , Up: Files   [Contents][Index]

### 3.1 Lisp

Next: , Previous: , Up: Lisp   [Contents][Index]

#### 3.1.1 classowary/classowary.asd

Source
Parent Component

classowary (system).

ASDF Systems

#### 3.1.2 classowary/package.lisp

Source
Parent Component

classowary (system).

Packages

#### 3.1.3 classowary/toolkit.lisp

Dependency

package.lisp (file).

Source
Parent Component

classowary (system).

Public Interface
Internals

#### 3.1.4 classowary/conditions.lisp

Dependency

toolkit.lisp (file).

Source
Parent Component

classowary (system).

Public Interface
Internals

when-ok (macro).

#### 3.1.5 classowary/symbol.lisp

Dependency

conditions.lisp (file).

Source
Parent Component

classowary (system).

Internals

#### 3.1.6 classowary/expression.lisp

Dependency

symbol.lisp (file).

Source
Parent Component

classowary (system).

Public Interface
Internals

#### 3.1.7 classowary/constraint.lisp

Dependency

expression.lisp (file).

Source
Parent Component

classowary (system).

Public Interface
Internals

#### 3.1.8 classowary/cassowary.lisp

Dependency

constraint.lisp (file).

Source
Parent Component

classowary (system).

Public Interface
Internals

#### 3.1.9 classowary/documentation.lisp

Dependency

cassowary.lisp (file).

Source
Parent Component

classowary (system).

## 4 Packages

Packages are listed by definition order.

Previous: , Up: Packages   [Contents][Index]

Source
Use List

common-lisp.

Public Interface
Internals

## 5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.

Next: , Previous: , Up: Definitions   [Contents][Index]

### 5.1 Public Interface

Next: , Previous: , Up: Public Interface   [Contents][Index]

#### 5.1.1 Constants

Constant: +medium+

Constant for constraints with a medium weight.

Corresponds to 1e3. You can also specify the keyword :medium instead of this constant wherever strengths are accepted.

Package
Source
Constant: +none+

Constant for constraints with no weight.

Corresponds to 0e0. You can also specify the keyword :none instead of this constant wherever strengths are accepted.

Package
Source
Constant: +required+

Constant for constraints with a very high weight.

Corresponds to 1e9. You can also specify the keyword :required instead of this constant wherever strengths are accepted.

Package
Source
Constant: +strong+

Constant for constraints with a high weight.

Corresponds to 1e6. You can also specify the keyword :strong instead of this constant wherever strengths are accepted.

Package
Source
Constant: +weak+

Constant for constraints with a weak weight.

Corresponds to 1e0. You can also specify the keyword :weak instead of this constant wherever strengths are accepted.

Package
Source

#### 5.1.2 Macros

Macro: constrain (solver constraint &rest args &key name strength)

Constrain the linear system in the solver.

The constraint should be an expression of the following form:

CONSTRAINT ::= (RELATION EXPRESSION EXPRESSION)
RELATION ::= <= | = | >=
EXPRESSION ::= TERM | COMPOUND
COMPOUND ::= (+ EXPRESSION*)
| (- EXPRESSION+)
| (* EXPRESSION*)
| (/ EXPRESSION+)
TERM ::= variable | real | (quote quoted)
variable — A CL variable binding name.
quoted — A symbol naming a solver variable.
real — A real number.

If a quoted variable is used, the variable is retrieved from the solver, or created if it does not exist yet. It will have the name of the quoted symbol. Otherwise the variable denotes a CL variable whose value must be of type VARIABLE.

If the expression contains non-linear terms, such as the multiplication of two variables, or the division by a variable, an error is signalled at macro-expansion-time.

This macro is a short-hand to create constraint, add terms, set the relation, and add the constraint to the solver.

The new constraint instance is returned.

See CONSTRAINT (type)
See SOLVER (type)
See MAKE-CONSTRAINT
See RELATION

Package
Source
Macro: with-variables (vars solver &body body)

Convenience macro to create and bind multiple variables at once.

Each binding must follow this structure:

BINDING ::= variable | (variable name? strength?)
variable — The CL variable the solver variable is bound to. name — The name of the solver variable as a symbol.
This can later be used to retrieve the variable. If no explicit name is given, the CL variable name is used. strength — The strength of the variable if it is newly created.

If a variable with the given name already exists in the solver, it is returned. Otherwise, a new variable of the given name is created. If NAME is NIL, a new variable is always created.

Note that the variables are /not/ deleted on exit from the body.

See VARIABLE (type)
See SOLVER (type)
See FIND-VARIABLE
See MAKE-VARIABLE

Package
Source

#### 5.1.3 Compiler macros

Compiler Macro: add-term (constraint multiplier &optional variable)
Package
Source
Compiler Macro: remove-term (constraint multiplier &optional variable)
Package
Source

#### 5.1.4 Ordinary functions

Adds the constraint to its solver.

Without this, the constraint will not apply.

If the solver is AUTO-UPDATE, the variables will be updated after this operation.

See SOLVER
See CONSTRAINT (type)
See REMOVE-CONSTRAINT

Package
Source
Function: add-term (constraint multiplier &optional variable)

Adds the given term description to the constraint.

This corresponds to a term of either
number
or
number*variable
being added to the constraint depending on whether the variable is given.

Note that adding or removing terms can automatically cancel out as soon as either the constant term of the expression reaches zero, or the multiplier of a variable term reaches zero. In the latter case, the variable term is automatically removed from the expression.

Returns the updated constraint.

See CONSTRAINT (type)
See VARIABLE (type)
See REMOVE-TERM

Package
Source
Function: auto-update (solver)

Accessor to whether the solver automatically updates variables on changes.

See SOLVER (type)

Package
Source
Function: (setf auto-update) (solver)
Package
Source
Function: clone-constraint (other &key strength)

Return a copy of the given constraint.

This will copy the constraint including its terms into a fresh instance.

See CONSTRAINT (type)
See MAKE-CONSTRAINT
See DELETE-CONSTRAINT

Package
Source
Function: constrain-with (solver constraint &key name strength)

Constrain the linear system in the solver.

This is like CONSTRAIN, except that this is a function and can thus accept run-time expressions. Instead of variables being either literal symbols or quoted symbols, you can pass VARIABLE instances or symbols to achieve the equivalent effects.

The new constraint instance is returned.

See CONSTRAIN
See VARIABLE (type)

Package
Source
Function: constrained-p (constraint)

Returns true if the constraint is additionally constrained through a variable.

See CONSTRAINT (TYPE)

Package
Source
Function: delete-constraint (constraint)

Deletes the constraint completely from the solver.

This will render the constraint useless. Operating on it beyond this point results in undefined behaviour.

See CONSTRAINT (type)
See MAKE-CONSTRAINT

Package
Source
Function: delete-variable (variable)

Deletes the variable completely from the solver.

This will remove the variable and all terms in all expressions that include it.

See MAKE-VARIABLE
See VARIABLE (type)

Package
Source
Function: find-constraint (symbol solver)

Returns the constraint associated with the given name, if any.

Note that you are /not/ permitted to SETF this place.

See CONSTRAINT (type)
See SOLVER (type)

Package
Source
Function: (setf find-constraint) (symbol solver)
Package
Source
Function: find-variable (symbol solver)

Returns the variable associated with the given name, if any.

Note that you are /not/ permitted to SETF this place.

See VARIABLE (type)
See SOLVER (type)

Package
Source
Function: (setf find-variable) (symbol solver)
Package
Source
Function: make-constraint (solver &key name strength)

Returns a new constraint for the solver.

The STRENGTH designates how strongly this constraint is adhered. By default the strength is +REQUIRED+.

The NAME is an optional identifier for the constraint. The name may be a string or a symbol. If it is a symbol, the constraint can later be retrieved by the same symbol again, using FIND-CONSTRAINT.

See STRENGTH (type)
See DELETE-CONSTRAINT
See FIND-CONSTRAINT

Package
Source
Function: make-solver (&key auto-update)

Returns a new solver instance.

If AUTO-UPDATE is T, the solver will automatically call UPDATE-VARIABLES when constraints or variables change.

See SOLVER (type)
See AUTO-UPDATE
See RESET-SOLVER
See MAKE-CONSTRAINT
See CONSTRAIN
See MAKE-VARIABLE
See WITH-VARIABLES

Package
Source
Function: make-suggestable (variable &optional strength)

Make the variable suggestable.

This means that you can edit the variable and suggest a value that the solver should try to keep steady when solving its system. Typically this is used for variables that are constrained by the user somehow.

In order to use SUGGEST, a variable must first be made suggestable.

If the variable is already suggestable, its strength is updated via (SETF STRENGTH).

If the variable was not already suggestable, it is suggested to the current value of the variable.

The strength of the suggestion is capped to +STRONG+. Any value above will automatically be reduced to +STRONG+.

Returns the variable.

See STRENGTH
See VARIABLE (type)
See MAKE-UNSUGGESTABLE
See SUGGESTABLE-P
See SUGGEST
See STRENGTH

Package
Source
Function: make-unsuggestable (variable)

Makes the variable unsuggestable again.

After this, SUGGEST will fail unless the variable is explicitly made suggestable again.

Returns the variable.

See MAKE-SUGGESTABLE
See SUGGESTABLE-P
See VARIABLE (type)
See SUGGEST

Package
Source
Function: make-variable (solver &key name strength)

Returns a new variable for the solver.

The NAME is an optional identifier for the variable. The name may be a string or a symbol. If it is a symbol, the variable can later be retrieved by the same symbol again, using FIND-VARIABLE.

If STRENGTH is given, the variable is made suggestable and
its strength set accordingly. STRENGTH may also be T in this case, in which case the strength used is +STRONG+.

See VARIABLE (type)
See DELETE-VARIABLE
See MAKE-SUGGESTABLE
See FIND-VARIABLE

Package
Source
Function: relation (constraint)

Accessor to the relation of the constraint.

May be one of the following CL symbols:

<=
=
>=

See CONSTRAINT (type)

Package
Source
Function: (setf relation) (constraint)
Package
Source
Function: remove-constraint (constraint)

Removes the constraint from its solver.

After this, the constraint will not apply.

If the solver is AUTO-UPDATE, the variables will be updated after this operation.

See SOLVER
See CONSTRAINT (type)
See REMOVE-CONSTRAINT

Package
Source
Function: remove-term (constraint multiplier &optional variable)

Removes the given term description from the constraint.

This corresponds to a term of either
number
or
number*variable
being removed from the constraint depending on whether the variable is given.

Note that adding or removing terms can automatically cancel out as soon as either the constant term of the expression reaches zero, or the multiplier of a variable term reaches zero. In the latter case, the variable term is automatically removed from the expression.

This operation is equivalent to ADD-TERM with the multiplier inverted.

Returns the updated constraint.

See CONSTRAINT (type)
See VARIABLE (type)

Package
Source
Function: reset-constraint (constraint)

Resets the constraint.

This will remove the constraint, unset its relation, and clear its expression of all terms.

Returns the updated constraint.

See CONSTRAINT (type)
See REMOVE-CONSTRAINT

Package
Source
Function: reset-solver (solver &optional clear-constraints)

Resets the solver.

This resets all variables and makes them unsuggestable.

If the solver is AUTO-UPDATE, the variables will be updated before this operation.

If CLEAR-CONSTRAINTS is T, removes all constraints from the solver.

See SOLVER (type)

Package
Source
Function: strength (constraint)

Accessor to the strength of the constraint.

The strength is a positive float, denoting how important this constraint is to the overall system. Valid values for the strength are positive real numbers and the following keywords:

:REQUIRED
:STRONG
:MEDIUM
:WEAK
:NONE

Each of these keywords corresponds to the constant of the same name. If a value that is neither a positive real, nor one of the above keywords is set, an error is signalled.

If the solver is AUTO-UPDATE, the variables will be updated after the strength is updated.

See CONSTRAINT (type)
See +REQUIRED+
See +STRONG+
See +MEDIUM+
See +WEAK+
See +NONE+

Package
Source
Function: (setf strength) (constraint)
Package
Source
Function: suggest (variable value &optional if-not-suggestable)

Suggest a particular value for the variable.

The solver will try to solve the system while keeping the value of the variable to the suggested value. Note however that this does not circumvent required constraints.

If the variable is not already suggestable, the value of if-not-suggestable becomes important. It may be one of the following: :ERROR — An error of type VARIABLE-NOT-SUGGESTABLE is signalled.
:MAKE-SUGGESTABLE — The variable is made suggestable with medium strength.
NIL — The function simply returns NIL.

If the solver is AUTO-UPDATE, the variables will be updated after this operation.

On success, returns the variable.

See VARIABLE (type)
See SUGGESTABLE-P
See MAKE-SUGGESTABLE
See MAKE-UNSUGGESTABLE
See VARIABLE-NOT-SUGGESTABLE

Package
Source
Function: suggestable-p (variable)

Returns true if the variable is suggestable.

See VARIABLE (type)
See MAKE-SUGGESTABLE
See MAKE-UNSUGGESTABLE
See SUGGEST

Package
Source
Function: update-variables (solver)

Recomputes the variable values according to the current solver constraints.

You should call this function whenever you are done changing constraints or suggesting variables and would like to read out the
new, computed values for the variables.

Returns the solver.

See AUTO-UPDATE

Package
Source
Function: value (variable)

Returns the current value of the variable.

You might need to call UPDATE-VARIABLES on the solver before this returns an accurate value for the variable.

Note that for suggestable variables this might return a value different from the one previously suggested.

See VARIABLE (type)

Package
Source

#### 5.1.5 Generic functions

Generic Reader: expression (condition)

Returns the expression associated with the object.

See EXPRESSION (type)
See EXPRESSION-UNSATISFIED
see EXPRESSION-UNBOUND

Package
Methods
Reader Method: expression ((condition expression-unbound))
Source
Target Slot
Reader Method: expression ((condition expression-unsatisfied))
Source
Target Slot
Generic Function: solver (condition)

Returns the solver associated with the object.

See SOLVER (type)
See VARIABLE (type)
See CONSTRAINT (type)
See EXPRESSION-UNSATISFIED
See EXPRESSION-UNBOUND

Package
Methods
Method: solver ((constraint constraint))
Source
Method: solver ((variable variable))
Source
Reader Method: solver ((condition variable-not-suggestable))
Source
Target Slot
Reader Method: solver ((condition expression-unbound))
Source
Target Slot
Reader Method: solver ((condition expression-unsatisfied))
Source
Target Slot
Generic Reader: variable (condition)

Returns the variable associated with the object.

See VARIABLE (type)
See VARIABLE-NOT-SUGGESTABLE

Package
Methods
Reader Method: variable ((condition variable-not-suggestable))
Source
Target Slot

#### 5.1.6 Standalone methods

Method: describe-object ((term term) stream)
Source
Method: describe-object ((solver solver) stream)
Source
Method: describe-object ((variable variable) stream)
Source
Method: describe-object ((constraint constraint) stream)
Source
Method: describe-object ((expression expression) stream)
Source
Method: print-object ((term term) stream)
Source
Method: print-object ((solver solver) stream)
Source
Method: print-object ((variable variable) stream)
Source
Method: print-object ((constraint constraint) stream)
Source
Method: print-object ((expression expression) stream)
Source

#### 5.1.7 Conditions

Condition: assertion-violated

Error signalled when an internal assertion was violated.

This may arise due to invalid values being passed, or otherwise invalid sequences of operations being performed.

See CLASSOWARY-CONDITION
See CL:ERROR (type)

Package
Source
Direct superclasses
Condition: classowary-condition

Supertype for all conditions related to Classowary.

See CL:CONDITION (type)

Package
Source
Direct superclasses

condition.

Direct subclasses
Condition: expression-unbound

Error signalled when an expression is unbound.

See CLASSOWARY-CONDITION
See CL:ERROR (type)
See SOLVER (function)
See EXPRESSION (function)

Package
Source
Direct superclasses
Direct methods
Direct slots
Slot: solver
Initargs

:solver

Writers

This slot is read-only.

Slot: expression
Initargs

:expression

Writers

This slot is read-only.

Condition: expression-unsatisfied

Error signalled when it is impossible for the solver to satisfy an expression.

See CLASSOWARY-CONDITION
See CL:ERROR (type)
See SOLVER (function)
See EXPRESSION (function)

Package
Source
Direct superclasses
Direct methods
Direct slots
Slot: solver
Initargs

:solver

Writers

This slot is read-only.

Slot: expression
Initargs

:expression

Writers

This slot is read-only.

Condition: variable-not-suggestable

Error signalled when attempting to suggest an unsuggestable variable.

When this error is signalled, two restarts must be active with the following behaviour:
MAKE-SUGGESTABLE — Makes the variable suggestable before setting the suggested value. The restart accepts an optional argument that sets the strength of the variable.
ABORT — Aborts the suggestion and returns NIL.

See CLASSOWARY-CONDITION
See CL:ERROR (type)
See SOLVER (function)
See VARIABLE (function)

Package
Source
Direct superclasses
Direct methods
Direct slots
Slot: solver
Initargs

:solver

Writers

This slot is read-only.

Slot: variable
Initargs

:variable

Writers

This slot is read-only.

Previous: , Up: Public Interface   [Contents][Index]

#### 5.1.8 Structures

Structure: constraint

Represents a constraint in a linear system.

Each of the constraints in a system must appear in the following normalised, mathematical form:

CONSTRAINT ::= TERM RELATION TERM (\+ TERM)*
RELATION ::= <= | = | >=
TERM ::= number (\* variable)?
number — a SINGLE-FLOAT
variable — a VARIABLE

For instance, the following are valid constraints:

0 = 0
1 = 2
1*x <= 1
2*x >= 3 + 4*y

And the following are not valid constraints:

1*x + 1*y = 3*y + 5*z
x*x = 2

See MAKE-CONSTRAINT
See CLONE-CONSTRAINT
See DELETE-CONSTRAINT
See FIND-CONSTRAINT
See REMOVE-CONSTRAINT
See RELATION
See SOLVER (function)
See CONSTRAIN

Package
Source
Direct superclasses

structure-object.

Direct methods
Direct slots
Slot: expression
Type

org.shirakumo.classowary:expression

Initform

(org.shirakumo.classowary::%make-expression (org.shirakumo.classowary::mksym (quote org.shirakumo.classowary::external)))

Writers
Slot: marker
Type

symbol

Writers
Slot: other
Type

symbol

Writers
Slot: relation
Type

symbol

Writers
Slot: strength
Type

single-float

Initform

0.0

Writers
Slot: solver
Type

org.shirakumo.classowary:solver

Writers
Structure: expression

The representation of a linear expression.

A linear expression represents a constant factor added together with a series of linear variable terms.

See TERM

Package
Source
Direct superclasses

structure-object.

Direct methods
Direct slots
Slot: key
Type

symbol

Writers
Slot: infeasible-p
Type

boolean

Writers
Slot: terms
Type

hash-table

Initform

(make-hash-table :test (quote eq))

Writers
Slot: constant
Type

single-float

Initform

0.0

Writers
Structure: solver

Represents a linear constraint system.

A linear constraint system is composed out of several constraints that describe an equality or inequality composed out of linear terms. The solver can then attempt to find a solution that fits the variables in the terms to the constraints as well as possible.

Note that the solver will bend constraints if there is no solution that does not violate any of them.

See CONSTRAINT (type)
See MAKE-SOLVER
See RESET-SOLVER
See AUTO-UPDATE
See MAKE-CONSTRAINT
See MAKE-VARIABLE
See CONSTRAIN
see WITH-VARIABLES
See FIND-VARIABLE
See FIND-CONSTRAINT

Package
Source
Direct superclasses

structure-object.

Direct methods
Direct slots
Slot: objective
Type

org.shirakumo.classowary:expression

Initform

(org.shirakumo.classowary::%make-expression)

Writers
Slot: variables
Type

hash-table

Initform

(make-hash-table :test (quote eq))

Writers
Slot: constraints
Type

hash-table

Initform

(make-hash-table :test (quote eq))

Writers
Slot: expressions
Type

hash-table

Initform

(make-hash-table :test (quote eq))

Writers
Slot: infeasible-expressions
Type

list

Writers
Slot: dirty-variables
Type

list

Writers
Slot: auto-update
Type

boolean

Writers
Structure: term

The representation of a variable term.

A term is a variable and a linear multiplication factor.

Package
Source
Direct superclasses

structure-object.

Direct methods
Direct slots
Slot: key
Type

symbol

Writers
Slot: multiplier
Type

single-float

Initform

0.0

Writers
Structure: variable

Represents a variable in a linear system.

A variable can appear in an arbitrary number of constraints to express linear terms. A variable has a value and two states: suggestable, or unsuggestable. In the default, unsuggestable state, the variable is freely controlled by the linear system and its value is directly deduced from the constraints. In the suggestable state, the variable has a suggested value that the user supplies, which the solver should attempt to keep constant as the system is solved.

See MAKE-VARIABLE
See DELETE-VARIABLE
See FIND-VARIABLE
See WITH-VARIABLES
See SOLVER (function)
See MAKE-SUGGESTABLE
See MAKE-UNSUGGESTABLE
See SUGGESTABLE-P
See SUGGEST
See VALUE

Package
Source
Direct superclasses

structure-object.

Direct methods
Direct slots
Slot: symbol
Package

common-lisp.

Type

symbol

Writers
Slot: dirty-p
Type

boolean

Writers
Slot: constraint
Type

(or null org.shirakumo.classowary:constraint)

Writers
Slot: edit-value
Type

single-float

Initform

0.0

Writers
Slot: value
Type

single-float

Initform

0.0

Writers
Slot: solver
Type

org.shirakumo.classowary:solver

Writers

### 5.2 Internals

Next: , Previous: , Up: Internals   [Contents][Index]

#### 5.2.1 Special variables

Special Variable: *symbol-ids*
Package
Source

#### 5.2.2 Macros

Macro: do-constraints ((constraint solver &optional result) &body body)
Package
Source
Macro: do-expressions ((expression solver &optional result) &body body)
Package
Source
Macro: do-terms ((term expression &optional result) &body body)
Package
Source
Macro: do-variables ((variable solver &optional result) &body body)
Package
Source
Macro: when-ok (form &body body)
Package
Source
Macro: with-protection (unwind &body protected)
Package
Source

Previous: , Up: Internals   [Contents][Index]

#### 5.2.3 Ordinary functions

Function: %make-constraint (strength solver &optional expression)
Package
Source
Function: %make-expression (&optional key)
Package
Source
Function: %make-solver (&key auto-update)
Package
Source
Function: %make-variable (symbol solver)
Package
Source
Function: ->strength (strength)
Package
Source
Function: add-constant (constraint constant)
Package
Source
Package
Source
Function: add-variable (expression symbol multiplier)
Package
Source
Function: add-variable-term (constraint variable multiplier)
Package
Source
Function: add-with-artificial (solver expression constraint)
Package
Source
Function: clear-expression (expression)
Package
Source
Function: constant-p (expression)
Package
Source
Writer: (setf constraint-expression) (instance)
Package
Source
Target Slot
Writer: (setf constraint-marker) (instance)
Package
Source
Target Slot
Writer: (setf constraint-other) (instance)
Package
Source
Target Slot
Function: constraint-p (object)
Package
Source
Writer: (setf constraint-relation) (instance)
Package
Source
Target Slot
Writer: (setf constraint-solver) (instance)
Package
Source
Target Slot
Writer: (setf constraint-strength) (instance)
Package
Source
Target Slot
Function: copy-constraint (instance)
Package
Source
Function: copy-expression (instance)
Package
Source
Function: copy-solver (instance)
Package
Source
Function: copy-term (instance)
Package
Source
Function: copy-variable (instance)
Package
Source
Function: delta-edit-constant (solver delta constraint)
Package
Source
Function: dual-optimize (solver)
Package
Source
Function: dummy-p (symbol)
Package
Source
Function: ensure-expression (symbol solver)
Package
Source
Function: ensure-term (symbol expression)
Package
Source
Function: error-p (symbol)
Package
Source
Writer: (setf expression-constant) (instance)
Package
Source
Target Slot
Writer: (setf expression-infeasible-p) (instance)
Package
Source
Target Slot
Writer: (setf expression-key) (instance)
Package
Source
Target Slot

key.

Function: expression-p (object)
Package
Source
Writer: (setf expression-terms) (instance)
Package
Source
Target Slot
Function: external-p (symbol)
Package
Source
Function: find-expression (symbol solver)
Package
Source
Function: (setf find-expression) (symbol solver)
Package
Source
Function: find-term (symbol expression)
Package
Source
Function: (setf find-term) (symbol expression)
Package
Source
Function: get-expression (solver symbol destination)
Package
Source
Function: get-leaving-expression (solver marker)
Package
Source
Function: make-expression (solver constraint)
Package
Source
Function: make-term (key &optional multiplier)
Package
Source
Function: mark-dirty (solver variable)
Package
Source
Function: mark-infeasible (solver expression)
Package
Source
Function: merge-constraint-into (constraint other multiplier)
Package
Source
Function: merge-expression (solver expression variable multiplier)
Package
Source
Function: mksym (type &optional name)
Package
Source
Function: multiply (expression multiplier)
Package
Source
Function: optimize-for (objective solver)
Package
Source
Function: pivotable-p (symbol)
Package
Source
Function: put-expression (solver symbol source)
Package
Source
Function: reduce-expression (thing)
Package
Source
Function: remove-errors (solver constraint)
Package
Source
Function: reset-expression (expression)
Package
Source
Function: slack-p (symbol)
Package
Source
Function: solve-for (expression entry exit)
Package
Source
Writer: (setf solver-auto-update) (instance)
Package
Source
Target Slot
Writer: (setf solver-constraints) (instance)
Package
Source
Target Slot
Writer: (setf solver-dirty-variables) (instance)
Package
Source
Target Slot
Writer: (setf solver-expressions) (instance)
Package
Source
Target Slot
Writer: (setf solver-infeasible-expressions) (instance)
Package
Source
Target Slot
Writer: (setf solver-objective) (instance)
Package
Source
Target Slot
Function: solver-p (object)
Package
Source
Writer: (setf solver-variables) (instance)
Package
Source
Target Slot
Function: substitute (expression entry to-substitute)
Package
Source
Function: substitute-expressions (solver variable to-substitute)
Package
Source
Writer: (setf term-key) (instance)
Package
Source
Target Slot

key.

Writer: (setf term-multiplier) (instance)
Package
Source
Target Slot
Function: term-p (object)
Package
Source
Function: try-add-expression (solver expression constraint)
Package
Source
Writer: (setf variable-constraint) (instance)
Package
Source
Target Slot
Writer: (setf variable-dirty-p) (instance)
Package
Source
Target Slot
Writer: (setf variable-edit-value) (instance)
Package
Source
Target Slot
Function: variable-p (object)
Package
Source
Writer: (setf variable-solver) (instance)
Package
Source
Target Slot
Writer: (setf variable-symbol) (instance)
Package
Source
Target Slot