Giter Club home page Giter Club logo

feasible_sqp's Introduction

Build Status

A feasible sequential quadratic programming strategy with iterated second-order corrections

This package provides a solver for parametric nonconvex programs of the form

dependencies

feasible_sqp uses the sparse implementation of the QP solver qpOASES which depends on MA57. Unfortunately, this complicates installation a bit. You need to obtain a valid license for HSL and its source code (see this page). After obtaining the source code for HSL, you'll need to download the METIS package (version 4.3 is required) here, extract the code and place it inside the root folder of coinhsl. Proceed then with the installation instructions of HSL, i.e., run ./configure, make and make install.

installation

  • clone the repo:
git clone https://github.com/zanellia/feasible_sqp.git
  • init submodules (qpOASES, CasADi):
git submodule update --init
  • install the Python package:
cd feasible_sqp
pip install -e .
  • build and install the dependencies:
import feasible_sqp
feasible_sqp.install_dependencies(hsl_lib_path=<...>)

usage

from feasible_sqp import *

hsl_lib_path =     <...> # e.g., '/usr/local/lib/libcoinhsl.so'

install_dependencies(hsl_lib_path=hsl_lib_path)

# number of primal variables
nv = 2

# create solver
solver = feasible_sqp(nv)

# get primal variables
y = solver.y

# define cost
f = 1.0/2.0*ca.dot(y-10,y-10)

# define constraints
g = ca.vertcat(ca.sin(y[1]) - y[0])

# define bounds
lby = -np.ones((nv,1))
uby = np.ones((nv,1))

# generate solver
solver.generate_solver(f, f, g, lby = lby, uby = uby)

# solve NLP
solver.solve()

notice: a call to solver.generate_solver() generates a script called set_LD_LIBRARY_PATH.sh which can be sourced in order to update the LD_LIBRARY_PATH environment variable such that the shared libraries needed by the solver can be located.

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.