Skip to content

Commit

Permalink
Starting on rigde opt
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffrey-hokanson committed Jan 22, 2019
1 parent 04ae2c8 commit df47e70
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Expand Up @@ -69,7 +69,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = []
exclude_patterns = ['**.ipynb_checkpoints']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
Expand Down
11 changes: 2 additions & 9 deletions docs/source/index.rst
Expand Up @@ -10,17 +10,10 @@ Welcome to Parameter Space Dimension Reduction's documentation!
:maxdepth: 2
:caption: Contents:

install
tutorial
api

domain
basis
function
pools
samplers
subspace
surrogate
opt
demos

Indices and tables
==================
Expand Down
4 changes: 2 additions & 2 deletions docs/source/install.rst
Expand Up @@ -3,9 +3,9 @@ Installation


As this project is currently in active development, I recommend installing from
github directly:
github directly

code ::
::
pip install git+https://github.com/jeffrey-hokanson/PSDR#egg=psdr

Expand Down
4 changes: 3 additions & 1 deletion psdr/__init__.py
Expand Up @@ -14,4 +14,6 @@
from .redis_pool import RedisJob, RedisPool, RedisWorker
#from opt.shared import LinProgException, InfeasibleConstraints
from .pool import Pool, SequentialJob, SequentialPool
from .sample import maximin_sample
from .sample import maximin_sample


7 changes: 5 additions & 2 deletions psdr/function.py
Expand Up @@ -47,16 +47,19 @@ class Function(BaseFunction, Domain):
fun_kwargs: dict, default: empty
Keyword arguments to pass to the functions when evaluating function
"""

# TODO: Implement fancy pool-features

def __init__(self, funs, domain, grads = None, fd_grad = None, vectorized = False, fun_kwargs = None):
self.funs = funs
self.domain = domain
self.domain_app = domain
self.domain_norm = domain.normalized_domain()
self.fd_grad = fd_grad


def eval(self, X_norm):
X_norm = np.atleast_1d(X_norm)
X = self.domain.unnormalize(X_norm)
X = self.domain_app.unnormalize(X_norm)

if len(X.shape) == 1:
x = X.flatten()
Expand Down
3 changes: 2 additions & 1 deletion psdr/polyridge.py
Expand Up @@ -190,7 +190,8 @@ class PolynomialRidgeApproximation(PolynomialRidgeFunction):
leaving an optimization problem posed over the Grassmann manifold alone.
For both the 1-norm and the :math:`\infty`-norm,
this implementation uses ........
this implementation uses a sequential linear program with a trust region
coupled with a nonlinear trajectory through the search space.
Parameters
----------
Expand Down
3 changes: 2 additions & 1 deletion psdr/ridge.py
Expand Up @@ -54,7 +54,8 @@ def shadow_plot(self, X = None, fX = None, dim = None, ax = None):
linewidths = 0.5)



else:
raise NotImplementedError("Cannot draw shadow plots in more than two dimensions")



Expand Down
30 changes: 28 additions & 2 deletions psdr/ridgeopt.py
Expand Up @@ -2,19 +2,45 @@


import numpy as np
from function import Function
from polyridge import PolynomialRidgeApproximation


class RidgeOptimization:
r""" Ridge-based nonlinear optimization
Given a vector valued function :math:`\mathbf{f}: \mathcal{D}\subset \mathbb{R}^m\to \mathbb{R}^n`,
this class solves the optimization problem
.. math::
\min_{\mathbf{x}\in \mathcal{D}} &\ f_0(\mathbf{x}) \\
\text{such that} & \ f_i(\mathbf{x}) \le 0
by constructing a sequence of bounding surrogates.
Parameters
----------
func : Function
Function to optimize
"""
def __init__(self, func, X = None, fX = None, pool = None):
self.func = func
self.domain = func.domain_norm
self.X = []
self.fX = []



def step(self):

pass

if __name__ == '__main__':
from demos import golinksi_volume, golinksi_design_domain

domain = golinksi_design_domain()
func = Function(golinksi_volume, domain)

x = func.sample(1)
print func(x)
pass

0 comments on commit df47e70

Please sign in to comment.