# TOMNET  
# REGISTER (TOMNET)
# LOGIN  
# myTOMNET
TOMLAB LOGO

« Previous « Start » Next »

4  Defining problems in TOMNET

TOMNET is based on the principle of creating a problem object that defines the problem and includes all relevant information needed for the solution. One unified format is defined, the TOMNET format. The TOMNET format provides an intuitive way of setting up a problem object and of solving it using any suitable TOMNET solver.

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

4.1  The TOMNET Format

The TOMNET format is a standardized way to setup problems and solve it using any of the TOMNET solvers. The principle is to put all information in a .NET class that is passed to the solver, which extracts the relevant information.
  1. Define the problem (a TOMNETProblem) by calling the appropriate constructor.
  2. Call the solver.
  3. Evaluate the results.
Step 1 is equivalent to calling a constructor of one of the TOMNETProblem classes listed in table 2.

Step 2, the solver call, using the Solver's Solve method.

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

See the different examples that illustrates how to apply the TOMNET format: lpQG.cs , nlpQG.cs  and more.

4.2  The TOMNET Test Problems

Several test problems are included with the distribution. The sets are available from the TOMNETTestProb.dll  located in tomnet/assembly.

It is possible to initialize individual problem instances by using built-in get-functions or constructors. The methods demands the problem number as input. If the number is out of range an exception will be thrown.

As before, the problem is solved by using the solver method solve .

Note that when solving a sequence of similar problems, it is recommended to create one problem object, make a loop, and inside the loop do the minor changes to get individual problems that are solved without creating a new instance each time.

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

class myTestProgram
{
  static void Main(string[] args)
  {
    TOMNETProblem Prob = new conProbProblem(10);
    Result result;
    NPSOL solver = new NPSOL();

    for (int i = 1; i < 100; i++)
    {
      Prob.x_0[0] = i ;
      solver.Solve(Prob, out result);
      Console.WriteLine("iteration {0}: f_k = {1}", i, result.f_k);
    }
  }
}
All the predefined test problem sets are available in the TOMNETTestProb.dll  assembly. 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 »