banded_cp.cpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of ACADO Toolkit.
00003  *
00004  *    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
00005  *    Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
00006  *    Milan Vukov, Rien Quirynen, KU Leuven.
00007  *    Developed within the Optimization in Engineering Center (OPTEC)
00008  *    under supervision of Moritz Diehl. All rights reserved.
00009  *
00010  *    ACADO Toolkit is free software; you can redistribute it and/or
00011  *    modify it under the terms of the GNU Lesser General Public
00012  *    License as published by the Free Software Foundation; either
00013  *    version 3 of the License, or (at your option) any later version.
00014  *
00015  *    ACADO Toolkit is distributed in the hope that it will be useful,
00016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *    Lesser General Public License for more details.
00019  *
00020  *    You should have received a copy of the GNU Lesser General Public
00021  *    License along with ACADO Toolkit; if not, write to the Free Software
00022  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023  *
00024  */
00025 
00026 
00033 #include <acado/conic_program/banded_cp.hpp>
00034 
00035 
00036 BEGIN_NAMESPACE_ACADO
00037 
00038 
00039 //
00040 // PUBLIC MEMBER FUNCTIONS:
00041 //
00042 
00043 BandedCP::BandedCP( ){
00044 
00045     nS = 0;
00046 
00047     B   = 0;
00048     lbB = 0;
00049     ubB = 0;
00050 
00051     ylbB = 0;
00052     yubB = 0;
00053 }
00054 
00055 
00056 BandedCP::BandedCP( const BandedCP& rhs ){
00057 
00058     copy(rhs);
00059 }
00060 
00061 
00062 BandedCP::~BandedCP( ){
00063 
00064     clean();
00065 }
00066 
00067 
00068 BandedCP& BandedCP::operator=( const BandedCP& rhs ){
00069 
00070     if ( this != &rhs ){
00071 
00072         clean()  ;
00073         copy(rhs);
00074     }
00075     return *this;
00076 }
00077 
00078 
00079 
00080 void BandedCP::copy( const BandedCP& rhs ){
00081 
00082 
00083     hessian                 = rhs.hessian                ;
00084     objectiveGradient       = rhs.objectiveGradient      ;
00085 
00086     lowerBoundResiduum      = rhs.lowerBoundResiduum     ;
00087     upperBoundResiduum      = rhs.upperBoundResiduum     ;
00088 
00089     dynGradient             = rhs.dynGradient            ;
00090     dynResiduum             = rhs.dynResiduum            ;
00091 
00092     constraintGradient      = rhs.constraintGradient     ;
00093     lowerConstraintResiduum = rhs.lowerConstraintResiduum;
00094     upperConstraintResiduum = rhs.upperConstraintResiduum;
00095 
00096     deltaX                  = rhs.deltaX                 ;
00097     lambdaBound             = rhs.lambdaBound            ;
00098     lambdaDynamic           = rhs.lambdaDynamic          ;
00099     lambdaConstraint        = rhs.lambdaConstraint       ;
00100 
00101 
00102 //     int run1, run2;
00103 
00104 //     nS = rhs.nS;
00105 // 
00106 // 
00107 //     if( rhs.B != 0 ){
00108 //         B = (BlockMatrix**)calloc(nS,sizeof(BlockMatrix*));
00109 //         for( run1 = 0; run1 < nS; run1++ ){
00110 //             B[run1] = new BlockMatrix[nV];
00111 //             for( run2 = 0; run2 < nV; run2++ )
00112 //                 B[run1][run2] = rhs.B[run1][run2];
00113 //         }
00114 //     }
00115 //     else B = 0;
00116 // 
00117 // 
00118 //     if( rhs.lbB != 0 ){
00119 //         lbB = (BlockMatrix*)calloc(nS,sizeof(BlockMatrix));
00120 //         for( run1 = 0; run1 < nS; run1++ )
00121 //             lbB[run1] = rhs.lbB[run1];
00122 //     }
00123 //     else lbB = 0;
00124 // 
00125 //     if( rhs.ubB != 0 ){
00126 //         ubB = (BlockMatrix*)calloc(nS,sizeof(BlockMatrix));
00127 //         for( run1 = 0; run1 < nS; run1++ )
00128 //             ubB[run1] = rhs.ubB[run1];
00129 //     }
00130 //     else ubB = 0;
00131 // 
00132 // 
00133 //     if( nS > 0 ){
00134 // 
00135 //         ylbB = (BlockMatrix**)calloc(nS,sizeof(BlockMatrix*));
00136 //         yubB = (BlockMatrix**)calloc(nS,sizeof(BlockMatrix*));
00137 // 
00138 //         for( run1 = 0; run1 < nS; run1++ ){
00139 //             if( rhs.ylbB[run1] != 0 ) ylbB[run1] = new BlockMatrix(*rhs.ylbB[run1]);
00140 //             else                      ylbB[run1] = 0                          ;
00141 // 
00142 //             if( rhs.yubB[run1] != 0 ) yubB[run1] = new BlockMatrix(*rhs.yubB[run1]);
00143 //             else                      yubB[run1] = 0                          ;
00144 //         }
00145 //     }
00146 //     else{
00147 //         ylbB = 0;
00148 //         yubB = 0;
00149 //     }
00150 }
00151 
00152 
00153 
00154 void BandedCP::clean(){
00155 
00156 //     int run1;
00157 // 
00158 //     for( run1 = 0; run1 < nS; run1++ ){
00159 // 
00160 //         if( B[run1]    != 0 ) delete[]    B[run1];
00161 //         if( ylbB[run1] != 0 ) delete   ylbB[run1];
00162 //         if( yubB[run1] != 0 ) delete   yubB[run1];
00163 //     }
00164 // 
00165 //     if( B    != 0 ) free(B)   ;
00166 //     if( ylbB != 0 ) free(ylbB);
00167 //     if( yubB != 0 ) free(yubB);
00168 // 
00169 //     if( lbB != 0 ) free(lbB);
00170 //     if( ubB != 0 ) free(ubB);
00171 }
00172 
00173 
00174 
00175 
00176 CLOSE_NAMESPACE_ACADO
00177 
00178 // end of file.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:36:43