// Copyright (C) 2005, 2006 International Business Machines and others. // All Rights Reserved. // This code is published under the Eclipse Public License. // // $Id: LuksanVlcek3.cpp 2005 2011-06-06 12:55:16Z stefan $ // // Authors: Andreas Waechter IBM 2005-10-127 #include "LuksanVlcek3.hpp" #ifdef HAVE_CONFIG_H #include "config.h" #else #include "configall_system.h" #endif #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # else # error "don't have header file for math" # endif #endif #ifdef HAVE_CSTDIO # include #else # ifdef HAVE_STDIO_H # include # else # error "don't have header file for stdio" # endif #endif using namespace Ipopt; LuksanVlcek3::LuksanVlcek3(Number g_l, Number g_u) { g_l_ = g_l; g_u_ = g_u; } bool LuksanVlcek3::InitializeProblem(Index N) { N_=N; if (N_<=5 || 4*((N_+2)/4)!=N_+2) { printf("N needs to be at least 6 and N+2 needs to be a multiple of 4.\n"); return false; } return true; } // returns the size of the problem bool LuksanVlcek3::get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, Index& nnz_h_lag, IndexStyleEnum& index_style) { // The problem described in LuksanVlcek3.hpp has 4 variables, x[0] through x[3] n = N_+2; m = 2; nnz_jac_g = 4; nnz_h_lag = 5*N_/2 + 3; // use the C style numbering of matrix indices (starting at 0) index_style = TNLP::C_STYLE; return true; } // returns the variable bounds bool LuksanVlcek3::get_bounds_info(Index n, Number* x_l, Number* x_u, Index m, Number* g_l, Number* g_u) { // none of the variables have bounds for (Index i=0; i