|
8 | 8 | "source": [ |
9 | 9 | "\"\"\"Example of using GOSAC to optimize a function with constraints.\"\"\"\n", |
10 | 10 | "\n", |
11 | | - "# Copyright (c) 2025 Alliance for Sustainable Energy, LLC\n", |
| 11 | + "# Copyright (c) 2025 Alliance for Energy Innovation, LLC\n", |
12 | 12 | "\n", |
13 | 13 | "# This program is free software: you can redistribute it and/or modify\n", |
14 | 14 | "# it under the terms of the GNU General Public License as published by\n", |
|
162 | 162 | "G = np.zeros((ny, nx))\n", |
163 | 163 | "for i in range(ny):\n", |
164 | 164 | " Z[i, :] = problem.objf(XY[i, :])\n", |
165 | | - " G[i, :] = np.where(np.all(problem.gfun(XY[i, :])<=0.0, axis=1), -1, 1)\n", |
| 165 | + " G[i, :] = np.where(np.all(problem.gfun(XY[i, :]) <= 0.0, axis=1), -1, 1)\n", |
166 | 166 | "\n", |
167 | 167 | "plot_2d(Z, bounds, \"Objective function\")\n", |
168 | 168 | "plot_2d(G, bounds, \"Feasible region\")\n", |
|
724 | 724 | "S = np.zeros((ny, nx))\n", |
725 | 725 | "for i in range(ny):\n", |
726 | 726 | " aux = s(XY[i, :]).reshape((nx, -1))\n", |
727 | | - " S[i, :] = np.where(np.all(aux<=0.0, axis=1), -1, 1)\n", |
| 727 | + " S[i, :] = np.where(np.all(aux <= 0.0, axis=1), -1, 1)\n", |
728 | 728 | "\n", |
729 | 729 | "xscatter = s.X[:, 0]\n", |
730 | | - "xscatter = np.concatenate((xscatter,[res.x[0]]))\n", |
| 730 | + "xscatter = np.concatenate((xscatter, [res.x[0]]))\n", |
731 | 731 | "yscatter = s.X[:, 1]\n", |
732 | | - "yscatter = np.concatenate((yscatter,[res.x[1]]))\n", |
| 732 | + "yscatter = np.concatenate((yscatter, [res.x[1]]))\n", |
733 | 733 | "\n", |
734 | 734 | "plot_2d(Z, bounds, \"Objective function\")\n", |
735 | 735 | "plot_2d(G, bounds, \"Feasible region\")\n", |
|
0 commit comments