Skip to content

Instantly share code, notes, and snippets.

View antonior92's full-sized avatar

Antonio Horta Ribeiro antonior92

View GitHub Profile
@antonior92
antonior92 / InstallPostgresMacOSX.md
Last active June 10, 2016 22:35
Give instructions to install Postgres on Mac OSX.

Install Postgres on Mac OSX

Install Postgres via Homebrew

Use homebrew to install postgres:

$ brew install postgresql

Create/Upgrade a database

If this is your first time installing Postgres with Homebrew, you'll need to create a database with:

Installing packages from AUR

  1. Acquire the tarball which contains the PKGBUILD and possibly other required files, like systemd units and patches (but often not the actual code).

  2. Extract the tarball (preferably in a directory set aside just for builds from the AUR) with

$ tar -xvf pkgname.tar.gz
  1. Verify that the PKGBUILD and accompanying files are not malicious or untrustworthy.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@antonior92
antonior92 / BFGS_scipy.ipynb
Last active March 12, 2017 20:15
Compare scipy current implementation of BFGS with a more efficient one.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@antonior92
antonior92 / InstallingPyCUTEst.md
Last active August 23, 2022 11:11
How to install pycutest

Installing PyCUTEst

Disclaimer: I wrote the instructions according to my own experience installing this thrice, I can't guarantee it will work out of the box for you

Setup

Choose a new directory to store all the files using:

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
from numpy.linalg import norm
from ipsolver import equality_constrained_sqp
def fun(x):
return 2*(x[0]**2 + x[1]**2 - 1) - x[0]
def grad(x):
return np.array([4*x[0]-1, 4*x[1]])
# Example
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.optimize import minimize_constrained, NonlinearConstraint, BoxConstraint
# Define objective function and derivatives
fun = lambda x: 1/2*(x[0] - 2)**2 + 1/2*(x[1] - 1/2)**2
grad = lambda x: np.array([x[0] - 2, x[1] - 1/2])
hess = lambda x: np.eye(2)
# Define nonlinear constraint