{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "e7b5e13a-c059-441d-8d4f-fff080d52054", "metadata": {}, "source": [ "# Passive degrees of freedom\n", "\n" ] }, { "attachments": {}, "cell_type": "markdown", "id": "c18ef717", "metadata": {}, "source": [ "Passive dofs!" ] }, { "cell_type": "code", "execution_count": null, "id": "e6bfcf73", "metadata": {}, "outputs": [], "source": [ "from blop.utils import prepare_re_env\n", "\n", "%run -i $prepare_re_env.__file__ --db-type=temp" ] }, { "cell_type": "code", "execution_count": null, "id": "4cf5dbd1-e404-4504-b822-3956ca61ef74", "metadata": {}, "outputs": [], "source": [ "from blop.digestion.tests import constrained_himmelblau_digestion\n", "from blop import DOF, Agent, Objective\n", "from blop.dofs import BrownianMotion\n", "\n", "\n", "dofs = [\n", " DOF(name=\"x1\", search_domain=(-5.0, 5.0)),\n", " DOF(name=\"x2\", search_domain=(-5.0, 5.0)),\n", " DOF(name=\"x3\", search_domain=(-5.0, 5.0), active=False),\n", " DOF(device=BrownianMotion(name=\"brownian1\"), read_only=True),\n", " DOF(device=BrownianMotion(name=\"brownian2\"), read_only=True, active=False),\n", "]\n", "\n", "objectives = [\n", " Objective(name=\"himmelblau\", target=\"min\"),\n", "]\n", "\n", "agent = Agent(\n", " dofs=dofs,\n", " objectives=objectives,\n", " digestion=constrained_himmelblau_digestion,\n", " db=db,\n", " verbose=True,\n", " tolerate_acquisition_errors=False,\n", ")\n", "\n", "RE(agent.learn(\"qr\", n=16))" ] }, { "cell_type": "code", "execution_count": null, "id": "990a877e-f533-419c-bf5d-569ad7e72c6b", "metadata": {}, "outputs": [], "source": [ "agent.plot_objectives()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.0" }, "vscode": { "interpreter": { "hash": "b0fa6594d8f4cbf19f97940f81e996739fb7646882a419484c72d19e05852a7e" } } }, "nbformat": 4, "nbformat_minor": 5 }