Main

Slack Variable Tutorial

Main.SlackVariables History

Hide minor edits - Show changes to output

June 18, 2013, at 12:04 AM by 69.169.131.173 -
Changed line 21 from:
(:html:)<br><br><br>(:htmlend:)
to:
----
June 18, 2013, at 12:04 AM by 69.169.131.173 -
Added lines 21-22:
(:html:)<br><br><br>(:htmlend:)
Deleted line 23:
<br><br>
June 18, 2013, at 12:03 AM by 69.169.131.173 -
Changed line 22 from:
<br>
to:
<br><br>
June 18, 2013, at 12:03 AM by 69.169.131.173 -
Added line 22:
<br>
June 18, 2013, at 12:02 AM by 69.169.131.173 -
Changed line 9 from:
(:table border=1 width=80% align=left bgcolor=#FFFFFF cellspacing=0:)
to:
(:table border=1 width=100% align=left bgcolor=#FFFFFF cellspacing=0:)
Deleted lines 20-21:
(:html:)<br><br><br><br><br>(:htmlend:)
Changed lines 31-55 from:
(:table border=1 width=100% align=left bgcolor=#EEEEEE cellspacing=0:)
(:cellnr:)
 ! Example model with slack variable
 ! Solve slack variable problem
 !  Minimize    total_cost
 !  Subject to  supply < b
 Model
  Parameters
    b = 5
  End Parameters

  Variables
    supply
    total_cost
  End Variables

  Equations
    supply < b

    total_cost = (supply-2)^2

    Minimize  total_cost
  End Equations
 End Model
(:cellnr:)
to:
Attach:slack_problem.png
Deleted line 33:
(:tableend:)
June 17, 2013, at 11:58 PM by 69.169.131.173 -
Changed lines 27-28 from:
!! Example Problem
to:
----

!
!! Example Problem
Changed lines 61-63 from:
!! Inequality Constraints in APM
to:
----

!
!! Inequality Constraints in APM
June 17, 2013, at 11:58 PM by 69.169.131.173 -
Changed line 31 from:
(:table border=1 width=50% align=left bgcolor=#EEEEEE cellspacing=0:)
to:
(:table border=1 width=100% align=left bgcolor=#EEEEEE cellspacing=0:)
Deleted lines 57-58:

(:html:)<br>(:htmlend:)
June 17, 2013, at 11:57 PM by 69.169.131.173 -
Added lines 58-59:

(:html:)<br>(:htmlend:)
June 17, 2013, at 11:56 PM by 69.169.131.173 -
Changed lines 27-28 from:
!!! Example Problem
to:
!! Example Problem
Changed line 59 from:
----
to:
!! Inequality Constraints in APM
June 17, 2013, at 11:55 PM by 69.169.131.173 -
Added lines 58-59:

----
June 17, 2013, at 11:54 PM by 69.169.131.173 -
Deleted lines 22-23:
Attach:table50.jpg [[http://apmonitor.com/online/view_pass.php?f=slack.apm | Click to Solve a Slack Variable Optimization Problem]]
Deleted lines 26-27:
In APMonitor, inequality constraints are automatically translated into equality constraints with slack variables. Slack variables can also be defined by starting a variable name with ''slk''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero.  Alternatively, inequality constraints will be automatically converted to equality constraints with a slack variable.
Added lines 29-30:
Attach:table50.jpg [[http://apmonitor.com/online/view_pass.php?f=slack.apm | Click to Solve a Slack Variable Optimization Problem]]
Changed lines 57-59 from:
(:tableend:)
to:
(:tableend:)

In APMonitor Modeling Language, inequality constraints are automatically translated into equality constraints with slack variables. Slack variables can also be defined by starting a variable name with ''slk''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero.  Alternatively, inequality constraints will be automatically converted to equality constraints with a slack variable.
June 17, 2013, at 11:52 PM by 69.169.131.173 -
Changed lines 7-8 from:
Slack variables are defined to transform an inequality expression into an equality expression with an added slack variable.  The slack variable is defined by setting a lower bound of zero (>=0).
to:
Slack variables are defined to transform an inequality expression into an equality expression with an added slack variable.  The slack variable is defined by setting a lower bound of zero (>0).
Changed line 18 from:
slack >= 0
to:
slack > 0
June 16, 2013, at 05:34 PM by 69.169.188.188 -
Changed lines 25-26 from:
In APMonitor, slack variables can be defined by starting a variable name with ''slk''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero.  Alternatively, inequality constraints will be automatically converted to equality constraints with a slack variable.
to:
(:html:)
<iframe width="560" height="315" src="http://www.youtube.com/embed/jh6BK0BqqIs?rel=0" frameborder="0" allowfullscreen></iframe>
(:htmlend:)

In APMonitor, inequality constraints are automatically translated into equality constraints with slack variables. Slack variables can also
be defined by starting a variable name with ''slk''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero.  Alternatively, inequality constraints will be automatically converted to equality constraints with a slack variable.
Changed line 59 from:
(:tableend:)
to:
(:tableend:)
March 16, 2012, at 03:27 PM by 69.169.136.170 -
Changed line 23 from:
Attach:table50.jpg [[http://apmonitor.com/online/view_pass.php?f=slack.apm | Solve Slack Variable Optimization Problems]]
to:
Attach:table50.jpg [[http://apmonitor.com/online/view_pass.php?f=slack.apm | Click to Solve a Slack Variable Optimization Problem]]
March 16, 2012, at 03:26 PM by 69.169.136.170 -
Added lines 1-4:
(:title Slack Variable Tutorial:)
(:keywords slack variables, inequality, slacks, lower bound, transform:)
(:description Slack variables are used to transform an inequality expression into an equality expression:)

Deleted line 55:
January 14, 2012, at 04:30 PM by 69.169.188.228 -
Changed lines 19-20 from:
to:
Attach:table50.jpg [[http://apmonitor.com/online/view_pass.php?f=slack.apm | Solve Slack Variable Optimization Problems]]
Deleted lines 21-26:

!!! Solve Slack Variable Problems Online

%blue%A%red%P%black%Monitor has an online interface for solving optimization problems.  The optimization problem shown below as '''Example Problem''' can be solved through the web-interface at the following link:

Attach:table50.jpg [[http://apmonitor.com/online/view_pass.php?f=slack.apm | Slack Variable Solution Online]]
January 14, 2012, at 04:26 PM by 69.169.188.228 -
Changed line 13 from:
x = b + slack  
to:
x = b + slack (:html:)<br>(:htmlend:)
January 14, 2012, at 04:24 PM by 69.169.188.228 -
Changed line 13 from:
x = b + slack,
to:
x = b + slack 
January 14, 2012, at 04:23 PM by 69.169.188.228 -
Changed line 13 from:
x = b + slack
to:
x = b + slack,
January 14, 2012, at 04:23 PM by 69.169.188.228 -
Changed line 5 from:
(:table border=2 width=50% align=left bgcolor=#FFFFFF cellspacing=0:)
to:
(:table border=1 width=80% align=left bgcolor=#FFFFFF cellspacing=0:)
January 14, 2012, at 04:20 PM by 69.169.188.228 -
Changed line 20 from:
In APMonitor, slack variables can be defined by starting a variable name with '''slk'''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero.  Alternatively, inequality constraints will be automatically converted to equality constraints with a slack variable.
to:
In APMonitor, slack variables can be defined by starting a variable name with ''slk''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero.  Alternatively, inequality constraints will be automatically converted to equality constraints with a slack variable.
January 14, 2012, at 04:20 PM by 69.169.188.228 -
Changed line 20 from:
In APMonitor, slack variables can be defined by starting a variable name with ''''slk''''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero.  Alternatively, inequality constraints will be automatically converted to equality constraints with a slack variable.
to:
In APMonitor, slack variables can be defined by starting a variable name with '''slk'''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero.  Alternatively, inequality constraints will be automatically converted to equality constraints with a slack variable.
January 14, 2012, at 04:19 PM by 69.169.188.228 -
Changed line 17 from:
(:html:)<br><br><br><br><br><br>(:htmlend:)
to:
(:html:)<br><br><br><br><br>(:htmlend:)
January 14, 2012, at 04:19 PM by 69.169.188.228 -
Changed line 17 from:
(:html:)<br><br><br><br>(:htmlend:)
to:
(:html:)<br><br><br><br><br><br>(:htmlend:)
January 14, 2012, at 04:18 PM by 69.169.188.228 -
Changed line 17 from:
(:html:)<br>(:htmlend:)
to:
(:html:)<br><br><br><br>(:htmlend:)
January 14, 2012, at 04:18 PM by 69.169.188.228 -
Changed line 5 from:
(:table border=1 width=50% align=left bgcolor=#FFFFFF cellspacing=0:)
to:
(:table border=2 width=50% align=left bgcolor=#FFFFFF cellspacing=0:)
January 14, 2012, at 04:18 PM by 69.169.188.228 -
Changed line 5 from:
(:table border=1 width=50% align=left bgcolor=#EEEEEE cellspacing=0:)
to:
(:table border=1 width=50% align=left bgcolor=#FFFFFF cellspacing=0:)
Added lines 16-18:

(:html:)<br>(:htmlend:)

January 14, 2012, at 04:16 PM by 69.169.188.228 -
Changed lines 5-7 from:
Slack variables are defined by starting a variable name with ''''slk''''.  Thus, valid slack variable names would include names such as ''slk_1'', ''slkr'', ''slkvar[1]''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero.

Equation inequalities are automatically tranformed to equality expressions for solvers that do not support them
.
to:
(:table border=1 width=50% align=left bgcolor=#EEEEEE cellspacing=0:)
(:cellnr:)
Inequality Constraint Form
(:cell:)
x > b
(:cellnr:)
Equality Constraint Form with Slack Variable
(:cell:)
x = b + slack
slack >= 0
(:tableend:)

In APMonitor, slack variables can be defined by starting a variable name with
''''slk''''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero.  Alternatively, inequality constraints will be automatically converted to equality constraints with a slack variable.
July 20, 2011, at 04:41 AM by 89.147.0.172 -
Changed line 19 from:
 ! Example model with slack variable declaration
to:
 ! Example model with slack variable
July 20, 2011, at 04:31 AM by 89.147.0.172 -
Changed lines 20-32 from:
 Model example
  Parameters
     p1 = 5
   End Parameters

   Variables
    slk_variable
 
    v1 < 4
  End Variables

  Equations
 
    v1 = p1 - slk_variable
  End Equations
to:
 ! Solve slack variable problem
 !
  Minimize     total_cost
 !
  Subject to  supply < b
 Model
  Parameters
    b = 5
 
End Parameters

 
Variables
   supply
    total_cost
  End Variables

  Equations
    supply < b

    total_cost = (supply-2)^2

    Minimize  total_cost

  End Equations
Changed lines 42-45 from:
 Solution
  p1 = 5
  slk
_variable = 1
  v1 = 4
to:
Attach:slack_results.png
July 20, 2011, at 04:02 AM by 89.147.0.172 -
Changed line 3 from:
Slack variables are defined to transform a inequality expression into an equality expression with an added slack variable.  The slack variable is defined by setting a lower bound of zero (>=0).
to:
Slack variables are defined to transform an inequality expression into an equality expression with an added slack variable.  The slack variable is defined by setting a lower bound of zero (>=0).
July 20, 2011, at 02:37 AM by 89.147.0.175 -
Changed lines 11-12 from:
%blue%A%red%P%black%Monitor has an online interface for solving optimization problems.  The optimization problem shown below can be solved through the web-interface at the following link:
to:
%blue%A%red%P%black%Monitor has an online interface for solving optimization problems.  The optimization problem shown below as '''Example Problem''' can be solved through the web-interface at the following link:
Changed line 15 from:
!!! Example
to:
!!! Example Problem
July 20, 2011, at 02:36 AM by 89.147.0.175 -
Changed line 13 from:
Attach: table50.jpg [[http://apmonitor.com/online/view_pass.php?f=slack.apm | Slack Variable Solution Online]]
to:
Attach:table50.jpg [[http://apmonitor.com/online/view_pass.php?f=slack.apm | Slack Variable Solution Online]]
July 20, 2011, at 02:35 AM by 89.147.0.175 -
Changed line 13 from:
[[http://apmonitor.com/online/view_pass.php?f=slack.apm | Slack Variable Solution Online]]
to:
Attach: table50.jpg [[http://apmonitor.com/online/view_pass.php?f=slack.apm | Slack Variable Solution Online]]
July 20, 2011, at 02:31 AM by 89.147.0.175 -
Changed line 11 from:
%blue%A%red%P%black%Monitor has an online interface for solving optimization problems.  The optimization problem shown below can be solved the web-interface at the following link:
to:
%blue%A%red%P%black%Monitor has an online interface for solving optimization problems.  The optimization problem shown below can be solved through the web-interface at the following link:
July 20, 2011, at 02:29 AM by 89.147.0.175 -
Added lines 8-13:

!!! Solve Slack Variable Problems Online

%blue%A%red%P%black%Monitor has an online interface for solving optimization problems.  The optimization problem shown below can be solved the web-interface at the following link:

[[http://apmonitor.com/online/view_pass.php?f=slack.apm | Slack Variable Solution Online]]
July 07, 2009, at 09:10 AM by 158.35.225.228 -
Changed lines 3-5 from:
Slack variables are defined to give ''slack'' for infeasibilities.  Generally, a slack variable is used to turn off an equation in a region where it does not apply.  The slack variable is defined by setting a lower bound of zero (>=0) and including the variable in the objective function.

Slack variables are defined by starting a variable name with
''''slk''''Thus, valid slack variable names would include names such as ''slk_1'', ''slkr'', ''slkvar[1]''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero and included in the objective function.
to:
Slack variables are defined to transform a inequality expression into an equality expression with an added slack variable.  The slack variable is defined by setting a lower bound of zero (>=0).

Slack variables are
defined by starting a variable name with ''''slk''''.  Thus, valid slack variable names would include names such as ''slk_1'', ''slkr'', ''slkvar[1]''When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero.

Equation inequalities are automatically tranformed to equality expressions for solvers that do not support them
.
September 25, 2008, at 01:24 PM by 158.35.225.230 -
Added lines 1-32:
!! Slack Variables

Slack variables are defined to give ''slack'' for infeasibilities.  Generally, a slack variable is used to turn off an equation in a region where it does not apply.  The slack variable is defined by setting a lower bound of zero (>=0) and including the variable in the objective function.

Slack variables are defined by starting a variable name with ''''slk''''.  Thus, valid slack variable names would include names such as ''slk_1'', ''slkr'', ''slkvar[1]''.  When the model is parsed at run-time, any variable beginning with ''slk'' is automatically assigned a lower value of zero and included in the objective function.

!!! Example

(:table border=1 width=50% align=left bgcolor=#EEEEEE cellspacing=0:)
(:cellnr:)
 ! Example model with slack variable declaration
 Model example
  Parameters
    p1 = 5
  End Parameters

  Variables
    slk_variable
    v1 < 4
  End Variables

  Equations
    v1 = p1 - slk_variable
  End Equations
 End Model
(:cellnr:)
 Solution
  p1 = 5
  slk_variable = 1
  v1 = 4
(:tableend:)