Code Monkey home page Code Monkey logo

saor's Introduction

SAOR

The Sequential Approximate Optimization Repository, or SAOR, provides an concise implementation of multiple sequential approximate optimization routines. The package aims to provide a simple, modular implementation that enables users to investigate and modify the optimization routines to match their optimization problems.

SAOR provides multiple well-known algorithms, e.g. Optimality Criteria (Venkayya 1989), ConLin (Fleury, 1989), and the Method of Moving Asymptotes (MMA) (K. Svanberg, 1987). Although these are implemented in a modular fashion, simple wrappers are provided to use a standard implementation with corresponding default settings.

Usage

A problem can be setup using predefined wrappers

problem = Square()
x, f = sao.solvers.method_of_moving_asymptotes.mma(problem, x0=x0)
print(f'Final design: {x} with objective: {f[0]} and constraints: {f[1:]}')

Or by constructing the full optimization strategy

problem = Square()
x = problem.x0
intervening_variables = sao.intervening_variables.MMA()
approximation = sao.approximation.Taylor1(intervening_variables)
sub_problem = sao.problems.Subproblem(problem)
criterion = sao.convergence_criteria.VariableChange(x, tolerance=1e-2)

while not criterion.converged:
    f = problem.g(x)
    df = problem.dg(x)
    sub_problem.build(x, f, df)
    x[:] = sao.solvers.primal_dual_interior_point.pdip(sub_problem)

print(f'Final design: {x} with objective: {f} and constraints: {f[1:]}')

Many alternative variations are illustrated in examples/optimization_problem_setup.py.

Installation

To install the package for development, first clone the repository. Then, from the project's root run make. This will setup a virtual environment inside the project at ./venv. After activating this environment, source ./venv/bin/activate, the sao package and its dependencies are available.

The tests for sao are evaluated with pytest:

# minimal reporting on the test status
pytest tests/

# explicit coverage report with missing lines highlighted
pytest tests/ --cov sao --cov-report term-missing

Documentation

Documentation is generated using Sphinx. To build and clean docs:

# create documentation
make docs

# clean documentation
make docsclean

The documentation is generated from the source at docs/source/ and the documentation strings throughout the Python code. The output is placed at docs/build/. Open docs/build/index.html to browse locally.

Requirements to building the docs can be setup in the local environment by running

pip install -e .[doc]

The extra docs dependencies are pulled from the setup.py, which installs sphinx, sphix_rtd_theme and sphinxcontrib-napolean into the local (virtual)environment.

saor's People

Contributors

artofscience avatar maxvdkolk avatar aatmdelissen avatar dirkmunro89 avatar giannis1993 avatar arnouddelissen avatar bojan023 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.