diff --git a/docker/Dockerfile b/docker/Dockerfile index 1c2d2badf9ea66c67053e253e408e667d718f2b0..bb1d17ace41f02ef11c936c97bc737331da8d376 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -56,6 +56,14 @@ ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:$IPOPT_DIR/lib ## Install PyOptSparse #COPY docker/install_pyoptsparse.sh /install WORKDIR $POSDIR + + +# Replace python 3 incomplatible files from pyoptsparse with files from pyipopt +RUN git clone https://github.com/xuy/pyipopt.git && \ + mv ./pyipopt/src/pyipoptcoremodule.c ./pyoptsparse/pyIPOPT/src/pyipoptcoremodule.c && \ + mv ./pyipopt/src/hook.h ./pyoptsparse/pyIPOPT/src/hook.h && \ + mv ./pyipopt/src/callback.c ./pyoptsparse/pyIPOPT/src/callback.c + RUN python setup.py install #RUN mkdir /notebooks @@ -74,14 +82,16 @@ RUN chmod +x /usr/bin/tini # Install the Colonel -RUN mkdir /deb -WORKDIR /deb -COPY docker/*.deb /deb/ -RUN dpkg -i *.deb +#RUN mkdir /deb +#WORKDIR /deb +#COPY docker/*.deb /deb/ +#RUN dpkg -i *.deb RUN apt-get clean \ && apt-get autoremove -y +RUN apt-get install lazarus -y + #RUN mkdir /install #RUN mkdir /install/source #RUN mkdir /install/FugaLib @@ -91,10 +101,10 @@ RUN apt-get clean \ #COPY topfarm/cost_models/fuga/Colonel/FugaLib/FugaLib.lpi /install/FugaLib ## Build -#RUN lazbuild /install/FugaLib/FugaLib.lpr +RUN lazbuild /install/FugaLib/FugaLib.lpi -#RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - -#RUN apt-get update -y && apt-get install -y nodejs +RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - +RUN apt-get update -y && apt-get install -y nodejs #RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager \ diff --git a/docker/fpc-src_3.0.4-2_amd64.deb b/docker/fpc-src_3.0.4-2_amd64.deb deleted file mode 100644 index 0c121d0fa64ace642134c8559cce2c341eb9e6a8..0000000000000000000000000000000000000000 Binary files a/docker/fpc-src_3.0.4-2_amd64.deb and /dev/null differ diff --git a/docker/fpc_3.0.4-2_amd64.deb b/docker/fpc_3.0.4-2_amd64.deb deleted file mode 100644 index 986469225241e34ee0228b4d60c5d6eef6cbe4c1..0000000000000000000000000000000000000000 Binary files a/docker/fpc_3.0.4-2_amd64.deb and /dev/null differ diff --git a/tests/topfarm/test_drivers.py b/tests/topfarm/test_drivers.py index 6241ede3e0c7caaffa7c9b5316a77ade1f6ab23c..8708d6308ce6ef67f1fbe9154157b06b01f9d9c6 100644 --- a/tests/topfarm/test_drivers.py +++ b/tests/topfarm/test_drivers.py @@ -22,8 +22,8 @@ desired = [[3, -3], [7, -7], [4, -3]] # desired turbine layouts @pytest.fixture def topfarm_generator(): def _topfarm_obj(driver): - plot_comp = DummyCostPlotComp(desired) - #plot_comp = NoPlot() + #plot_comp = DummyCostPlotComp(desired) + plot_comp = NoPlot() return TopFarm(initial, DummyCost(desired), 2, plot_comp=plot_comp, boundary=boundary, driver=driver) return _topfarm_obj @@ -57,17 +57,19 @@ def topfarm_generator(): @pytest.mark.parametrize('driver,tol',[(EasyScipyOptimizeDriver(), 1e-4), - (EasyScipyOptimizeDriver(tol=1e-3), 1e-2), - (EasyScipyOptimizeDriver(maxiter=13), 1e-1), + #(EasyScipyOptimizeDriver(tol=1e-3), 1e-2), + #(EasyScipyOptimizeDriver(maxiter=13), 1e-1), (EasyScipyOptimizeDriver(optimizer='COBYLA', tol=1e-3), 1e-2), - (EasyPyOptSparseSLSQP(),1e-4), + #(EasyPyOptSparseSLSQP(),1e-4), (EasyPyOptSparseIPOPT(),1e-4), #(EasySimpleGADriver(), 1e-4) - ][-1:]) + ][:]) def test_optimizers(driver, tol, topfarm_generator): if isinstance(driver, str): pytest.xfail("reason") tf = topfarm_generator(driver) + tf.evaluate() + print (driver.__class__.__name__) tf.optimize() tb_pos = tf.turbine_positions #tf.plot_comp.show() diff --git a/topfarm/easy_drivers.py b/topfarm/easy_drivers.py index 83c0e6b06c9caaa62182909a2394b82e85430ed9..60d5756af5e0d8ae30df6a3e778bf4d5052e4801 100644 --- a/topfarm/easy_drivers.py +++ b/topfarm/easy_drivers.py @@ -30,12 +30,13 @@ try: def __init__(self, maxit=200, acc=1e-6): pyOptSparseDriver.__init__(self) self.options.update({'optimizer': 'SLSQP'}) - self.opt_settings.update({'maxit': maxit, 'acc': acc}) + #self.opt_settings.update({'maxit': maxit, 'acc': acc}) class EasyPyOptSparseIPOPT(pyOptSparseDriver): - def __init__(self): + def __init__(self, max_iter=200): pyOptSparseDriver.__init__(self) self.options.update({'optimizer': 'IPOPT'}) + self.opt_settings.update({'linear_solver': 'ma27', 'max_iter': max_iter}) except: