My Project
unitTest.cpp File Reference

This file runs the OS unitTest. More...

#include <cppad/cppad.hpp>
#include "OSCoinSolver.h"
#include "OSConfig.h"
#include "OSmps2osil.h"
#include "OSResult.h"
#include "OSOption.h"
#include "OSiLReader.h"
#include "OSiLWriter.h"
#include "OSoLReader.h"
#include "OSoLWriter.h"
#include "OSrLReader.h"
#include "OSrLWriter.h"
#include "OSInstance.h"
#include "OSFileUtil.h"
#include "CoinError.hpp"
#include "OSDefaultSolver.h"
#include "OSWSUtil.h"
#include "OSSolverAgent.h"
#include "OShL.h"
#include "OSErrorClass.h"
#include "OSBase64.h"
#include "OSCommonUtil.h"
#include "OSMathUtil.h"
#include <CoinMpsIO.hpp>
#include <CoinPackedMatrix.hpp>

Go to the source code of this file.

Macros

#define DEBUG
 
#define COMPONENT_DEBUG
 

Functions

int main (int argC, char *argV[])
 
double getObjVal (std::string osrl)
 

Detailed Description

This file runs the OS unitTest.

Author
Robert Fourer, Horand Gassmann, Jun Ma, Kipp Martin,
Version
1.1, 05/Feb/2008
Since
OS1.0
Remarks
Copyright (C) 2005-2008, Robert Fourer, Horand Gassmann, Jun Ma, Kipp Martin, Northwestern University, Dalhousie University, and the University of Chicago. All Rights Reserved. This software is licensed under the Common Public License. Please see the accompanying LICENSE file in root directory for terms.

This is the OS unitTest. It currently runs the following tests.

Solvers:

COIN-Clp tested on parincLinearByRow.osil

COIN-Cbc tested on p0033.osil

COIN-Ipopt tested on:

  1. avion2.osil
  2. HS071_NLP.osil
  3. rosenbrockmod.osil
  4. parincQuadratic.osil
  5. parincLinear.osil
  6. callBackTest.osil
  7. callBackTestRowMajor.osil

COIN-SYMPHONY test on p0033.osil COIN-BONMIN test on bonminEx1.osil and wayneQuadratic

COIN-DyLP tested onparincLinear.osil

COIN-Volume tested on volumeTest.osil

GLPK tested on p0033.osil

Cplex tested on p0033.osil

Lindo tested on:

  1. lindoapiaddins.osil
  2. rosenbrockmode.osil
  3. parincquadratic.osil
  4. wayneQuadratic.osil

We test the mps to osil converter progam OSmps2osil on parincLinear.mps. Solve with Cbc.

We test the AMPL nl file format to osil converter program OSnl2osil on hs71.nl. Solve with Lindo.

We test the base 64 format on problem parincLinear.
We first read in the parinc.mps file into an osil string and then set m_bWriteBase64 = true. We then write a new instance in base 64 format and solve it.

In addition there are a number of tests concerning th logic of many of the components of the OS project. These tests have little in common with the installation and functionality tests, but they are useful for debugging and to give a thorough workout to the program logic. These tests can be added selectively using several conditional variables:

  1. INSTALLATION_TEST. This turns the installation and solver tests on and off
  2. THOROUGH. To test more than one test problem for each solver
  3. COMPONENT_DEBUG. This turns the tests of the program logic an and off

The first logic test concerns the prefix and postfix routines. For the test problem rosenbrockmod.osil create an OSExpressionTree from the objective function. Then invoke the getPostfix() method and get a postfix vector representation of the expression tree. Then use createExpressionTreeFromPostfix to create an expression tree back. Then use getPrefix() to get a prefix vector from this expression tree. Then use createExpressionTreeFromPrefix to create and expression. Then use getPostfix() to get the postfix vector back and compare with the very first postfix vector and make sure they are the same.

Next test all of the nonlinear operators. The file testOperators.osil uses every nonlinear operator currently defined. Parse this file to make sure the parser works on every operator and then use expTree->m_treeRoot->calculateFunction to make sure the operators are evaluated correctly.

Next test CppAD. Read in CppADTestLag.osil and make sure gradient and Hessian calculations are working correctly.

We next test the parsers. We test parsing the osil file parincLinear.osil, finplan1.osil, the osrl file parincLinear.osrl and the osol file osolTest.osol. We test the get() and set() methods for osinstance.

Definition in file unitTest.cpp.

Macro Definition Documentation

◆ DEBUG

#define DEBUG

Definition at line 104 of file unitTest.cpp.

◆ COMPONENT_DEBUG

#define COMPONENT_DEBUG

Definition at line 107 of file unitTest.cpp.

Function Documentation

◆ main()

int main ( int argC,
char * argV[] )

Test the get() and set() methods

in this part of the unitTest we 1) read an OSoL string from a file 2) create an OSOption object from the string 3) add options to various array-valued elements 4) retrieve pieces of the OSOption object with get() methods 5) insert these pieces into a second OSOption object with set() methods 6) compare the two OSOption objects to make sure they are equal 7) write a new OSoL string from the in-memory OSOption object 8) read the string back again into a third OSOption object 9) compare to the original OSOption object 10) read two more OSoL strings from different files

!!

in this part of the unitTest we 1) read an OSrL string from a file 2) create an OSResult object from the string 3) write a new OSrL string from the in-memory OSResult object 4) read the string back again to make sure nothing was lost in translation

Definition at line 212 of file unitTest.cpp.

◆ getObjVal()

double getObjVal ( std::string osrl)

Definition at line 3199 of file unitTest.cpp.