00001 /* 00002 * This file is part of qpOASES. 00003 * 00004 * qpOASES -- An Implementation of the Online Active Set Strategy. 00005 * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. 00006 * 00007 * qpOASES is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * qpOASES is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with qpOASES; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 * 00021 */ 00022 00023 00034 #include <QProblem.hpp> 00035 00036 00038 int main( ) 00039 { 00040 /* Setup data of first QP. */ 00041 real_t H[2*2] = { 1.0, 0.0, 0.0, 0.5 }; 00042 real_t A[1*2] = { 1.0, 1.0 }; 00043 real_t g[2] = { 1.5, 1.0 }; 00044 real_t lb[2] = { 0.5, -2.0 }; 00045 real_t ub[2] = { 5.0, 2.0 }; 00046 real_t lbA[1] = { -1.0 }; 00047 real_t ubA[1] = { 2.0 }; 00048 00049 /* Setup data of second QP. */ 00050 real_t g_new[2] = { 1.0, 1.5 }; 00051 real_t lb_new[2] = { 0.0, -1.0 }; 00052 real_t ub_new[2] = { 5.0, -0.5 }; 00053 real_t lbA_new[1] = { -2.0 }; 00054 real_t ubA_new[1] = { 1.0 }; 00055 00056 00057 /* Setting up QProblem object. */ 00058 QProblem example( 2,1 ); 00059 00060 /* Solve first QP. */ 00061 int nWSR = 10; 00062 example.init( H,g,A,lb,ub,lbA,ubA, nWSR,0 ); 00063 00064 /* Solve second QP. */ 00065 nWSR = 10; 00066 example.hotstart( g_new,lb_new,ub_new,lbA_new,ubA_new, nWSR,0 ); 00067 00068 return 0; 00069 } 00070 00071 00072 /* 00073 * end of file 00074 */