Files

67 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

2025-12-17 10:53:43 +08:00
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# check the change of objective values\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"fpath='objective_function.txt'\n",
"\n",
"objs=[]\n",
"\n",
"with open(fpath) as f:\n",
" lines = f.readlines()\n",
"\n",
" for l in lines:\n",
" if(l.startswith('i_inv')):\n",
" continue\n",
" objs.append(float(l.strip().split(',')[1]))\n",
"\n",
"\n",
"plt.xlabel('iteration')\n",
"plt.ylabel('objective function value')\n",
"plt.plot(objs)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.9.1 64-bit ('3.9.1')",
"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.9.1"
},
"vscode": {
"interpreter": {
"hash": "02f83e1f4cd9619657a6845405e2dd67c4de23753ba48bca5dce2ebf57b3813a"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}