Code Monkey home page Code Monkey logo

polyopt's People

Contributors

paveltrutman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

polyopt's Issues

Solving problems with no constraints

Hi,

first of all, thanks for this package, it is really what I was looking for!
I'm trying to use it to optimize a simple 1d polynomial, with no constraints, but I'm getting this error:

Traceback (most recent call last):
  File "/home/student/repos/polyopt/demoPOPSolver.py", line 27, in <module>
    POP = polyopt.POPSolver(f, g, d)
  File "/home/student/repos/polyopt/polyopt/POPSolver.py", line 37, in __init__
    if max(gDegsHalf) > d:
ValueError: max() arg is an empty sequence

I guess the solver is not done for the unconstrained case. I was able to get around this by adding a dummy constraint (x+100>=0). Here is the code I'm running now:

f = {(0,): 5, (1,): -2, (2,): 1}
g = [{(0,): 1e2, (1,): 1,}] # constraint function x + 1e2 >=0
d = 2
POP = polyopt.POPSolver(f, g, d)
y0 = POP.getFeasiblePoint([array([[1]]), array([[2]]), array([[-1]]), array([[-2]])])
POP.setPrintOutput(False)
x = POP.solve(y0)

However, I still get an error:

    x = POP.solve(y0) #solve the problem
  File "/home/student/repos/polyopt/polyopt/POPSolver.py", line 80, in solve
    y = self.SDP.solve(startPoint, self.SDP.dampedNewton)
  File "/home/student/repos/polyopt/polyopt/SDPSolver.py", line 188, in solve
    x0 = method(start)
  File "/home/student/repos/polyopt/polyopt/SDPSolver.py", line 314, in dampedNewton
    FdLN = Utils.LocalNormA(Fd, Fdd)
  File "/home/student/repos/polyopt/polyopt/utils.py", line 29, in LocalNormA
    return sqrt(dot((solve(hessian, u)).T, u))[0,0]
  File "<__array_function__ internals>", line 6, in solve
  File "/home/student/.local/lib/python3.5/site-packages/numpy/linalg/linalg.py", line 399, in solve
    r = gufunc(a, b, signature=signature, extobj=extobj)
  File "/home/student/.local/lib/python3.5/site-packages/numpy/linalg/linalg.py", line 97, in _raise_linalgerror_singular
    raise LinAlgError("Singular matrix")
numpy.linalg.LinAlgError: Singular matrix

This time I'm not sure what the problem is. Any suggestion?
Moreover, would it be simple to modify the code to handle unconstrained minimization?

More details about the 'Nesterov' reference ?

Hi,

All over your code, you cite 'Nesterov', with pages numbers. Could you provide the full reference to this book ? I have troubles matching the pages numbers, since there might have been a re-edition, so if you provide the full reference you used it would be great ๐Ÿ‘

Nice code btw.

ModuleNotFoundError: No module named 'Errors'

Hi, I've successfully installed the package polyopt according to the instruction on your webpage. But when I enter Python and import polyopt, I got the following error message:

import polyopt
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\tong.chen\polyopt\polyopt_init_.py", line 3, in
from .SDPSolver import SDPSolver
File "C:\Users\tong.chen\polyopt\polyopt\SDPSolver.py", line 6, in
import gnuplot as gp
File "C:\Users\tong.chen\AppData\Local\Continuum\anaconda3\lib\site-packages\gnuplot_init_.py", line 164, in
from gnuplot.gp import GnuplotOpts, GnuplotProcess, test_persist
File "C:\Users\tong.chen\AppData\Local\Continuum\anaconda3\lib\site-packages\gnuplot\gp.py", line 31, in
from gnuplot.gp_win32 import GnuplotOpts, GnuplotProcess, test_persist
File "C:\Users\tong.chen\AppData\Local\Continuum\anaconda3\lib\site-packages\gnuplot\gp_win32.py", line 12, in
import Errors
ModuleNotFoundError: No module named 'Errors'

Could someone help me fix this issue please?

Thanks in advance!

Solving a A-TKMP

Hi,

I do want to solve the SDP problem from example (4.1) in this paper. This problem seem quite easy to solve, but i do not manage to make it work using polyopt.

Could you explain to me how i should translate it's expression to the polyopt SDPsolver ? It keep running until values goes +/- np.inf and LocalNormA returns an error.

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.