Quickguide LINRAT Problem: Difference between revisions

From TomWiki
Jump to navigationJump to search
(Created page with "{{Part Of Manual|title=the Quickguide Manual|link=Quickguide}} The linearly '''constrained linear ratio''' ('''LINRAT''') problem is defined as <math> \begin{arr...")
 
No edit summary
 
Line 4: Line 4:


<math>
<math>
\begin{array}{cccccc}    \min\limits_x & \multicolumn{5}{l}{c1 x \over c2 x} \\    \mbox{subject to} & x_L & \leq &  x  & \leq & x_U \\    {}                & b_L & \leq &  Ax  & \leq & b_U \\\end{array}
\begin{array}{cccccc}    \min\limits_x & {c1 x \over c2 x} \\    \mbox{subject to} & x_L & \leq &  x  & \leq & x_U \\    {}                & b_L & \leq &  Ax  & \leq & b_U \\\end{array}
</math>
</math>


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


The LINRAT solution can be obtained by the use of any suitable linear <span class="roman">TOMLAB</span> solver.
The LINRAT solution can be obtained by the use of any suitable linear <span class="roman">TOMLAB</span> solver.
Line 18: Line 18:
Open the file for viewing, and execute linratQG in Matlab.
Open the file for viewing, and execute linratQG in Matlab.


<syntaxhighlight lang="matlab">
<source lang="matlab">
  % linratQG is a small example problem for defining and solving
  % linratQG is a small example problem for defining and solving
  % linear ratio programming problems using the TOMLAB format.
  % linear ratio programming problems using the TOMLAB format.
Line 62: Line 62:
   
   
  Result  = tomRun('linRatSolve', Prob, PriLev);
  Result  = tomRun('linRatSolve', Prob, PriLev);
</syntaxhighlight>
</source>

Latest revision as of 18:15, 17 January 2012

Notice.png

This page is part of the Quickguide Manual. See Quickguide.

The linearly constrained linear ratio (LINRAT) problem is defined as


where , , and .

The LINRAT solution can be obtained by the use of any suitable linear TOMLAB solver.

The following file illustrates how to solve a LINRAT problem in TOMLAB.

File: tomlab/quickguide/linratQG.m

Open the file for viewing, and execute linratQG in Matlab.

 % linratQG is a small example problem for defining and solving
 % linear ratio programming problems using the TOMLAB format.
 
 Name = 'Linear Ratio 1';
 x_0  = [2;2;2;2];          % Initial value
 x_L  = [1;2;3;4];          % Lower bounds on x
 x_U  = [100;100;50;50];    % Upper bounds on x
 
 % Define the numerator and denominator for the objective
 c1 = [3;7;9;11]; 
 c2 = [20;15;10;5];
 
 % Add the linear constraint x(1) + x(2) + x(3) + x(4) - 20 &lt;= 0
 % Write the constraint as x(1) + x(2) + x(3) + x(4) &lt;= 20
 
 % The A matrix could be specified dense or sparse
 % A   = sparse([1 1 1 1]);
 
 A   = [1 1 1 1];
 b_L = -inf;
 b_U = 20;
 
 c = zeros(4,1); % Dummy objective
 
 % Generate an LP problem using the Tomlab Quick format
 % Use mipAssign if solving a mixed-integer problem
 Prob = lpAssign(c, A, b_L, b_U, x_L, x_U, x_0, Name);
 Prob.QP.c1 = c1;
 Prob.QP.c2 = c2;
 
 Prob.SolverRat = 'minos';
 
 % One may set other solvers:
 % Prob.SolverRat = 'cplex';
 % Prob.SolverRat = 'xa';
 % Prob.SolverRat = 'snopt';
 % Prob.SolverRat = 'milpSolve';
 
 % Set print level 1 to get output from PrintResult at the end
 PriLev = 1;
 Prob.PriLevOpt = 0;
 
 Result  = tomRun('linRatSolve', Prob, PriLev);