alphaville / optimization-engine

Nonconvex embedded optimization: code generation for fast real-time optimization + ROS support
https://alphaville.github.io/optimization-engine/
Other
499 stars 53 forks source link

TCP server: better error handling #63

Closed alphaville closed 5 years ago

alphaville commented 5 years ago

Addressing issue #61

TODOs:

korken89 commented 5 years ago

We should also look into providing the starting guess of the decision variables, but that is probably for another PR :)

alphaville commented 5 years ago

@korken89 You can provide the initial guess as follows:

{
    "Run":
        {
            "parameter": [1.0, 2.0],
            "initial_guess": [5.0, 6.0]
        }
}
korken89 commented 5 years ago

I mean in the python tcp interface :)

alphaville commented 5 years ago

@korken89 It's supported in the Python interface too. Having constructed an instance of OptimizerTcpManager, use call with two arguments. The first argument is the parameter and the second (optional) argument is the initial guess. For example:

mng = og.tcp.OptimizerTcpManager('python_test_build/tcp_enabled_optimizer')
mng.start()
solution = mng.call([1.0, 50.0, 100.0], [0.0, 1.0])
# or...
solution = mng.call([1.0, 50.0, 100.0], initial_guess=[0.0, 1.0])
alphaville commented 5 years ago

@korken89 I don't know happened, but without changing anything, Travis fails all tests with Python versions <3.6 - see for example this log. There, throughout lines 1012-1030, we see that travis fails to install numpy and gives the error

RuntimeError: Python version >= 3.5 required.

I would be OK with removing all support for Python 2.7 (soon to retire), but neither version 3.4 works.

I tried to do the same locally with Python 3.4 (using virtualenv) and I reproduced the error.


Update: I got the following message:

DEPRECATION: Python 3.4 support has been deprecated. 
pip 19.1 will be the last one supporting it. 
Please upgrade your Python as Python 3.4 won't be maintained after **March 2019** (cf PEP 429).

Apparently, Python 3.4 is indeed deprecated, so it makes sense to remove support for it.

korken89 commented 5 years ago

Oh, I'd remove it from the CI as you have done now

alphaville commented 5 years ago

@korken89 I added a clarification in the docs that Python >= 3.5 is required. You need to approve this if you agree with these changes so that I can merge it in master.