<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mintoc.de/index.php?action=history&amp;feed=atom&amp;title=Hanging_chain_problem_%28GEKKO%29</id>
	<title>Hanging chain problem (GEKKO) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mintoc.de/index.php?action=history&amp;feed=atom&amp;title=Hanging_chain_problem_%28GEKKO%29"/>
	<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Hanging_chain_problem_(GEKKO)&amp;action=history"/>
	<updated>2026-06-09T10:28:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://mintoc.de/index.php?title=Hanging_chain_problem_(GEKKO)&amp;diff=2275&amp;oldid=prev</id>
		<title>JohnHedengren: /* Solver Results */</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Hanging_chain_problem_(GEKKO)&amp;diff=2275&amp;oldid=prev"/>
		<updated>2019-03-14T17:25:21Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Solver Results&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:25, 14 March 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l68&quot;&gt;Line 68:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 68:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Solver Results ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Solver Results ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;An MINLP solution is calculated with IPOPT with an objective function value of &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;math&amp;gt;&lt;/del&gt;5.13266&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/math&amp;gt;&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;An MINLP solution is calculated with IPOPT with an objective function value of 5.13266.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:Hanging_chain_GEKKO.png]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:Hanging_chain_GEKKO.png]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Gekko]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Gekko]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JohnHedengren</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Hanging_chain_problem_(GEKKO)&amp;diff=2274&amp;oldid=prev</id>
		<title>JohnHedengren: /* Results with APOPT (MINLP) */</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Hanging_chain_problem_(GEKKO)&amp;diff=2274&amp;oldid=prev"/>
		<updated>2019-03-14T17:25:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Results with APOPT (MINLP)&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:25, 14 March 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l66&quot;&gt;Line 66:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 66:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Results &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;with APOPT (MINLP) &lt;/del&gt;==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Solver &lt;/ins&gt;Results ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;An MINLP solution is calculated with IPOPT with an objective function value of &amp;lt;math&amp;gt;5.13266&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;An MINLP solution is calculated with IPOPT with an objective function value of &amp;lt;math&amp;gt;5.13266&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JohnHedengren</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Hanging_chain_problem_(GEKKO)&amp;diff=2262&amp;oldid=prev</id>
		<title>JohnHedengren: Add GEKKO Python solution</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Hanging_chain_problem_(GEKKO)&amp;diff=2262&amp;oldid=prev"/>
		<updated>2019-03-13T19:27:36Z</updated>

		<summary type="html">&lt;p&gt;Add GEKKO Python solution&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page contains a solution of the energy minimization of the [[Hanging chain problem]] in [https://gekko.readthedocs.io/en/latest/ GEKKO] Python format. The GEKKO package is available with &amp;#039;&amp;#039;&amp;#039;pip install gekko&amp;#039;&amp;#039;&amp;#039;. The Python code uses orthogonal collocation and a simultaneous optimization method. The end point constraints are imposed as soft constraints (objective terms).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
from gekko import GEKKO&lt;br /&gt;
import numpy as np&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
n = 51&lt;br /&gt;
Lp = 4&lt;br /&gt;
b = 3&lt;br /&gt;
a = 1&lt;br /&gt;
m = GEKKO()&lt;br /&gt;
m.time = np.linspace(0, 1, n)&lt;br /&gt;
&lt;br /&gt;
x1 = m.Var(value=a, lb=0, ub=10)&lt;br /&gt;
x2 = m.Var(value=0, lb=0, ub=10)&lt;br /&gt;
x3 = m.Var(value=0, lb=0, ub=10)&lt;br /&gt;
&lt;br /&gt;
u = m.MV(value=0, lb=-10, ub=20) # integer=True,&lt;br /&gt;
&lt;br /&gt;
tmp = np.zeros(n)&lt;br /&gt;
tmp[-1] = 1&lt;br /&gt;
&lt;br /&gt;
final = m.Param(value=tmp)&lt;br /&gt;
&lt;br /&gt;
m.Equation(x1.dt() == u)&lt;br /&gt;
m.Equation(x2.dt() == x1 * (1+u**2)**0.5)&lt;br /&gt;
m.Equation(x3.dt() == (1+u**2)**0.5)&lt;br /&gt;
# m.Equation((x1-b)*final == 0)&lt;br /&gt;
# m.Equation((x3-Lp)*final == 0)&lt;br /&gt;
&lt;br /&gt;
m.Obj(1000*(x1-b)**2*final)&lt;br /&gt;
m.Obj(1000*(x3-Lp)**2*final)&lt;br /&gt;
&lt;br /&gt;
#m.fix(x1, n-1, b)&lt;br /&gt;
#m.fix(x3, n-1, Lp)&lt;br /&gt;
&lt;br /&gt;
m.options.SOLVER = 3&lt;br /&gt;
m.options.NODES = 3&lt;br /&gt;
m.options.IMODE = 6&lt;br /&gt;
m.Obj(x2*final)&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
m.options.TIME_SHIFT = 0&lt;br /&gt;
u.STATUS = 0&lt;br /&gt;
m.solve()&lt;br /&gt;
&lt;br /&gt;
# solve&lt;br /&gt;
u.STATUS = 1&lt;br /&gt;
u.DCOST = 1e-3&lt;br /&gt;
m.solve()&lt;br /&gt;
&lt;br /&gt;
plt.subplot(2,1,1)&lt;br /&gt;
plt.plot(m.time,x1.value,&amp;#039;r--&amp;#039;,label=r&amp;#039;$x_1$&amp;#039;)&lt;br /&gt;
plt.plot(m.time,x2.value,&amp;#039;g-&amp;#039;,label=r&amp;#039;$x_2$&amp;#039;)&lt;br /&gt;
plt.plot(m.time,x3.value,&amp;#039;k:&amp;#039;,label=r&amp;#039;$x_3$&amp;#039;)&lt;br /&gt;
plt.ylabel(&amp;#039;x&amp;#039;)&lt;br /&gt;
plt.legend()&lt;br /&gt;
plt.xlim([0,1])&lt;br /&gt;
plt.subplot(2,1,2)&lt;br /&gt;
plt.plot(2,1,2)&lt;br /&gt;
plt.plot(m.time,u.value,&amp;#039;k-&amp;#039;,label=r&amp;#039;$u$&amp;#039;)&lt;br /&gt;
plt.ylabel(&amp;#039;u&amp;#039;)&lt;br /&gt;
plt.xlim([0,1])&lt;br /&gt;
plt.show()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results with APOPT (MINLP) ==&lt;br /&gt;
&lt;br /&gt;
An MINLP solution is calculated with IPOPT with an objective function value of &amp;lt;math&amp;gt;5.13266&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Hanging_chain_GEKKO.png]]&lt;br /&gt;
 &lt;br /&gt;
[[Category:Gekko]]&lt;/div&gt;</summary>
		<author><name>JohnHedengren</name></author>
	</entry>
</feed>