#include "SA_MIProblem.h" #include #include #include #include void PrintSolution(SA_Solution& sol); void PrintMove(SA_Move& mov); main(int argc,char **argv) { std::string ans; std::cout << "Starting tests of SA_Problem and helper classes" << std::endl; std::cout << "Test 1: construct new SA_Problem instances and destroy" << std::endl; int count=1000000; SA_Problem** pprob = new SA_Problem*[count]; for (int i=0; i> dim >> cost >> newcost; std::cout << " Ndim = " << dim << std::endl << " Cost = " << cost << std::endl << " Newcost = " << newcost << std::endl; istr >> count; nelem = count*count; double* array = new double[nelem]; for (int i=0; i> array[i]; std::cout << " Refa = " << array[0] << "," << array[1] << "," << array[2] << "," << array[3] << "," << array[4] << ", ..." << std::endl; istr >> count; nelem = count*count; for (int i=0; i> array[i]; std::cout << " Sig1a = " << array[0] << "," << array[1] << "," << array[2] << "," << array[3] << "," << array[4] << ", ..." << std::endl; istr >> count; nelem = count*count; for (int i=0; i> array[i]; std::cout << " Sig1ph = " << array[0] << "," << array[1] << "," << array[2] << "," << array[3] << "," << array[4] << ", ..." << std::endl; istr >> count; nelem = count*count; for (int i=0; i> array[i]; std::cout << " Sig2ph = " << array[0] << "," << array[1] << "," << array[2] << "," << array[3] << "," << array[4] << ", ..." << std::endl; istr >> count; std::cout << ((count == 0)? " Lastmove is empty" : " Lastmove is present" ) << std::endl; delete array; } void PrintMove(SA_Move& mov) { std::ostringstream ostr; ostr << mov; std::istringstream istr(ostr.str()); int count, nelem; int modelset; istr >> modelset; std::cout << " Model_set = " << modelset << std::endl; istr >> count; if (count == 0) { std::cout << " Model is empty" << std::endl; } else { istr >> count; nelem = count*count; double* array = new double[nelem]; for (int i=0; i> array[i]; std::cout << " Model = " << array[0] << "," << array[1] << "," << array[2] << "," << array[3] << "," << array[4] << ", ..." << std::endl; delete array; } }