当前位置: 首页>>代码示例>>C++>>正文


C++ state::get_vector方法代码示例

本文整理汇总了C++中state::get_vector方法的典型用法代码示例。如果您正苦于以下问题:C++ state::get_vector方法的具体用法?C++ state::get_vector怎么用?C++ state::get_vector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在state的用法示例。


在下文中一共展示了state::get_vector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: zero


//.........这里部分代码省略.........
			// The invariant constraint is violated.
			LOGGER_OS(DEBUG7,"state_jump_intervals_safe")
				<< "inv violated with " << xp << " > " << -inh_coeff;
			invariant_satisfied = false;
		} else if (!definitely(is_LT(xp, -inh_coeff))) {
			// The invariant constraint is on the border.
			// Check the derivative to see the whether the invariant function is increasing or decreasing.
			// The derivative is f(x). If a^Tf(x)>0, then the function is increasing, and so the invariant is atomic.
			scalar_type dxp = it->normal_eval(f.map(xinit));
			if (definitely(is_GT(dxp, scalar_type(0)))) {
				LOGGER_OS(DEBUG7,"state_jump_intervals_safe")
					<< "inv from below, so atomic " << "\n";
				invariant_atomic = true;
			}
			// Note: for now we don't check whether the derivative is zero,
			// which could cause problems with the solver
		}
	}
	// If the invariant is violated from the start, return an empty trajectory
	if (!invariant_satisfied) {
		LOGGER_OS(DEBUG7,"state_jump_intervals_safe")
			<< ("Inv false at beginning !!!\n");
		res.traj = trajectory(xinit.domain());
		res.ji = std::vector<interval_list>(gn);
		res.horizont_reached = false;
		return res;
	}

	if (invariant_atomic)
		LOGGER_OS(DEBUG7,"state_jump_intervals_safe")
			<< ("Inv atomic at beginning !!!\n");

	// We found our first point, let's add it to the result trajectory
	res.traj = trajectory(xinit.domain(), tinit, xinit.get_vector());
	res.ji = std::vector<interval_list>(gn);

	// currently sought roots
	// if z[i] < 0 then all constraints of inv/guard need to be evaluated
	// otherwise only the constraint with index z[i]
	std::vector<int> z(gn + 1);
	// for the guard i, the root function values of the constraints in the
	// interval [index_beg[i+1],index_end[i+1]-1] need to be verified
	// These indices correspond to the position in the output vector of
	// z_functor.
	int index_beg[gn + 1];
	int index_end[gn + 1];
	// all constraints of the invariant need to be tracked
	z[0] = -1;
	index_beg[0] = 0;
	index_end[0] = invariant.size();

	// analyze all of the guards on their status, and find which
	// constraints need to be evaluated
	for (int i = 0; i < gn; i++) {
		scalar_type max_val(0);
		bool guard_satisfied = true;
		bool guard_atomic = false;
		int position = 0;
		int pos_max = -1;
		int pos_atom = -1;

		// find out if the guard is satisfied, atomic, and the "farthest" constraint
		for (typename lin_constraint_system::const_iterator it =
				guards[i]->begin(); it != guards[i]->end(); ++it) {
			scalar_type xp = it->normal_eval(xinit);
			scalar_type inh_coeff = it->get_canonic_inh_coeff();
开发者ID:selyunin,项目名称:spcx-src,代码行数:67,代码来源:traj_simu.hpp


注:本文中的state::get_vector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。