<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Optimization on Bughht Blog</title><link>https://bughht.github.io/tags/optimization/</link><description>Recent content in Optimization on Bughht Blog</description><generator>Hugo</generator><language>zh-CN</language><managingEditor>hhong6@mgh.harvard.edu (Haotian Hong)</managingEditor><webMaster>hhong6@mgh.harvard.edu (Haotian Hong)</webMaster><lastBuildDate>Mon, 15 Dec 2025 15:09:46 +0800</lastBuildDate><atom:link href="https://bughht.github.io/tags/optimization/index.xml" rel="self" type="application/rss+xml"/><item><title>ACDC Shim Waveform Optimization</title><link>https://bughht.github.io/intern_mgh/acdc_optim/</link><pubDate>Mon, 15 Dec 2025 15:09:46 +0800</pubDate><author>hhong6@mgh.harvard.edu (Haotian Hong)</author><guid>https://bughht.github.io/intern_mgh/acdc_optim/</guid><description>&lt;h1 id="shim-waveform-optimization-method-notes"&gt;Shim Waveform Optimization: Method Notes&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;GitHub Repository&lt;/strong&gt;: &lt;a href="https://github.com/bughht/ACDC_Optim"target="_blank" rel="external nofollow noopener noreferrer"&gt;bughht/ACDC_Optim&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;We solve for shim coil currents that cancel a measured (or predicted) $B_0$ bias field,
subject to per-coil amplitude and total-current hardware limits. The codebase
(&lt;code&gt;ACDC_optimization.py&lt;/code&gt;) provides &lt;strong&gt;four solvers&lt;/strong&gt; for this problem, chosen according to
whether the currents are static or time-varying, and whether the amplifier chain&amp;rsquo;s
temporal response (SIRF) needs to be modeled:&lt;/p&gt;
&lt;p&gt;Naming scheme: &lt;code&gt;solve_shim_&amp;lt;scope&amp;gt;_&amp;lt;algorithm&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Function&lt;/th&gt;
					&lt;th&gt;Use case&lt;/th&gt;
					&lt;th&gt;Method&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;solve_shim_static_qp&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Single time frame&lt;/td&gt;
					&lt;td&gt;Exact QP (&lt;code&gt;quadprog&lt;/code&gt;, Goldfarb–Idnani)&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;solve_shim_waveform_qp&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Waveform, &lt;strong&gt;no&lt;/strong&gt; SIRF coupling ($\mathbf{C}=\mathbf{I}$)&lt;/td&gt;
					&lt;td&gt;Exact QP per time point, parallelized (&lt;code&gt;joblib&lt;/code&gt;)&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;solve_shim_waveform_fista&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Waveform, &lt;strong&gt;with&lt;/strong&gt; SIRF coupling&lt;/td&gt;
					&lt;td&gt;FISTA (NumPy, FFT-based &lt;code&gt;scipy.signal.convolve&lt;/code&gt;, or legacy dense $\mathbf{C}$)&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;solve_shim_waveform_fista_torch&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Waveform, with SIRF, large $T$ / GPU&lt;/td&gt;
					&lt;td&gt;FISTA (PyTorch, FFT-based &lt;code&gt;conv1d&lt;/code&gt;, or legacy dense $\mathbf{C}$)&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;When the SIRF convolution can be neglected, per-time-point QP gives the &lt;em&gt;exact&lt;/em&gt; convex
optimum and is used directly (&lt;code&gt;solve_shim_waveform_qp&lt;/code&gt;). FISTA is only needed once the
temporal convolution matrix $\mathbf{C}$ couples time points together, since that removes
the block-diagonal structure that makes per-frame QP tractable.&lt;/p&gt;</description></item></channel></rss>