<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://tomwiki.com/index.php?action=history&amp;feed=atom&amp;title=AddPwLinFun</id>
	<title>AddPwLinFun - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://tomwiki.com/index.php?action=history&amp;feed=atom&amp;title=AddPwLinFun"/>
	<link rel="alternate" type="text/html" href="http://tomwiki.com/index.php?title=AddPwLinFun&amp;action=history"/>
	<updated>2026-10-31T22:03:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.1</generator>
	<entry>
		<id>http://tomwiki.com/index.php?title=AddPwLinFun&amp;diff=734&amp;oldid=prev</id>
		<title>Elias at 14:53, 22 July 2011</title>
		<link rel="alternate" type="text/html" href="http://tomwiki.com/index.php?title=AddPwLinFun&amp;diff=734&amp;oldid=prev"/>
		<updated>2011-07-22T14:53:30Z</updated>

		<summary type="html">&lt;p&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 10:53, 22 July 2011&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-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;[[Category:Utility Functions]]&lt;/ins&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;==Purpose==&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;==Purpose==&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;/table&gt;</summary>
		<author><name>Elias</name></author>
	</entry>
	<entry>
		<id>http://tomwiki.com/index.php?title=AddPwLinFun&amp;diff=703&amp;oldid=prev</id>
		<title>Elias: Created page with &quot;==Purpose==  Adds piecewise linear function to a TOMLAB  MIP problem.  ==Calling  Syntax==  There are two ways to call addPwLinFun:  Syntax 1:  &lt;pre&gt; function Prob = addPwLinFun(...&quot;</title>
		<link rel="alternate" type="text/html" href="http://tomwiki.com/index.php?title=AddPwLinFun&amp;diff=703&amp;oldid=prev"/>
		<updated>2011-07-22T09:42:18Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Purpose==  Adds piecewise linear function to a TOMLAB  MIP problem.  ==Calling  Syntax==  There are two ways to call addPwLinFun:  Syntax 1:  &amp;lt;pre&amp;gt; function Prob = addPwLinFun(...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Purpose==&lt;br /&gt;
&lt;br /&gt;
Adds piecewise linear function to a TOMLAB  MIP problem.&lt;br /&gt;
&lt;br /&gt;
==Calling  Syntax==&lt;br /&gt;
&lt;br /&gt;
There are two ways to call addPwLinFun:&lt;br /&gt;
&lt;br /&gt;
Syntax 1: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Prob = addPwLinFun(Prob, 1, type, var, funVar, point, slope, a, fa)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Syntax 2: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Prob = addPwLinFun(Prob, 2, type, var, funVar, firstSlope, point, value, lastSlope)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Inputs==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Input||Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;Prob&amp;#039;&amp;#039;||The problem to add the function to.&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;input&amp;#039;&amp;#039;||Flag indicating syntax used.&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;type &amp;#039;&amp;#039;||A string telling whether to construct a general MIP problem or to construct an MIP problem only solvable by CPLEX. Possible values: &amp;#039;mip&amp;#039;, &amp;#039;cplex&amp;#039;.&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;var&amp;#039;&amp;#039;||The number of the variable on which the piecewise linear function depends.  Must exist in the problem already.&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;funVar&amp;#039;&amp;#039;||The number of the variable which will be equal to the piecewise linear function. Must exist in the problem already.&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;firstSlope&amp;#039;&amp;#039;||Syntax 2 only. The slope of the piecewise linear function left of the first point, point(1).&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;point&amp;#039;&amp;#039;||An array of break points. Must be sorted. If two values occur twice, there is a step at that point. Length r.&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;slope&amp;#039;&amp;#039;||Syntax 1 only. An array of the slopes of the segments. &lt;br /&gt;
&lt;br /&gt;
slope(i) is the slope between point(i-1) and point(i). &lt;br /&gt;
&lt;br /&gt;
slope(1) is the slope of the function left of point(1). &lt;br /&gt;
&lt;br /&gt;
slope(r+1) is the slope of the function right of point(r). &lt;br /&gt;
&lt;br /&gt;
If points(i-1) == points(i), slope(i) is the height of the step.&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;value&amp;#039;&amp;#039;||Syntax 2 only.  The values of the piecewise linear function at the points given in point. &lt;br /&gt;
&lt;br /&gt;
f(point(i)) = value(i). If point(i-1) == point(i),  value(i-1) is the right limit  of the value at the point, and value(i) is the left limit of the value at the point.&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;lastSlope&amp;#039;&amp;#039;||Syntax 2 only. The slope of the piecewise linear function right of the last point, point(r).&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;a, fa&amp;#039;&amp;#039;||Syntax 1 only. The value of the piecewise linear function at point a is equal to fa. f(a) = fa, that is.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Outputs==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Output||Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;Prob&amp;#039;&amp;#039;||The new problem structure with  the piecewise linear function added. New variables and linear constraints added. (MIP problem)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This function will make one already existing variable of the problem to be constrained  equal to a piecewise linear function of another already existing variable in the problem. The independent variable must be bounded in both directions.&lt;br /&gt;
&lt;br /&gt;
The variable constrained to be equal to a piecewise linear function can be used like any other variable; in constraints or the objective function.&lt;br /&gt;
&lt;br /&gt;
Depending on how many segments the function consists of, a number of new variables and constraints are added to the problem.&lt;br /&gt;
&lt;br /&gt;
Increasing the upper bound (x_U) or decreasing the lower bound (x_L) of the independent variable after calling this function will ruin the piecewise linear function.&lt;br /&gt;
&lt;br /&gt;
If the problem is to be solved by CPLEX, set type = &amp;#039;cplex&amp;#039; to enhance performance.  Otherwise, let type = &amp;#039;mip&amp;#039;. NOTICE! You can not solve a problem with another solver than CPLEX if type = &amp;#039;cplex&amp;#039;.&lt;/div&gt;</summary>
		<author><name>Elias</name></author>
	</entry>
</feed>