44 #include "AbstractLinAlgPack_VectorAuxiliaryOps.hpp"
45 #include "AbstractLinAlgPack_VectorMutable.hpp"
63 #include "RTOpPack_RTOpC.hpp"
64 #include "Teuchos_Assert.hpp"
114 class init_rtop_server_t {
116 init_rtop_server_t() {
125 combined_nu_comp_err_lower_targ = combined_nu_comp_err_lower_op.
reduct_obj_create();
128 combined_nu_comp_err_upper_targ = combined_nu_comp_err_upper_op.
reduct_obj_create();
143 fraction_to_zero_boundary_targ = fraction_to_zero_boundary_op.
reduct_obj_create();
168 init_rtop_server_t init_rtop_server;
172 AbstractLinAlgPack::value_type
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));
183 std::pair<AbstractLinAlgPack::value_type,AbstractLinAlgPack::value_type>
187 ,value_type max_bnd_viol
190 const int num_vecs = 4;
192 vecs[num_vecs] = { &xl, &x, &d, &xu };
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);
203 AbstractLinAlgPack::value_type
208 const int num_vecs = 2;
210 vecs[num_vecs] = { &x, &d };
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));
219 AbstractLinAlgPack::value_type
221 const value_type tau,
230 const int num_vecs = 4;
232 vecs[num_vecs] = { &x, &d, &xl, &xu };
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));
239 AbstractLinAlgPack::value_type
241 const value_type tau,
248 const int num_vecs = 2;
250 vecs[num_vecs] = { &x, &d };
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));
257 AbstractLinAlgPack::size_type
260 ,value_type inf_bound
265 const int num_vecs = 2;
267 vecs[num_vecs] = { &xl, &xu };
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));
274 AbstractLinAlgPack::value_type
282 const int num_vecs = 3;
284 vecs[num_vecs] = { &x, &xl, &xu };
286 log_bound_barrier_op, num_vecs, vecs, 0, NULL
287 ,&*log_bound_barrier_targ
290 return RTOp_ROp_log_bound_barrier_val(log_bound_barrier_op(*log_bound_barrier_targ));
293 AbstractLinAlgPack::value_type
302 const int num_vecs = 4;
304 vecs[num_vecs] = {&v, &x, &xl, &xu };
306 combined_nu_comp_err_op, num_vecs, vecs, 0, NULL
307 ,&*combined_nu_comp_err_targ
309 return RTOp_ROp_combined_nu_comp_err_val(combined_nu_comp_err_op(*combined_nu_comp_err_targ));
312 AbstractLinAlgPack::value_type
320 const int num_vecs = 3;
322 vecs[num_vecs] = {&v, &xl, &x};
324 combined_nu_comp_err_lower_op, num_vecs, vecs, 0, NULL
325 ,&*combined_nu_comp_err_lower_targ
327 return RTOp_ROp_combined_nu_comp_err_one_only_val(combined_nu_comp_err_lower_op(*combined_nu_comp_err_lower_targ));
331 AbstractLinAlgPack::value_type
339 const int num_vecs = 3;
341 vecs[num_vecs] = {&v, &xu, &x};
343 combined_nu_comp_err_upper_op, num_vecs, vecs, 0, NULL
344 ,&*combined_nu_comp_err_upper_targ
346 return RTOp_ROp_combined_nu_comp_err_one_only_val(combined_nu_comp_err_upper_op(*combined_nu_comp_err_upper_targ));
349 AbstractLinAlgPack::value_type
352 ,
const value_type inf_bound
362 const int num_vecs = 5;
364 vecs[num_vecs] = {&x, &xl, &xu, &vl, &vu};
366 comp_err_with_mu_op, num_vecs, vecs, 0, NULL
367 ,&*comp_err_with_mu_targ
369 return RTOp_ROp_comp_err_with_mu_val(comp_err_with_mu_op(*comp_err_with_mu_targ));
376 ,AbstractLinAlgPack::size_type *max_viol_i
377 ,AbstractLinAlgPack::value_type *max_viol
378 ,AbstractLinAlgPack::value_type *v_i
380 ,AbstractLinAlgPack::value_type *vLU_i
386 const int num_vecs = 3;
388 vecs[num_vecs] = { &v, &vL, &vU };
390 op, num_vecs, vecs, 0, NULL
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;
398 *bnd_type = ro.bnd_type;
400 return *max_viol_i > 0.0;
411 const Vector* vecs[2] = { &xl, &xu };
413 apply_op(force_in_bounds_op,2,vecs,1,targ_vecs,NULL);
418 const value_type rel_push,
419 const value_type abs_push,
426 const Vector* vecs[2] = { &xl, &xu };
428 apply_op(force_in_bounds_buffer_op,2,vecs,1,targ_vecs,NULL);
433 const value_type alpha
440 const Vector* vecs[2] = { &v0, &v1 };
442 apply_op(inv_of_difference_op,2,vecs,1,targ_vecs,NULL);
447 ,
const value_type inf_bound_limit
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 };
454 apply_op(correct_lower_bound_multipliers_op,1,vecs,1,targ_vecs,NULL);
459 ,
const value_type inf_bound_limit
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 };
466 apply_op(correct_upper_bound_multipliers_op,1,vecs,1,targ_vecs,NULL);
478 const Vector* vecs[] = { &invXl, &vl, &d_k };
480 apply_op(lowerbound_multipliers_step_op,3,vecs,1,targ_vecs,NULL);
492 const Vector* vecs[] = { &invXu, &vu, &d_k };
494 apply_op(upperbound_multipliers_step_op,3,vecs,1,targ_vecs,NULL);
502 apply_op(ele_wise_sqrt_op,0,NULL,1,targ_vecs,NULL);
513 apply_op(op,0,NULL,1,targ_vecs,NULL);
524 apply_op(op,0,NULL,1,targ_vecs,NULL);
void max_vec_scalar(value_type min_ele, VectorMutable *y)
Take the maximum value of the vector elements and a scalar.
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
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.
#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.
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.
value_type max_rel_step(const Vector &x, const Vector &d)
Computes the maximum relative step of x = x + d.
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.
void reduct_obj_reinit(const Ptr< ReductTarget > &reduct_obj) const
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. ...
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)
Teuchos::RCP< ReductTarget > reduct_obj_create() const
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:
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 force_in_bounds(const Vector &xl, const Vector &xu, VectorMutable *x)
Force a vector in bounds.
void correct_lower_bound_multipliers(const Vector &xl, const value_type inf_bound_limit, VectorMutable *vl)
Corrects the lower bound multipliers with infinite bounds.
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.
void correct_upper_bound_multipliers(const Vector &xu, const value_type inf_bound_limit, VectorMutable *vu)
Corrects the upper bound multipliers with infinite bounds.
#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.
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.