LinRatSolve: Difference between revisions

From TomWiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
[[Category:Solvers]]
[[Category:Solvers]]
{{cleanup|Clean this article.}}
==Purpose==
==Purpose==


Line 11: Line 9:
<math>
<math>
\begin{array}{cccccc}
\begin{array}{cccccc}
\min\limits_x & \multicolumn{5}{l}{ \Large (c1 x) \over (c2 x)  } \\\mbox{subject to} & x_L & \leq &    x  & \leq &  x_U \\& b_L & \leq &  Ax  & \leq &  b_U \\
\min\limits_x & \multicolumn{5}{l}{ \Large (c1 x) \over (c2 x)  } \\\mbox{subject to} & x_L & \leq &    x  & \leq &  x_U \\& b_L & \leq &  Ax  & \leq &  b_U \\
\end{array}
\end{array}
Line 17: Line 14:


where <math>$c1,c2,x,x_L,x_U \in \Rdim{n}$</math> , <math>$b_L,b_U \in \Rdim{m_1}$</math> and <math>$A \in \Rdim{m_1 \times n}$</math>.
where <math>c1,c2,x,x_L,x_U \in \MATHSET{R}^{n}</math> , <math>b_L,b_U \in \MATHSET{R}^{m_1}</math> and <math>A \in \MATHSET{R}^{m_1 \times n}</math>.


==Calling  Syntax==
==Calling  Syntax==


<syntaxhighlight lang="matlab">
Result=linRatSolve(Prob,PriLev)
Result=linRatSolve(Prob,PriLev)
</syntaxhighlight>


===Description of Inputs===
==Inputs===


{|
{| class="wikitable"
|-valign="top"
|-valign="top"
|''Prob''||colspan="2"|Structure Prob.  Prob must be defined. Best is to use Prob = lpAssign(.....), if using the TQ format. Prob.QP.c1/c2 matrices should then be set (Prob.QP.c ignored).
|''Prob''||colspan="2"|Structure Prob.  Prob must be defined. Best is to use Prob = lpAssign(.....), if using the TQ format. Prob.QP.c1/c2 matrices should then be set (Prob.QP.c ignored).
|-
|-valign="top"
|''PriLev''||Print level in ''linRatSolve''.
|''PriLev''||Print level in ''linRatSolve''.
|-
 
|||= 0Silent except for error messages.
= 0 Silent except for error messages.
|-
 
|||''> ''0 Print summary information about problem transformation.
''> ''0 Print summary information about problem transformation.
|-
 
|||Calls ''PrintResult ''with specified ''PriLev''.
Calls ''PrintResult ''with specified ''PriLev''.
|-
 
|||= 2 Standard output from ''PrintResult ''(default).
= 2 Standard output from ''PrintResult ''(default).
|-
|-
|colspan="2"|Extra fields used in Prob:
|colspan="2"|Extra fields used in Prob:
Line 51: Line 50:
|}
|}


===Description  of Outputs===
==Outputs==
{|
 
{| class="wikitable"
|-valign="top"
|''Result''||Structure with results from optimization. Output depends on the solver used.
|''Result''||Structure with results from optimization. Output depends on the solver used.
|-valign="top"
 
|||The fields ''x_k'', ''f_k'', ''x_0'', ''xState'', ''bState'', ''v_k ''are transformed back to match the original problem.
The fields ''x_k'', ''f_k'', ''x_0'', ''xState'', ''bState'', ''v_k ''are transformed back to match the original problem.
|-
 
|||The output in Result.Prob is the result after linRatSolve transformed the problem, i.e. the altered Prob structure
The output in Result.Prob is the result after linRatSolve transformed the problem, i.e. the altered Prob structure
|}
|}


Line 71: Line 72:
\end{array}
\end{array}
</math>
</math>


The problem then becomes:
The problem then becomes:
<math>
<math>
\begin{array}{cccccc}
\begin{array}{cccccc}
Line 79: Line 82:
</math>
</math>
where <math>$A1 \in \Rdim{N},\; A1=speye(N)$</math>.
where <math>$A1 \in \MATHSET{R}^{N},\; A1=speye(N)$</math>.


OBSERVE the denominator ''c''2''x ''must always be positive. It is normally a good a idea to run the problem with both signs (multiply  each side by -1).
OBSERVE the denominator ''c''2''x ''must always be positive. It is normally a good a idea to run the problem with both signs (multiply  each side by -1).

Revision as of 09:26, 20 July 2011

Purpose

Finds a linearly constrained solution of a function of the ratio of two linear functions with the use of any suitable TOMLAB solver. Binary and integer variables are not supported.

linRatSolve solves problems of the type:


Failed to parse (unknown function "\multicolumn"): {\displaystyle \begin{array}{cccccc} \min\limits_x & \multicolumn{5}{l}{ \Large (c1 x) \over (c2 x) } \\\mbox{subject to} & x_L & \leq & x & \leq & x_U \\& b_L & \leq & Ax & \leq & b_U \\ \end{array} }


where Failed to parse (unknown function "\MATHSET"): {\displaystyle c1,c2,x,x_L,x_U \in \MATHSET{R}^{n}} , Failed to parse (unknown function "\MATHSET"): {\displaystyle b_L,b_U \in \MATHSET{R}^{m_1}} and Failed to parse (unknown function "\MATHSET"): {\displaystyle A \in \MATHSET{R}^{m_1 \times n}} .


Calling Syntax

Result=linRatSolve(Prob,PriLev)

Inputs=

Prob Structure Prob. Prob must be defined. Best is to use Prob = lpAssign(.....), if using the TQ format. Prob.QP.c1/c2 matrices should then be set (Prob.QP.c ignored).
PriLev Print level in linRatSolve.

= 0 Silent except for error messages.

> 0 Print summary information about problem transformation.

Calls PrintResult with specified PriLev.

= 2 Standard output from PrintResult (default).

Extra fields used in Prob:
SolverRat Name of the TOMLAB solver. Valid names are: cplex, minos, snopt, xa and more. See SolverList('lp');
QP.c1 The numerator in the objective.
QP.c2 The denominator in the objective.
z1_L Lower bound for z1 (default 1e-5). See description below

Outputs

Result Structure with results from optimization. Output depends on the solver used.

The fields x_k, f_k, x_0, xState, bState, v_k are transformed back to match the original problem.

The output in Result.Prob is the result after linRatSolve transformed the problem, i.e. the altered Prob structure

Description

The linear ratio problem is solved by linRatSolve by rewriting the problem as a linear constrained optimization problem. n+1 variables z1 and z2(2:n+1) are needed, stored as x(1:n+1). The n original variables are removed so one more variable exists in the final problem.


The problem then becomes:


Failed to parse (unknown function "\multicolumn"): {\displaystyle \begin{array}{cccccc} \multicolumn{6}{l}{\min\limits_x c1 z2}\\\\\mbox{subject to} & z1_L & \leq & z1 & \leq & \infty \\& 1 & \leq & c2 z2 & \leq & 1 \\& 0 & \leq & A z2 - z1 beq & \leq & 0 \\& -\infty & \leq & A z2 - z1 b_U & \leq & 0 \\& -\infty & \leq & - A z2 + z1 b_L & \leq & 0 \\\\& 0 & \leq & A1 z2 - z1 xeq & \leq & 0 \\& -\infty & \leq & A1 z2 - z1 x_U & \leq & 0 \\& -\infty & \leq & - A1 z2 + z1 x_L & \leq & 0 \\\end{array} }

where Failed to parse (unknown function "\MATHSET"): {\displaystyle $A1 \in \MATHSET{R}^{N},\; A1=speye(N)$} .

OBSERVE the denominator c2x must always be positive. It is normally a good a idea to run the problem with both signs (multiply each side by -1).

See Also

lpAssign.