# TOMVIEW  
# REGISTER (TOMVIEW)
# LOGIN  
# myTOMVIEW
TOMLAB LOGO

« Previous « Start » Next »

4  Defining problems in TOMVIEW

TOMVIEW is based on the principle of creating a problem structure that defines the problem and includes all relevant information needed for the solution. One unified format is defined, the TOMVIEW format. The TOMVIEW format gives the user a fast way to setup a problem structure and solve the problem using any suitable TOMVIEW solver.

In this section follows a more detailed description of the TOMVIEW format and problem sets available.

4.1  The TOMVIEW Format

The TOMVIEW format is a standardized way to setup problems and solve it using any of the TOMVIEW solvers. The principle is to put all information in a LabVIEW structure that is passed to the solver, which extracts the relevant information. User data can be added to the structure and made available in the user functions.
  1. Define the problem structure, called Prob by using an assign routine.
  2. Call the solver or the universal driver routine tomRun.
  3. Evaluate the results.
Step 1 means to call one of the following routines dependent on the type of optimization problem, see Table 8.



Table 8: Routines to create a problem structure in the TOMVIEW format.


TOMVIEW block probTypes Type of optimization problem
assign_cls 4,5,6 Unconstrained and constrained nonlinear least squares.
assign_clsExtra 4,5,6 Additional parameters for assign_cls.
assign_con 1,3 Unconstrained and constrained nonlinear optimization.
assign_glb 9 Box-bounded global programming.
assign_glc 9,10,15 Box-bounded or mixed-integer constrained global programming.
assign_lls 5 Linear least-square problems.
assign_lp 8 Linear programming.
assign_lpcon 3 Linear programming with nonlinear constraints.
assign_minlp 12 Mixed-Integer nonlinear programming.
assign_mip 7 Mixed-Integer programming.
assign_miqp 11 Mixed-Integer quadratic programming.
assign_qp 2 Quadratic programming.
assign_qpcon 3 Quadratic programming with nonlinear constraints.

Step 2, the solver call, using the driver VI tomRun.

The tomRun routine also demonstrates how to call a solver directly.

Step 3 could be a call to check the ExitFlag or result, as shown in all the quick guide examples.

See the different demo VI's that gives examples of how to apply the TOMBIEW format: lpQG.vi, nlpQG.vi and more.

4.1.1  A basic example

This section presents an example of how to use the solvers. The example below is a production planning model and describes how to optimize the production with limitation in material and labor.

A small joinery makes two different sizes of boxwood chess sets. The small set requires 3 hours of machining on a lathe, and the large set requires 2 hours. There are four lathes with skilled operators who each work a 40 hours week, so the company has 160 lathe-hours per week. The small chess set requires 1 kg of boxwood, and the large set requires 3 kg. Unfortunately, boxwood is scarce and only 200 kg per week can be obtained.

When sold, each of the large chess sets yelds a profit of $20, and one of the small chess set has a profit of $5.

The problem is to decide how many sets of each kind should be made each week so as to maximize profit.

The problem can mathematical be formulated as:

 
min
x1,x2
f(x) = −5x1−20x2
   
s/t
3x1+2x2 160,
x1+3x2 200,
x1,x2 0
    (10)
where x1, x2 ∈ N. x1 is the number of small chess sets to make and x2 is the number of large chess sets to make. The coefficients in the objective function are negative because of the original problem is a maximization problem.

This simple example can easily be solved by milpsolve. The following figure illustrates how to use the solver.



Figure 6: Front Panel for the example problem.


pngs/tomview005.png

The linear constraints can be formulated in a matrix A with upper bounds bU. The lower limits for the variables x1 and x2 equals zero and are set in the lower limit vector xL. Since both variables are integers, both elements in the vector with integer indices are 1 (0 for non-integers). The profit vector consist of the coefficients in the linear function to minimize. After running the program the following is displayed:



Figure 7: Front Panel for the solved example problem.


pngs/tomview006.png

First the optimal solution can be observed to be x1=2 and x2=66, which can be seen in xk. The function value at the optimum is -1330. Also an exit text is given, stating that the solver found an optimal solution.

To illustrate how the problem is assigned and solved, see the next figure.



Figure 8: Block Diagram - assigning and solving the example problem.


pngs/tomview007.png

The constraint matrix A and the vectors c, bU, xL as well as the integer indices are inserted into the VI assign_mip (since of the problem is a Mixed Integer Problem). The problem is then directed to a milpsolve options block. In this case the maximal CPU time is set to 10 seconds. After the option has been set it enters the solve node tomRun, which in this case uses the solver milpsolve. The outputs from tomRun are returned in a cluster with optimum information.

4.2  The TOMVIEW Test Format

Several test problems are included with the distribution. The sets are available from the *Examples.vi's located in the various folders below TOMVIEW/testprob.

It is possible to initialize individual problem instances by using the probInit VI. The block takes the problem set and a number as input. If the number is out of range an error will be displayed.

As before, the problem is solved by using the driver block tomRun.

Note that when solving a sequence of similar problems, the best way is to pick up the problem structure once using probInit, and then make a loop, do the changes in the structure, and solve the problem for each change.

For example one might want to solve problem 10 in conProb one hundred times for different starting values in the interval [1,100].

All the predefined test problem sets are available in the testprob directory. See also the different demonstration files in the quickguide directory.

See Section 2.3.1 for more information on how to access the test problems.

« Previous « Start » Next »