Created
April 1, 2022 22:58
-
-
Save syomantak/28703d47af4f642aa0f6a845c3df7f05 to your computer and use it in GitHub Desktop.
EECS227C-HW2 Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import numpy as np\n", | |
"import cvxpy as cvx\n", | |
"import matplotlib.pyplot as plt" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"A = np.zeros((5,10,10))\n", | |
"b = np.zeros((5,10))\n", | |
"\n", | |
"for k in range(5):\n", | |
" for i in range(10):\n", | |
" for j in range(10):\n", | |
" if i < j:\n", | |
" A[k,i,j] = np.exp((i+1)/(j+1))*np.cos((i+1)*(j+1))*np.sin(k+1)\n", | |
" elif j < i :\n", | |
" A[k,i,j] = np.exp((j+1)/(i+1))*np.cos((i+1)*(j+1))*np.sin(k+1)\n", | |
" else:\n", | |
" A[k,i,j] = 0 \n", | |
"\n", | |
"\n", | |
"for k in range(5):\n", | |
" for i in range(10):\n", | |
" b[k,i] = np.exp((i+1)/(k+1))*np.sin((i+1)*(k+1))\n", | |
" A[k,i,i] = ((i+1)/10)*np.abs(np.sin(k+1)) + np.sum(np.abs(A[k,i,:]))\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def f(x):\n", | |
" ct = -100000\n", | |
" arg = None\n", | |
" #mult = False\n", | |
"\n", | |
" for k in range(5):\n", | |
" if x.T@A[k]@x-x.T@b[k] == ct:\n", | |
" #mult = True\n", | |
" arg = k \n", | |
"\n", | |
" if x.T@A[k]@x-x.T@b[k] > ct :\n", | |
" #mult = False\n", | |
" arg = k\n", | |
" ct = x.T@A[k]@x-x.T@b[k]\n", | |
"\n", | |
" return ct, 2*(A[arg]@x)-b[arg]" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## (a) f(x0)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"5337.066429311364" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"x0 = np.ones(10)\n", | |
"f(x0)[0]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"-0.8414083346162645 [-0.12625655 -0.03437833 -0.00685703 0.02636084 0.06729451 -0.27839957\n", | |
" 0.07421914 0.13852438 0.08403105 0.03858013]\n" | |
] | |
} | |
], | |
"source": [ | |
"x = cvx.Variable(10)\n", | |
"z = cvx.Variable(1)\n", | |
"\n", | |
"\n", | |
"objective = cvx.Minimize(z)\n", | |
"constraints = []\n", | |
"for i in range(5):\n", | |
" constraints.append(cvx.quad_form(x,A[i]) - x.T@b[i] <= z)\n", | |
" \n", | |
"p = cvx.Problem(objective, constraints)\n", | |
"primal_result = p.solve()\n", | |
"print(primal_result,x.value)\n", | |
"\n", | |
"opt = primal_result" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Level Method" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"/opt/anaconda3/lib/python3.8/site-packages/cvxpy/problems/problem.py:1296: UserWarning: Solution may be inaccurate. Try another solver, adjusting the solver settings, or solve with verbose=True for more information.\n", | |
" warnings.warn(\n" | |
] | |
} | |
], | |
"source": [ | |
"alpha = 0.5\n", | |
"steps = 1000#1e4\n", | |
"\n", | |
"t=1\n", | |
"xt = x0\n", | |
"mins = f(x0)[0]\n", | |
"\n", | |
"vals = []\n", | |
"fL = []\n", | |
"fU = []\n", | |
"arr = []\n", | |
"\n", | |
"term = False\n", | |
"\n", | |
"Bound = 1e2\n", | |
"\n", | |
"x = cvx.Variable(10)\n", | |
"z = cvx.Variable(1)\n", | |
"objective = cvx.Minimize(z)\n", | |
"constraints = []\n", | |
"constraints.append(cvx.norm(x,2)<= Bound)\n", | |
"\n", | |
"while t < steps:\n", | |
" val,grad = f(xt) \n", | |
" vals.append(val)\n", | |
" \n", | |
" constraints.append(val + grad@(x-xt) <= z)\n", | |
" p = cvx.Problem(objective, constraints)\n", | |
" p.solve()\n", | |
" primal_result = p.value\n", | |
" \n", | |
" fL.append(primal_result)\n", | |
" fU.append(min(vals))\n", | |
" Lt = (1-alpha)*fL[-1]+alpha*fU[-1] \n", | |
"\n", | |
" ## Projection\n", | |
" obj = cvx.Minimize(cvx.norm(x-xt,2))\n", | |
" const = constraints.copy()\n", | |
" const.append(z == Lt)\n", | |
" p = cvx.Problem(obj, const)\n", | |
" try:\n", | |
" p.solve()\n", | |
" nxt = x.value\n", | |
" except:\n", | |
" term = True\n", | |
" \n", | |
" if term:\n", | |
" break\n", | |
" \n", | |
" arr.append(fU[-1]-opt)\n", | |
" t += 1\n", | |
" xt = nxt" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD4CAYAAAAAczaOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAVF0lEQVR4nO3dfYxddX7f8fdnxg9rnvFiiGuzhbTuA7BZFlyKummahnTxbqqa/IHkVimuhGoVEXVTtYqgkdrkD0vbSolapAWJJ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KkueaB8QDXFdVR6H3SwBcO7Lazc1U9V6O++hnk7zYDP9M/jd8WbQjyQ3AJ+n1MJftPrmgHbCM9kmS8STPA8eBvVU1sn3RxtCf1cPXl7BPVdVtwGeAB5P82KgrtACW2z56DPhLwK3AUeCXm/Il344klwFfAn6uqr433aJDypZMW4a0Y1ntk6o6U1W30nsu+B1Jbplm8QVtQxtDf1k/fL2qjjTT48CX6f237liS9QDN9PjoajgnU9V7We2jqjrW/NKeBf4T5/+rvaTbkWQlvaD89ar6raZ42e2TYe1Yrvukqt4BvgZsYUT7oo2hv2wfvp7k0iSXT84DnwZeplf/7c1i24GnR1PDOZuq3nuAbUlWJ7kR2ATsH0H9ZmXyF7Px0/T2CSzhdiQJ8GvAq1X1K30fLat9MlU7ltM+SbIuyVXN/BrgJ4FvMqp9Mcqj2gt4tPyz9I7yfwv4hVHXZw71/mF6R+1fAA5M1h34KLAPeK2Zrh11XYfU/Tfp/Tf7fXo9lfunqzfwC83+OQh8ZtT1n6Ed/xl4CXix+YVcvwza8aP0hgReBJ5vXp9dbvtkmnYsm30C/AjwR01dXwb+TVM+kn3hbRgkqUPaOLwjSZqCoS9JHWLoS1KHGPqS1CGGviR1iKEvSR1i6EtSh/x/AnZqob+yxJMAAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"plt.plot(arr)\n", | |
"plt.show()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAbMElEQ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yek4RxwBg7J2aWb2ZvAe3As+4eyPnItcC3QdrG0nWn17r7XOAm4L+Y2aeCLigDxto5+hFwPnAZsAf4v/H20I/DzMqAJ4Gvu/vRoQ4dpC00YxlkHGPunLh7j7tfBkwF5pnZJUMcnrFx5FrgtwH1/R5PBXYHVMs5c/fd8T/bgX+h78e4fWY2BSD+Z3twFZ6TZHWPqXPk7vvi/1h7gX/k4x+tQz0OMyukLyR/5u5PxZvH3DkZbBxj9ZwAuHsH8AIwnwDOR64F/lqg0cxmmFkMuA1YFXBNI2Jm48ys/Oz3wGeBzfTVf2f8sDuBp4Op8Jwlq3sVcJuZFZnZDKAReDOA+kbk7D/IuM/Td04gxOMwMwMeAra6+/f7PTWmzkmycYy1c2JmtWZWFf++BLgBeJcgzkfQn2Bn4BPxm+n7NP8D4JtB13MOdc+k75P5jcCWs7UDE4BfAe/H/xwfdK2D1L6Cvh+tz9A3O1k0VN3AN+PnpwW4Kej6hxnHT4BNwNvxf4hTxsA4PknfEsDbwFvxr5vH2jkZYhxj6pwAvwdsiNe7GfjLeHvWz4e2VhARiYhcW9IREZEkFPgiIhGhwBcRiQgFvohIRCjwRUQiQoEvIhIRCnwRkYj4/6WXZQBWtB6DAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"plt.semilogy(arr)\n", | |
"plt.show()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"interpreter": { | |
"hash": "40d3a090f54c6569ab1632332b64b2c03c39dcf918b08424e98f38b5ae0af88f" | |
}, | |
"kernelspec": { | |
"display_name": "Python 3", | |
"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.8.8" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment