Implements the Alternating Direction Method of Multipliers (ADMM) and Three-Weight Algorithm (TWA).
See example applications (Sudoku and Circle Packing), but basic library usage:
- Create an
ObjectiveGraph
. - Use the
createVariable
method to instantiate variables with initial values/weights. - Use the
createFactor
method to create factors that minimize local sub-objectives; edges (viacreateEdge
) provide input/output access to existing variables. - Use the
iterate
method to perform one step of minimization on the left, followed by variable-value concur on the right; theiterations
andconverged
properties provide status.
Between iterations...
- Subscripts can be used to get the value variables, as well as enable/disable factors.
- The
reinitialize
method resets the graph to its initial state (initial values/weights, all factors enabled).
Supplied example of "fast" circle packing shows integration with a spatial index for dynamic graph management, as well as use of callbacks (functions called after iteration/reinitialization).
The supplied example.swift
is an example external client program:
make
(compiles the ADMM library and example program to anexample
folder)make run
(run the example program, which is a shortcut for handling dynamic linking)make test
(run all the tests in the package)make clean
(delete the example/testing intermediate files/folders)