MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractLinAlgPack_VectorAuxiliaryOps.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #include <assert.h>
43 
46 #include "RTOp_ROp_max.h"
48 #include "RTOp_ROp_max_rel_step.h"
49 #include "RTOp_ROp_num_bounded.h"
59 #include "RTOp_TOp_ele_wise_sqrt.h"
63 #include "RTOpPack_RTOpC.hpp"
64 #include "Teuchos_Assert.hpp"
65 
66 namespace {
67 
68 // log_bound_barrier
69 static RTOpPack::RTOpC log_bound_barrier_op;
70 static Teuchos::RCP<RTOpPack::ReductTarget> log_bound_barrier_targ;
71 // combined_nu_comp_err
72 static RTOpPack::RTOpC combined_nu_comp_err_op;
73 static Teuchos::RCP<RTOpPack::ReductTarget> combined_nu_comp_err_targ;
74 // combined_nu_comp_err_lower
75 static RTOpPack::RTOpC combined_nu_comp_err_lower_op;
76 static Teuchos::RCP<RTOpPack::ReductTarget> combined_nu_comp_err_lower_targ;
77 // combined_nu_comp_err_upper
78 static RTOpPack::RTOpC combined_nu_comp_err_upper_op;
79 static Teuchos::RCP<RTOpPack::ReductTarget> combined_nu_comp_err_upper_targ;
80 // comp_err_with_mu
81 static RTOpPack::RTOpC comp_err_with_mu_op;
82 static Teuchos::RCP<RTOpPack::ReductTarget> comp_err_with_mu_targ;
83 // maximum near feasible step
84 static RTOpPack::RTOpC max_near_feas_step_op;
85 static Teuchos::RCP<RTOpPack::ReductTarget> max_near_feas_step_targ;
86 // fraction to boundary rule
87 static RTOpPack::RTOpC fraction_to_boundary_op;
88 static Teuchos::RCP<RTOpPack::ReductTarget> fraction_to_boundary_targ;
89 // fraction to zero boundary rule
90 static RTOpPack::RTOpC fraction_to_zero_boundary_op;
91 static Teuchos::RCP<RTOpPack::ReductTarget> fraction_to_zero_boundary_targ;
92 // maximum relative step
93 static RTOpPack::RTOpC max_rel_step_op;
94 static Teuchos::RCP<RTOpPack::ReductTarget> max_rel_step_targ;
95 // number of bounded elements
96 static RTOpPack::RTOpC num_bounded_op;
97 static Teuchos::RCP<RTOpPack::ReductTarget> num_bounded_targ;
98 // force in bounds
99 static RTOpPack::RTOpC force_in_bounds_op;
100 // force in bounds with buffer
101 static RTOpPack::RTOpC force_in_bounds_buffer_op;
102 // inv_of_difference
103 static RTOpPack::RTOpC inv_of_difference_op;
104 // correct_multipliers
105 static RTOpPack::RTOpC correct_lower_bound_multipliers_op;
106 static RTOpPack::RTOpC correct_upper_bound_multipliers_op;
107 // multipliers step
108 static RTOpPack::RTOpC lowerbound_multipliers_step_op;
109 static RTOpPack::RTOpC upperbound_multipliers_step_op;
110 // element wise square root
111 static RTOpPack::RTOpC ele_wise_sqrt_op;
112 
113 // Simple class for an object that will initialize the RTOp_Server.
114 class init_rtop_server_t {
115 public:
116  init_rtop_server_t() {
117  // Operator and target obj for log_bound_barrier
119  log_bound_barrier_targ = log_bound_barrier_op.reduct_obj_create();
120  // Operator and target obj for combined_nu_comp_err
122  combined_nu_comp_err_targ = combined_nu_comp_err_op.reduct_obj_create();
123  // Operator and target obj for combined_nu_comp_err_lower
125  combined_nu_comp_err_lower_targ = combined_nu_comp_err_lower_op.reduct_obj_create();
126  // Operator and target obj for combined_nu_comp_err_upper
128  combined_nu_comp_err_upper_targ = combined_nu_comp_err_upper_op.reduct_obj_create();
129  // Operator and target obj for comp_err_with_mu
130  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_ROp_comp_err_with_mu_construct(0.0,0.0,&comp_err_with_mu_op.op()));
131  comp_err_with_mu_targ = comp_err_with_mu_op.reduct_obj_create();
132  // Operator and target obj for max_near_feas_step
133  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_ROp_max_near_feas_step_construct(0.0,&max_near_feas_step_op.op()));
134  max_near_feas_step_targ = max_near_feas_step_op.reduct_obj_create();
135  // Operator and target obj for max_rel_step
137  max_rel_step_targ = max_rel_step_op.reduct_obj_create();
138  // Operator and target obj for fraction to boundary
139  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_ROp_fraction_to_boundary_construct(0.99,&fraction_to_boundary_op.op()));
140  fraction_to_boundary_targ = fraction_to_boundary_op.reduct_obj_create();
141  // Operator and target obj for fraction to zero boundary
142  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_ROp_fraction_to_zero_boundary_construct(0.99,&fraction_to_zero_boundary_op.op()));
143  fraction_to_zero_boundary_targ = fraction_to_zero_boundary_op.reduct_obj_create();
144  // Operator and target obj for num_bounded
145  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_ROp_num_bounded_construct(0.0,&num_bounded_op.op()));
146  num_bounded_targ = num_bounded_op.reduct_obj_create();
147  // Operator force_in_bounds
149  // Operator force_in_bounds_buffer
150  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_force_in_bounds_buffer_construct( 0.01, 0.001, &force_in_bounds_buffer_op.op() ));
151  // Operator inv_of_difference
152  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_inv_of_difference_construct( 1.0, &inv_of_difference_op.op()));
153  // correct_lower_bounds_multipliers
154  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_Correct_Multipliers_construct( -1e50, 0, &correct_lower_bound_multipliers_op.op()));
155  // correct_upper_bounds_multipliers
156  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_Correct_Multipliers_construct( 1e50, 1, &correct_upper_bound_multipliers_op.op()));
157  // lower_bounds_multipliers step
158  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_multiplier_step_construct( 1.0, -1.0, &lowerbound_multipliers_step_op.op()));
159  // upper_bounds_multipliers step
160  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_multiplier_step_construct( 1.0, 1.0, &upperbound_multipliers_step_op.op()));
161  // ele_wise_sqrt
163  }
164 };
165 
166 // When the program starts, this object will be created and the RTOp_Server object will
167 // be initialized before main() gets underway!
168 init_rtop_server_t init_rtop_server;
169 
170 } // end namespace
171 
174 {
175  RTOpPack::RTOpC op;
177  Teuchos::RCP<RTOpPack::ReductTarget> reduct_obj = op.reduct_obj_create();
178  const Vector* vecs[1] = { &v };
179  apply_op(op,1,vecs,0,NULL,&*reduct_obj);
180  return RTOp_ROp_max_val(op(*reduct_obj));
181 }
182 
183 std::pair<AbstractLinAlgPack::value_type,AbstractLinAlgPack::value_type>
185  const Vector& x, const Vector& d
186  ,const Vector& xl, const Vector& xu
187  ,value_type max_bnd_viol
188  )
189 {
190  const int num_vecs = 4;
191  const Vector*
192  vecs[num_vecs] = { &xl, &x, &d, &xu };
193  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_ROp_max_near_feas_step_set_beta( max_bnd_viol, &max_near_feas_step_op.op() ));
194  max_near_feas_step_op.reduct_obj_reinit(max_near_feas_step_targ.ptr());
195  apply_op(
196  max_near_feas_step_op, num_vecs, vecs, 0, NULL
197  ,&*max_near_feas_step_targ );
199  u = RTOp_ROp_max_near_feas_step_val(max_near_feas_step_op(*max_near_feas_step_targ));;
200  return std::pair<value_type,value_type>(u.alpha_pos,u.alpha_neg);
201 }
202 
205  const Vector& x, const Vector& d
206  )
207 {
208  const int num_vecs = 2;
209  const Vector*
210  vecs[num_vecs] = { &x, &d };
211  max_rel_step_op.reduct_obj_reinit(max_rel_step_targ.ptr());
212  apply_op(
213  max_rel_step_op, num_vecs, vecs, 0, NULL
214  ,&*max_rel_step_targ );
215  return RTOp_ROp_max_rel_step_val(max_rel_step_op(*max_rel_step_targ));
216 }
217 
218 
221  const value_type tau,
222  const Vector& x,
223  const Vector& d,
224  const Vector& xl,
225  const Vector& xu
226  )
227 {
228  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_ROp_fraction_to_boundary_init( tau, &fraction_to_boundary_op.op() ));
229  fraction_to_boundary_op.reduct_obj_reinit(fraction_to_boundary_targ.ptr());
230  const int num_vecs = 4;
231  const Vector*
232  vecs[num_vecs] = { &x, &d, &xl, &xu };
233  apply_op(
234  fraction_to_boundary_op, num_vecs, vecs, 0, NULL
235  ,&*fraction_to_boundary_targ );
236  return RTOp_ROp_fraction_to_boundary_val(fraction_to_boundary_op(*fraction_to_boundary_targ));
237 }
238 
241  const value_type tau,
242  const Vector& x,
243  const Vector& d
244  )
245 {
246  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_ROp_fraction_to_zero_boundary_init( tau, &fraction_to_zero_boundary_op.op() ));
247  fraction_to_zero_boundary_op.reduct_obj_reinit(fraction_to_zero_boundary_targ.ptr());
248  const int num_vecs = 2;
249  const Vector*
250  vecs[num_vecs] = { &x, &d };
251  apply_op(
252  fraction_to_zero_boundary_op, num_vecs, vecs, 0, NULL
253  ,&*fraction_to_zero_boundary_targ );
254  return RTOp_ROp_fraction_to_zero_boundary_val(fraction_to_zero_boundary_op(*fraction_to_zero_boundary_targ));
255 }
256 
259  const Vector& xl, const Vector& xu
260  ,value_type inf_bound
261  )
262 {
263  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_ROp_num_bounded_set_inf_bnd( inf_bound, &num_bounded_op.op() ));
264  num_bounded_op.reduct_obj_reinit(num_bounded_targ.ptr());
265  const int num_vecs = 2;
266  const Vector*
267  vecs[num_vecs] = { &xl, &xu };
268  apply_op(
269  num_bounded_op, num_vecs, vecs, 0, NULL
270  ,&*num_bounded_targ );
271  return RTOp_ROp_num_bounded_val(num_bounded_op(*num_bounded_targ));
272 }
273 
276  const Vector &x
277  ,const Vector &xl
278  ,const Vector &xu
279  )
280 {
281  log_bound_barrier_op.reduct_obj_reinit(log_bound_barrier_targ.ptr());
282  const int num_vecs = 3;
283  const Vector*
284  vecs[num_vecs] = { &x, &xl, &xu };
285  apply_op(
286  log_bound_barrier_op, num_vecs, vecs, 0, NULL
287  ,&*log_bound_barrier_targ
288  );
289 
290  return RTOp_ROp_log_bound_barrier_val(log_bound_barrier_op(*log_bound_barrier_targ));
291 }
292 
295  const Vector &v
296  ,const Vector &x
297  ,const Vector &xl
298  ,const Vector &xu
299  )
300 {
301  combined_nu_comp_err_op.reduct_obj_reinit(combined_nu_comp_err_targ.ptr());
302  const int num_vecs = 4;
303  const Vector*
304  vecs[num_vecs] = {&v, &x, &xl, &xu };
305  apply_op(
306  combined_nu_comp_err_op, num_vecs, vecs, 0, NULL
307  ,&*combined_nu_comp_err_targ
308  );
309  return RTOp_ROp_combined_nu_comp_err_val(combined_nu_comp_err_op(*combined_nu_comp_err_targ));
310 }
311 
314  const Vector &v
315  ,const Vector &x
316  ,const Vector &xl
317  )
318 {
319  combined_nu_comp_err_lower_op.reduct_obj_reinit(combined_nu_comp_err_lower_targ.ptr());
320  const int num_vecs = 3;
321  const Vector*
322  vecs[num_vecs] = {&v, &xl, &x};
323  apply_op(
324  combined_nu_comp_err_lower_op, num_vecs, vecs, 0, NULL
325  ,&*combined_nu_comp_err_lower_targ
326  );
327  return RTOp_ROp_combined_nu_comp_err_one_only_val(combined_nu_comp_err_lower_op(*combined_nu_comp_err_lower_targ));
328 }
329 
330 
333  const Vector &v
334  ,const Vector &x
335  ,const Vector &xu
336  )
337 {
338  combined_nu_comp_err_upper_op.reduct_obj_reinit(combined_nu_comp_err_upper_targ.ptr());
339  const int num_vecs = 3;
340  const Vector*
341  vecs[num_vecs] = {&v, &xu, &x};
342  apply_op(
343  combined_nu_comp_err_upper_op, num_vecs, vecs, 0, NULL
344  ,&*combined_nu_comp_err_upper_targ
345  );
346  return RTOp_ROp_combined_nu_comp_err_one_only_val(combined_nu_comp_err_upper_op(*combined_nu_comp_err_upper_targ));
347 }
348 
351  const value_type mu
352  ,const value_type inf_bound
353  ,const Vector &x
354  ,const Vector &xl
355  ,const Vector &xu
356  ,const Vector &vl
357  ,const Vector &vu
358  )
359 {
360  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_ROp_comp_err_with_mu_init(mu, inf_bound, &comp_err_with_mu_op.op()));
361  comp_err_with_mu_op.reduct_obj_reinit(comp_err_with_mu_targ.ptr());
362  const int num_vecs = 5;
363  const Vector*
364  vecs[num_vecs] = {&x, &xl, &xu, &vl, &vu};
365  apply_op(
366  comp_err_with_mu_op, num_vecs, vecs, 0, NULL
367  ,&*comp_err_with_mu_targ
368  );
369  return RTOp_ROp_comp_err_with_mu_val(comp_err_with_mu_op(*comp_err_with_mu_targ));
370 }
371 
374  ,const AbstractLinAlgPack::Vector &vL
375  ,const AbstractLinAlgPack::Vector &vU
376  ,AbstractLinAlgPack::size_type *max_viol_i
379  ,int *bnd_type
381  )
382 {
383  RTOpPack::RTOpC op;
385  Teuchos::RCP<RTOpPack::ReductTarget> reduct_obj = op.reduct_obj_create();
386  const int num_vecs = 3;
387  const Vector*
388  vecs[num_vecs] = { &v, &vL, &vU };
389  apply_op(
390  op, num_vecs, vecs, 0, NULL
391  ,&*reduct_obj
392  );
394  ro = RTOp_ROp_max_inequ_viol_val(op(*reduct_obj));
395  *max_viol_i = ro.max_viol_i;
396  *max_viol = ro.max_viol;
397  *v_i = ro.v_i;
398  *bnd_type = ro.bnd_type;
399  *vLU_i = ro.vLU_i;
400  return *max_viol_i > 0.0;
401 }
402 
404  const Vector& xl, const Vector& xu
405  ,VectorMutable* x
406  )
407 {
408 #ifdef TEUCHOS_DEBUG
409  TEUCHOS_TEST_FOR_EXCEPTION(x==NULL,std::logic_error,"force_in_bounds(...), Error");
410 #endif
411  const Vector* vecs[2] = { &xl, &xu };
412  VectorMutable* targ_vecs[1] = { x };
413  apply_op(force_in_bounds_op,2,vecs,1,targ_vecs,NULL);
414 }
415 
416 
418  const value_type rel_push,
419  const value_type abs_push,
420  const Vector& xl,
421  const Vector& xu,
422  VectorMutable* x
423  )
424 {
425  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_force_in_bounds_buffer_init( rel_push, abs_push, &force_in_bounds_buffer_op.op()));
426  const Vector* vecs[2] = { &xl, &xu };
427  VectorMutable* targ_vecs[1] = { x };
428  apply_op(force_in_bounds_buffer_op,2,vecs,1,targ_vecs,NULL);
429 }
430 
431 
433  const value_type alpha
434  ,const Vector &v0
435  ,const Vector &v1
436  ,VectorMutable *z
437  )
438 {
439  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_inv_of_difference_init( alpha, &inv_of_difference_op.op()));
440  const Vector* vecs[2] = { &v0, &v1 };
441  VectorMutable* targ_vecs[1] = { z };
442  apply_op(inv_of_difference_op,2,vecs,1,targ_vecs,NULL);
443 }
444 
446  const Vector &xl
447  ,const value_type inf_bound_limit
448  ,VectorMutable *vl
449  )
450 {
451  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_Correct_Multipliers_init( inf_bound_limit, 0, &correct_lower_bound_multipliers_op.op()))
452  const Vector* vecs[1] = { &xl };
453  VectorMutable* targ_vecs[1] = { vl };
454  apply_op(correct_lower_bound_multipliers_op,1,vecs,1,targ_vecs,NULL);
455 }
456 
458  const Vector &xu
459  ,const value_type inf_bound_limit
460  ,VectorMutable *vu
461  )
462 {
463  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_Correct_Multipliers_init( inf_bound_limit, 1, &correct_upper_bound_multipliers_op.op()));
464  const Vector* vecs[1] = { &xu };
465  VectorMutable* targ_vecs[1] = { vu };
466  apply_op(correct_upper_bound_multipliers_op,1,vecs,1,targ_vecs,NULL);
467 }
468 
470  const value_type mu,
471  const Vector& invXl,
472  const Vector& vl,
473  const Vector& d_k,
474  VectorMutable* dvl_k
475  )
476 {
477  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_multiplier_step_init(mu, -1.0, &lowerbound_multipliers_step_op.op()));
478  const Vector* vecs[] = { &invXl, &vl, &d_k };
479  VectorMutable* targ_vecs[] = { dvl_k };
480  apply_op(lowerbound_multipliers_step_op,3,vecs,1,targ_vecs,NULL);
481 }
482 
484  const value_type mu,
485  const Vector& invXu,
486  const Vector& vu,
487  const Vector& d_k,
488  VectorMutable* dvu_k
489  )
490 {
491  TEUCHOS_TEST_FOR_EXCEPT(0!=RTOp_TOp_multiplier_step_init(mu, 1.0, &upperbound_multipliers_step_op.op()));
492  const Vector* vecs[] = { &invXu, &vu, &d_k };
493  VectorMutable* targ_vecs[] = { dvu_k };
494  apply_op(upperbound_multipliers_step_op,3,vecs,1,targ_vecs,NULL);
495 }
496 
498  VectorMutable* z
499  )
500 {
501  VectorMutable* targ_vecs[] = { z };
502  apply_op(ele_wise_sqrt_op,0,NULL,1,targ_vecs,NULL);
503 }
504 
506  value_type min_ele
507  ,VectorMutable *y
508  )
509 {
510  RTOpPack::RTOpC op;
512  VectorMutable* targ_vecs[] = { y };
513  apply_op(op,0,NULL,1,targ_vecs,NULL);
514 }
515 
517  value_type min_ele
518  ,VectorMutable *y
519  )
520 {
521  RTOpPack::RTOpC op;
523  VectorMutable* targ_vecs[] = { y };
524  apply_op(op,0,NULL,1,targ_vecs,NULL);
525 }
int RTOp_ROp_comp_err_with_mu_construct(RTOp_value_type mu, RTOp_value_type inf_bound, struct RTOp_RTOp *op)
RTOp_value_type RTOp_ROp_log_bound_barrier_val(RTOp_ReductTarget reduct_obj)
struct RTOp_ROp_max_inequ_viol_reduct_obj_t RTOp_ROp_max_inequ_viol_val(RTOp_ReductTarget targ_obj)
int RTOp_ROp_fraction_to_boundary_init(RTOp_value_type tau, struct RTOp_RTOp *op)
void max_vec_scalar(value_type min_ele, VectorMutable *y)
Take the maximum value of the vector elements and a scalar.
Adapter subclass that uses a RTOp_RTOp object.
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
int RTOp_TOp_multiplier_step_init(RTOp_value_type mu, RTOp_value_type alpha, struct RTOp_RTOp *op)
RTOp_value_type RTOp_ROp_combined_nu_comp_err_val(RTOp_ReductTarget reduct_obj)
int RTOp_ROp_comp_err_with_mu_init(RTOp_value_type mu, RTOp_value_type inf_bound, struct RTOp_RTOp *op)
value_type IP_comp_err_with_mu(const value_type mu, const value_type inf_bound, const Vector &x, const Vector &xl, const Vector &xu, const Vector &vl, const Vector &vu)
Computes the complementarity error for a primal/dual interior point algorithm using inf norm...
void inv_of_difference(const value_type alpha, const Vector &v0, const Vector &v1, VectorMutable *z)
Computes the inverse of the difference between two vectors.
RTOp_value_type RTOp_ROp_combined_nu_comp_err_one_only_val(RTOp_ReductTarget reduct_obj)
int RTOp_TOp_inv_of_difference_init(RTOp_value_type alpha, struct RTOp_RTOp *op)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void force_in_bounds_buffer(const value_type rel_push, const value_type abs_push, const Vector &xl, const Vector &xu, VectorMutable *x)
Force a vector sufficiently within bounds according to a specified absolute and relative buffer...
void upperbound_multipliers_step(const value_type mu, const Vector &invXu, const Vector &vu, const Vector &d_k, VectorMutable *dvu)
Calculates the multiplier step for the upper bounds.
struct RTOp_ROp_max_near_feas_step_reduct_obj_t RTOp_ROp_max_near_feas_step_val(RTOp_ReductTarget targ_obj)
value_type max_element(const Vector &v)
Compute the maximum element in a vector.
void max_abs_vec_scalar(value_type min_ele, VectorMutable *y)
Take the maximum value of the absolute vector elements and a scalar.
int RTOp_TOp_force_in_bounds_buffer_init(RTOp_value_type rel_push, RTOp_value_type abs_push, struct RTOp_RTOp *op)
value_type max_rel_step(const Vector &x, const Vector &d)
Computes the maximum relative step of x = x + d.
RTOp_value_type RTOp_ROp_fraction_to_zero_boundary_val(RTOp_ReductTarget reduct_obj)
int RTOp_ROp_combined_nu_comp_err_construct(struct RTOp_RTOp *op)
int RTOp_ROp_max_near_feas_step_set_beta(RTOp_value_type beta, struct RTOp_RTOp *op)
int RTOp_ROp_combined_nu_comp_err_one_only_construct(struct RTOp_RTOp *op)
int RTOp_ROp_num_bounded_construct(RTOp_value_type inf_bnd, struct RTOp_RTOp *op)
int RTOp_TOp_inv_of_difference_construct(RTOp_value_type alpha, struct RTOp_RTOp *op)
int RTOp_TOp_multiplier_step_construct(RTOp_value_type mu, RTOp_value_type alpha, struct RTOp_RTOp *op)
int RTOp_TOp_max_vec_scalar_construct(RTOp_value_type min_ele, struct RTOp_RTOp *op)
RTOp_index_type RTOp_ROp_num_bounded_val(RTOp_ReductTarget targ_obj)
Ptr< T > ptr() const
int RTOp_ROp_num_bounded_set_inf_bnd(RTOp_value_type inf_bnd, struct RTOp_RTOp *op)
value_type combined_nu_comp_err(const Vector &v, const Vector &x, const Vector &xl, const Vector &xu)
Computes an estimate of the complementarity error.
int RTOp_ROp_log_bound_barrier_construct(struct RTOp_RTOp *op)
bool max_inequ_viol(const AbstractLinAlgPack::Vector &v, const AbstractLinAlgPack::Vector &vL, const AbstractLinAlgPack::Vector &vU, AbstractLinAlgPack::size_type *max_viol_i, AbstractLinAlgPack::value_type *max_viol, AbstractLinAlgPack::value_type *v_i, int *bnd_type, AbstractLinAlgPack::value_type *vLU_i)
Compute the maximum violation from a set of inequality constraints vL <= v <= vU. ...
RTOp_value_type RTOp_ROp_fraction_to_boundary_val(RTOp_ReductTarget reduct_obj)
int RTOp_ROp_fraction_to_zero_boundary_init(RTOp_value_type tau, struct RTOp_RTOp *op)
size_type num_bounded(const Vector &xl, const Vector &xu, value_type inf_bound)
Count the number of finitly bounded elements in xl <= x <= xu.
value_type fraction_to_boundary(const value_type tau, const Vector &x, const Vector &d, const Vector &xl, const Vector &xu)
value_type fraction_to_zero_boundary(const value_type tau, const Vector &x, const Vector &d)
RTOp_RTOp & op()
int RTOp_ROp_max_rel_step_construct(struct RTOp_RTOp *op)
int RTOp_ROp_max_near_feas_step_construct(RTOp_value_type beta, struct RTOp_RTOp *op)
RTOp_value_type RTOp_ROp_max_val(RTOp_ReductTarget reduct_obj)
Definition: RTOp_ROp_max.c:162
void ele_wise_sqrt(VectorMutable *z)
Calculates the sqrt of each element in the vector Pre Condition: all elements of z must be positive...
value_type log_bound_barrier(const Vector &x, const Vector &xl, const Vector &xu)
Computes the log barrier term:
int RTOp_TOp_ele_wise_sqrt_construct(struct RTOp_RTOp *op)
std::pair< value_type, value_type > max_near_feas_step(const Vector &x, const Vector &d, const Vector &xl, const Vector &xu, value_type max_bnd_viol)
Computes the maximum positive and negative step that can be taken that are within the relaxed bounds...
Abstract interface for mutable coordinate vectors {abstract}.
void apply_op(EApplyBy apply_by, const RTOpPack::RTOp &primary_op, const size_t num_multi_vecs, const MultiVector *multi_vecs[], const size_t num_targ_multi_vecs, MultiVectorMutable *targ_multi_vecs[], RTOpPack::ReductTarget *reduct_objs[]=NULL, const index_type primary_first_ele=1, const index_type primary_sub_dim=0, const index_type primary_global_offset=0, const index_type secondary_first_ele=1, const index_type secondary_sub_dim=0)
Apply a reduction/transformation operator column by column and return an array of the reduction objec...
int RTOp_ROp_max_construct(struct RTOp_RTOp *op)
Definition: RTOp_ROp_max.c:142
void force_in_bounds(const Vector &xl, const Vector &xu, VectorMutable *x)
Force a vector in bounds.
int RTOp_TOp_Correct_Multipliers_construct(RTOp_value_type inf_bound_limit, RTOp_index_type lower_or_upper, struct RTOp_RTOp *op)
int RTOp_TOp_force_in_bounds_buffer_construct(RTOp_value_type rel_push, RTOp_value_type abs_push, struct RTOp_RTOp *op)
RTOp_value_type RTOp_ROp_max_rel_step_val(RTOp_ReductTarget reduct_obj)
int RTOp_ROp_max_inequ_viol_construct(struct RTOp_RTOp *op)
void correct_lower_bound_multipliers(const Vector &xl, const value_type inf_bound_limit, VectorMutable *vl)
Corrects the lower bound multipliers with infinite bounds.
int RTOp_ROp_fraction_to_boundary_construct(RTOp_value_type tau, struct RTOp_RTOp *op)
void lowerbound_multipliers_step(const value_type mu, const Vector &invXl, const Vector &vl, const Vector &d_k, VectorMutable *dvl)
Calculates the multiplier step for lower bounds.
int RTOp_TOp_max_abs_vec_scalar_construct(RTOp_value_type min_ele, struct RTOp_RTOp *op)
int RTOp_ROp_fraction_to_zero_boundary_construct(RTOp_value_type tau, struct RTOp_RTOp *op)
int RTOp_TOp_Correct_Multipliers_init(RTOp_value_type inf_bound_limit, RTOp_index_type lower_or_upper, struct RTOp_RTOp *op)
const f_int f_dbl_prec const f_int f_int const f_int f_int const f_dbl_prec & u
void correct_upper_bound_multipliers(const Vector &xu, const value_type inf_bound_limit, VectorMutable *vu)
Corrects the upper bound multipliers with infinite bounds.
RTOp_value_type RTOp_ROp_comp_err_with_mu_val(RTOp_ReductTarget reduct_obj)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
value_type combined_nu_comp_err_upper(const Vector &v, const Vector &x, const Vector &xu)
Computes an estimate of the complementarity error when only the upper bounds are non-infinite.
int RTOp_TOp_force_in_bounds_construct(struct RTOp_RTOp *op)
value_type combined_nu_comp_err_lower(const Vector &v, const Vector &x, const Vector &xl)
Computes an estimate of the complementarity error when only the lower bounds are non-infinite.