1 // Copyright (C) 2009 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id$
6 //
7 // Authors:  Andreas Waechter, Frank E. Curtis         IBM    2009-06-12
8 //               (based on IpMc19TSymScalingMethod.cpp rev 1204)
9 
10 #include "IpoptConfig.h"
11 #include "IpInexactTSymScalingMethod.hpp"
12 #include "IpTripletHelper.hpp"
13 
14 namespace Ipopt
15 {
16 #if COIN_IPOPT_VERBOSITY > 0
17   static const Index dbg_verbosity = 0;
18 #endif
19 
20 
InitializeImpl(const OptionsList & options,const std::string & prefix)21   bool InexactTSymScalingMethod::InitializeImpl(const OptionsList& options,
22       const std::string& prefix)
23   {
24     return true;
25   }
26 
ComputeSymTScalingFactors(Index n,Index nnz,const ipfint * airn,const ipfint * ajcn,const double * a,double * scaling_factors)27   bool InexactTSymScalingMethod::ComputeSymTScalingFactors(Index n,
28       Index nnz,
29       const ipfint* airn,
30       const ipfint* ajcn,
31       const double* a,
32       double* scaling_factors)
33   {
34     DBG_START_METH("InexactTSymScalingMethod::ComputeTSymScalingFactors",
35                    dbg_verbosity);
36 
37     const Index nx = IpData().curr()->x()->Dim();
38     const Index ns = IpData().curr()->s()->Dim();
39     const Index nc = IpData().curr()->y_c()->Dim();
40     const Index nd = IpData().curr()->y_d()->Dim();
41 
42     for (Index i=0; i<nx; i++) {
43       scaling_factors[i] = 1.;
44     }
45     scaling_factors += nx;
46 
47     SmartPtr<const Vector> scaling_vec = InexCq().curr_scaling_slacks();
48     TripletHelper::FillValuesFromVector(ns, *scaling_vec, scaling_factors);
49     scaling_factors += ns;
50 
51     for (Index i=0; i<nc+nd; i++) {
52       scaling_factors[i] = 1.;
53     }
54 
55     return true;
56   }
57 
58 } // namespace Ipopt
59