예제 #1
0
파일: guioption.cpp 프로젝트: fanqsh/vdrift
void GUIOPTION::SetValues(const std::string & curvalue, const LIST & newvalues)
{
	m_values = newvalues;

	std::stringstream s;
	s << m_values.size();
	signal_update(s.str());

	SetCurrentValue(curvalue);
}
예제 #2
0
void GuiOption::SetValues(const std::string & curvalue, const List & newvalues)
{
	m_values = newvalues;

	std::ostringstream s;
	s << m_values.size();
	signal_update(s.str());

	SetCurrentValue(curvalue);
}
예제 #3
0
void CUITrackBar::Undo()
{
	if(m_b_is_float)
		m_f_val			= m_f_back_up;
	else
		m_i_val			= m_i_back_up;

	SaveValue			();
	SetCurrentValue		();
}
short int ParameterUpdater::MCMC_Step(curr_par_obj* current_values, mach_dat_obj* data, global_par_obj* global_pars, int iteration_id, int print_step )
{
  double mcmc_ratio;
  double logalpha;
  is_accepted = 0;
  int i;
  PRINT_MCMC_STEP=print_step;
  if(PRINT_MCMC_STEP)
    {
      if(iteration_id >= 0)
	cout << iteration_id << " ";
      cout << par_name;
    }
  SetCurrentValue(current_values, global_pars);
  Propose(current_values, data, global_pars);
  if(PRINT_MCMC_STEP)
    {
      cout << ": current = " << current_value[0] << ", proposed = " << proposal_value[0] << " ";
    }
  if(proposal_value[0] != current_value[0])
    {
      mcmc_ratio = Logposterior(proposal_value[0], current_values, data, global_pars) 
	- Logposterior(current_value[0], current_values, data, global_pars)
	+ Logjump(current_value[0], proposal_value[0], current_values, data, global_pars) 
	- Logjump(proposal_value[0], current_value[0], current_values, data, global_pars);
      
      distributions->Simulate(3, 1, &logalpha, 0.0, 1.0);
      if(PRINT_MCMC_STEP)
	{
	  cout << " ratio = " << mcmc_ratio << ", logalpha = " << log(logalpha);
	}
      if(log(logalpha) < mcmc_ratio)
	{
	  is_accepted += 1;
	  SetCurrentProposed(current_values, global_pars);
	  if(PRINT_MCMC_STEP)
	    cout << " accepted " << endl;
	}
      else
	{
	  if(PRINT_MCMC_STEP)
	    cout << " rejected " << endl;
	}      
    }
  else
    {
      if(PRINT_MCMC_STEP)
	{
	  cout << " no move " << endl;
	}
    }
  
  return(is_accepted);
}
void ScrollBar::HandleMouseMovement(Sint32 x, Sint32 y, bool insideOverlay) {
	Arrow1.HandleMouseMovement(x,y,insideOverlay);
	Arrow2.HandleMouseMovement(x,y - GetSize().y + Arrow2.GetSize().y,insideOverlay);

	if(bDragSlider) {
		int SliderAreaHeight = GetSize().y - Arrow1.GetSize().y - Arrow2.GetSize().y;
		int Range = (MaxValue - MinValue + 1);

		double OneTickHeight = ((double)(SliderAreaHeight - SliderButton.GetSize().y)) / ((double) (Range-1));

		SetCurrentValue((int) ((y - dragPositionFromSliderTop - Arrow1.GetSize().y) / OneTickHeight));
	}
}
void RhoUpdater::Propose(curr_par_obj* current_values, mach_dat_obj* data, global_par_obj* global_pars)
{
  if(PRINT_MCMC_STEP)
    {
      cout << "_" << data->uid;
    }

  SetCurrentValue(current_values, global_pars);
  proposal_value[0] = trunc_norm_proposal(current_value[0], 
				       proposal_sd, 
				       BETA_MIN, 
				       BETA_MAX,
				       distributions);
}
void OffLambdaUpdater::Propose(curr_par_obj* current_values, mach_dat_obj* data, global_par_obj* global_pars)
{   
  double kappa, theta;
  kappa = hyperpar[0];
  theta = hyperpar[1];
  if(PRINT_MCMC_STEP)
    {
      cout << "_" << data->uid;
    }
  SetCurrentValue(current_values, global_pars);

  distributions->Simulate(4,1,proposal_value,(double)(current_values->NumOffOffTrans())+kappa,(double)1.0/(((double)(current_values->NumOffSeq()))+ (1.0/theta) ));
      // if( (proposal_value[0] < hyperpar[0]) || (proposal_value[0] > hyperpar[1]))
      //proposal_value[0] = current_value[0];
 
}
void NuUpdater::Propose(curr_par_obj* current_values, mach_dat_obj* data, global_par_obj* global_pars)
{
  double l, u;
  l = hyperpar[0];
  u = hyperpar[1];
  if(PRINT_MCMC_STEP)
    {
      cout << "_" << data->uid;
    }

  SetCurrentValue(current_values, global_pars);
  proposal_value[0] = trunc_norm_proposal(current_value[0], 
				       proposal_sd, 
				       l, 
				       u,
				       distributions);
}
void ParameterUpdater::SetValidStartValue(curr_par_obj* current_values, global_par_obj* global_pars)
{
  int i;
  if(!(l_is_inf && u_is_inf))
    {
      SetCurrentValue(current_values, global_pars);
      for(i = 0; i < dim; i++)
	{
	  proposal_value[i] = current_value[i];
	  if(!(l_is_inf))
	    {
	      if(current_value[i] < lb)
		proposal_value[i] = lb + BETA_MIN;		
	    }
	  if(!(u_is_inf))
	    {
	      if(current_value[i] > ub)
		proposal_value[i] = ub - BETA_MIN;
	    }	  
	}
      SetCurrentProposed(current_values, global_pars);
    }
}
void CPlayerApplicationSettings::ConstructL(TUint aAttributeID,
		TDesC8& 						aAttributeText,
		const RArray<TUint>& 			aValues,
		RArray<TPtrC8>&					aValueText,
		TUint 							aInitialValue )
	{
	iAttributeID = aAttributeID;

	// copy the attribute description	
	iAttributeText = aAttributeText.AllocL();

	// copy the allowed values
	for (TInt i=0; i < aValues.Count(); i++ )
		{
		
		// avoid duplicated defined values
		if (iValues.Find(aValues[i]) != KErrNotFound)
			{
			User::Leave(KErrArgument);
			}

		iValues.AppendL( aValues[i] );
		
		// copy the value description into a HBuf and add pointer to iValueTexts
		HBufC8 * valueText = aValueText[i].AllocL();
		CleanupStack::PushL(valueText);
		iValueText.AppendL(valueText);
		CleanupStack::Pop(valueText);
		}
		
	TInt error = SetCurrentValue( aInitialValue );
	if ( error != KErrNone )
		{	
		User::Leave( error );
		}
	}
void ScrollBar::SetNumRows ( int newValue )
{
    m_numRows = newValue;
    SetCurrentValue( m_currentValue );
    EclDirtyWindow( m_parentWindow );
}
void ScrollBar::ChangeCurrentValue( int newValue )
{
    SetCurrentValue( m_currentValue + newValue );
}
void ScrollBar::SetWinSize ( int newValue )
{
    m_winSize = newValue;
    SetCurrentValue( m_currentValue );
    EclDirtyWindow( m_parentWindow );
}
double NuUpdater::GraphLogLikelihood(curr_par_obj* current_values, global_par_obj* global_pars)
{
  SetCurrentValue(current_values, global_pars);
  return(Logprior(current_value[0]));
}
예제 #15
0
void pawsProgressBar::OnUpdateData(const char* /*dataname*/, PAWSData &value)
{
    SetCurrentValue(value.GetFloat());
}
예제 #16
0
void pawsScrollBar::OnUpdateData(const char* /*dataname*/, PAWSData &value)
{
    SetCurrentValue(value.GetFloat(), true, false);
}
예제 #17
0
void clGUISlider::Event_Timer( iGUIResponder* Source, float DeltaTime )
{
	if ( GetConsoleVariable() ) { SetCurrentValue( GetConsoleVariable()->GetFloat() ); }

	clGUIPanel::Event_Timer( Source, DeltaTime );
}
예제 #18
0
void clGUIGauge::Increment( int Delta )
{
	SetCurrentValue( GetCurrentValue() + Delta );
}