/// <summary> /// エージェントの動作制御 /// </summary> /// <param name="experimentManager"></param> void ControlMovement(ExperimentManager experimentManager) { //VisualPhysical_: カーソル側のCD比を操作しない条件 if (experimentManager.expCondition == ExperimentManager.ExpCondition.VisualPhysical_) { //コントローラとエージェントの位置・回転を同期 this.transform.position += _transformVector; this.transform.rotation = controller.transform.rotation; } //Visual_, Physical_, Visual_Physical, Visual_Physical_: CD比を操作する条件 else { //ターゲット接触時にエージェント側の移動量を操作 if (!target._isInteract) { this.transform.position += _transformVector; } else if (target._isInteract && experimentManager.expCondition == ExperimentManager.ExpCondition.Visual_Physical_) { this.transform.position += _transformVector * (experimentManager.CDratio / 2); } else { this.transform.position += _transformVector * experimentManager.CDratio; } //回転はコントローラに同期 this.transform.rotation = controller.transform.rotation; } }
public void GraphStructureValidator_NoPathToEnd2() { IEditableExperiment experiment = ((IEditableExperiment)ExperimentManager.New()); experiment.ExperimentInfo.FilePath = "C:\\somefakelocation\\mockExperiment.teml"; ExperimentNode node1 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 5, 5); ExperimentNode node2 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 15, 15); ExperimentNode node3 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 25, 25); experiment.AddConnection(experiment.StartNode, node1); experiment.AddConnection(experiment.StartNode, node3); experiment.AddConnection(node1, node2); experiment.AddConnection(node2, experiment.EndNode); Assert.IsFalse(node1.HasError); Assert.IsFalse(node2.HasError); Assert.IsFalse(node3.HasError); RunnableNodeFactory templateGraphNodesFactory = new RunnableNodeFactory(AppContext.WorkspaceInstance); RunnableExperimentBase template = GraphAdapter.Adapt(experiment, templateGraphNodesFactory, AppContext.Components, AppContext.WorkspaceInstance.TypeDirectories); Assert.IsTrue(template.IsEmpty); Assert.IsTrue(node3.HasError); Assert.AreEqual(node3.ErrorMessage, "Unable to detect path to the END node."); }
void OnClientConnected(object sender, ConnectionEventArgs e) //if you are a server than, you handle clients { if (NetComp.IsServer()) { BroadCastExperimentStatusUpdate(ExperimentManager.Instance().GetExperimentStatus()); } }
private void Activated(object sender, EventArgs eargs) { Experiment experiment = ExperimentManager.New(); bool success = FileDialogs.NewExperimantDialog(m_applicationContext.MainWindow.WindowShell, ref experiment); if (success) { ApplicationViewModel newApplicationViewModel = ApplicationViewModel.CreateNewApplicationViewModel(m_applicationContext.Application, experiment); RecentExperimentsHelper.UpdateRecentExperimentList(TraceLab.Core.Settings.Settings.RecentExperimentsPath, experiment.ExperimentInfo.FilePath); m_applicationContext.OpenInWindow(newApplicationViewModel); String file = experiment.ExperimentInfo.FilePath; try { ExperimentManager.Save(experiment, file); } catch (System.IO.IOException e) { NLog.LogManager.GetCurrentClassLogger().Error(String.Format("Failed to Save File {0}. {1}", file, e.Message), e); FileDialogs.ShowSaveErrorDialog(m_applicationContext.MainWindow.WindowShell, "Failed to Save File", file); } catch (UnauthorizedAccessException e) { NLog.LogManager.GetCurrentClassLogger().Error(String.Format("Failed to Save File {0}. {1}", file, e.Message), e); FileDialogs.ShowSaveErrorDialog(m_applicationContext.MainWindow.WindowShell, "Failed to Save File", file); } catch (Exception e) { NLog.LogManager.GetCurrentClassLogger().ErrorException(String.Format("Failed to Save File {0}. {1}", file, e.Message), e); FileDialogs.ShowSaveErrorDialog(m_applicationContext.MainWindow.WindowShell, "Failed to Save File", file); } } }
public void AddCompositeComponent_Bug77() { // load the experiment to be exported string experimentFilename = System.IO.Path.Combine(AppContext.BaseTestDirectory, "experiment_to_test_bug77.gml"); Experiment experiment = ExperimentManager.Load(experimentFilename, AppContext.Components); experiment.Settings = AppContext.Settings; //create ExperimentViewModel for the experiment - the crash happen in the experiment view model, so it has to be initialized var experimentViewModel = new TraceLab.UI.WPF.ViewModels.ExperimentViewModel_Accessor(experiment); CompositeComponentMetadataDefinition compositeComponentDefinition = null; //find the composite component to test bug 77 foreach (MetadataDefinition definition in AppContext.Components.Components) { if (definition.Classname.Equals("Component to test bug 77")) { compositeComponentDefinition = definition as CompositeComponentMetadataDefinition; break; } } //check if definition has been found in library Assert.IsNotNull(compositeComponentDefinition); Assert.AreEqual(3, experiment.VertexCount); ExperimentNode node = ((IEditableExperiment)experiment).AddComponentFromDefinition(compositeComponentDefinition, -5, 5); Assert.IsNotNull(node); Assert.AreEqual(4, experiment.VertexCount); Assert.IsTrue(experiment.IsModified); }
void OnNetworkDataReceived(object sender, ReceivedNetworkDataEventArgs e) { NetworkData data = e.Data; switch (e.Type) { case ENetDataType.ExperimentState: { ExperimentState state = (ExperimentState)data; ExperimentManager.Instance().SetExperimentStatus(state.Status); break; } case ENetDataType.UserState: ExperimentManager.Instance().ReceivedUserStateUpdate((UserState)data); break; case ENetDataType.RandomState: ExperimentManager.Instance().ReceivedRandomStateUpdate((RandomState)data); break; case ENetDataType.ResponseState: ExperimentManager.Instance().ReceivedResponseStateUpdate((ResponseState)data); break; default: throw new ArgumentOutOfRangeException(); } }
public void PathUpdatedOnSaveExperiment() { IExperiment experiment = ExperimentManager.New(); Assert.IsNotNull(experiment); Assert.AreEqual(2, experiment.VertexCount); Assert.IsTrue(string.IsNullOrEmpty(experiment.ExperimentInfo.FilePath)); string filename = System.IO.Path.Combine(AppContext.BaseTestDirectory, "testSave.gml"); try { bool success = ExperimentManager.Save(experiment, filename); Assert.IsTrue(success); Assert.IsTrue(File.Exists(filename)); //did experiment info filepath got update on save Assert.AreEqual(experiment.ExperimentInfo.FilePath, filename); } finally { if (File.Exists(filename)) { //cleanup File.Delete(filename); } } }
public void OpenExperimentWithNonExistingCompositeComponentTest() { // load the experiment to be exported string experimentFilename = System.IO.Path.Combine(AppContext.BaseTestDirectory, "experiment_with_non_existing_composite_component_bug_75.gml"); Experiment experiment = ExperimentManager.Load(experimentFilename, AppContext.Components); experiment.Settings = AppContext.Settings; Assert.IsNotNull(experiment); Assert.AreEqual(3, experiment.VertexCount); //find the composite component node CompositeComponentNode compositeComponentNode = null; foreach (ExperimentNode node in experiment.Vertices) { compositeComponentNode = node as CompositeComponentNode; if (compositeComponentNode != null) { break; } } Assert.IsNotNull(compositeComponentNode); //if fails composite component node has not been found //once found check if it has error Assert.IsTrue(compositeComponentNode.HasError); //Also try to create ExperimentViewModel for the experiment. Assure that it does not crash var experimentViewModel = new TraceLab.UI.WPF.ViewModels.ExperimentViewModel_Accessor(experiment); }
public void RemoveConnection() { IExperiment experiment = ExperimentManager.New(); experiment.ExperimentInfo.FilePath = "C:\\somefakelocation\\mockExperiment.teml"; ComponentMetadataDefinition def1 = new ComponentMetadataDefinition(Guid.NewGuid().ToString(), System.IO.Path.Combine(AppContext.BaseTestDirectory, "Test.dll"), "IDontExist"); ExperimentNode node1 = ((IEditableExperiment)experiment).AddComponentFromDefinition(def1, -5, 5); ComponentMetadataDefinition def2 = new ComponentMetadataDefinition(Guid.NewGuid().ToString(), System.IO.Path.Combine(AppContext.BaseTestDirectory, "Test2.dll"), "IDontExistEither"); ExperimentNode node2 = ((IEditableExperiment)experiment).AddComponentFromDefinition(def2, -5, 5); Assert.AreEqual(0, experiment.EdgeCount); ExperimentNodeConnection newEdge = ((IEditableExperiment)experiment).AddConnection(node1, node2); Assert.IsNotNull(newEdge); Assert.AreEqual(1, experiment.EdgeCount); experiment.ResetModifiedFlag(); Assert.AreEqual(4, experiment.VertexCount); ((IEditableExperiment)experiment).RemoveConnection(newEdge); // Verify that the edge was existed and the number of vertices was unaffected. Assert.AreEqual(0, experiment.EdgeCount); Assert.AreEqual(4, experiment.VertexCount); Assert.IsTrue(experiment.IsModified); }
public void SaveExperimentTest() { IExperiment experiment = ExperimentManager.New(); Assert.IsNotNull(experiment); Assert.AreEqual(2, experiment.VertexCount); Assert.IsTrue(string.IsNullOrEmpty(experiment.ExperimentInfo.FilePath)); string filename = System.IO.Path.Combine(AppContext.BaseTestDirectory, "testSave.gml"); try { bool success = ExperimentManager.Save(experiment, filename); Assert.IsTrue(success); Assert.IsTrue(File.Exists(filename)); IExperiment loadedExperiment = ExperimentManager.Load(filename, AppContext.Components); Assert.AreEqual(experiment.ExperimentInfo, loadedExperiment.ExperimentInfo); } finally { if (File.Exists(filename)) { //cleanup File.Delete(filename); } } }
public void AddNewConnectionTwice() { IExperiment experiment = ExperimentManager.New(); experiment.ExperimentInfo.FilePath = "C:\\somefakelocation\\mockExperiment.teml"; ComponentMetadataDefinition def1 = new ComponentMetadataDefinition(Guid.NewGuid().ToString(), System.IO.Path.Combine(AppContext.BaseTestDirectory, "Test.dll"), "IDontExist"); ExperimentNode node1 = ((IEditableExperiment)experiment).AddComponentFromDefinition(def1, -5, 5); ComponentMetadataDefinition def2 = new ComponentMetadataDefinition(Guid.NewGuid().ToString(), System.IO.Path.Combine(AppContext.BaseTestDirectory, "Test2.dll"), "IDontExistEither"); ExperimentNode node2 = ((IEditableExperiment)experiment).AddComponentFromDefinition(def2, -5, 5); Assert.AreEqual(0, experiment.EdgeCount); ExperimentNodeConnection newEdge = ((IEditableExperiment)experiment).AddConnection(node1, node2); Assert.IsNotNull(newEdge); Assert.AreEqual(1, experiment.EdgeCount); //add the same connection once again ExperimentNodeConnection newEdge2 = ((IEditableExperiment)experiment).AddConnection(node1, node2); Assert.IsNotNull(newEdge2); Assert.AreEqual(newEdge, newEdge2); // the amount of edges should still be the same Assert.AreEqual(1, experiment.EdgeCount); }
public void AddNewComponentNullDefinition() { IExperiment experiment = ExperimentManager.New(); Assert.AreEqual(2, experiment.VertexCount); ExperimentNode node = ((IEditableExperiment)experiment).AddComponentFromDefinition(null, -5, 5); }
public void ExperimentClone() { IExperiment loadedExperiment = ExperimentManager.Load(ExperimentFile, AppContext.Components); ValidateData(loadedExperiment); Experiment clone = (Experiment)((BaseExperiment)loadedExperiment).Clone(); ValidateData(clone); Assert.IsFalse(clone.IsModified); Dictionary <string, ExperimentNode> clonedNodes = new Dictionary <string, ExperimentNode>(); foreach (ExperimentNode clonedNode in clone.Vertices) { clonedNodes[clonedNode.ID] = clonedNode; } // Ensure that none of the vertices from the source experiment are in the clone experiment. // This checks references, since obviously the clone is supposed to have nodes with the same ID. foreach (ExperimentNode node in loadedExperiment.Vertices) { ExperimentNode clonedNode = null; Assert.IsTrue(clonedNodes.TryGetValue(node.ID, out clonedNode)); Assert.IsFalse(object.ReferenceEquals(node, clonedNode)); Assert.IsFalse(object.ReferenceEquals(node.Data, clonedNode.Data)); Assert.IsFalse(object.ReferenceEquals(node.Data.Metadata, clonedNode.Data.Metadata)); } }
public void ValidateInputMapping_CorrectFlow_OutputFound2() { IEditableExperiment experiment = ((IEditableExperiment)ExperimentManager.New()); experiment.ExperimentInfo.FilePath = "C:\\somefakelocation\\mockExperiment.teml"; ExperimentNode readerNode = experiment.AddComponentFromDefinition(m_componentReaderMetaDefinition, 5, 5); ExperimentNode writerNode1 = experiment.AddComponentFromDefinition(m_componentWriterMetaDefinition, 15, 15); ExperimentNode writerNode2 = experiment.AddComponentFromDefinition(m_componentWriterMetaDefinition, 25, 25); experiment.AddConnection(experiment.StartNode, writerNode1); experiment.AddConnection(writerNode1, writerNode2); experiment.AddConnection(writerNode2, readerNode); experiment.AddConnection(readerNode, experiment.EndNode); (writerNode1.Data.Metadata as ComponentMetadata).IOSpec.Output["testoutput"].MappedTo = "test1"; (writerNode2.Data.Metadata as ComponentMetadata).IOSpec.Output["testoutput"].MappedTo = "test2"; (readerNode.Data.Metadata as ComponentMetadata).IOSpec.Input["testinput"].MappedTo = "test1"; RunnableNodeFactory templateGraphNodesFactory = new RunnableNodeFactory(AppContext.WorkspaceInstance); RunnableExperimentBase template = GraphAdapter.Adapt(experiment, templateGraphNodesFactory, AppContext.Components, AppContext.WorkspaceInstance.TypeDirectories); Assert.IsFalse(template.IsEmpty); Assert.IsFalse(readerNode.HasError); Assert.IsFalse(writerNode1.HasError); Assert.IsFalse(writerNode2.HasError); Assert.AreEqual(5, template.Nodes.Count); }
public void TestTemplateGraphDisposal_InValidNodes() { IEditableExperiment experiment = ((IEditableExperiment)ExperimentManager.New()); experiment.ExperimentInfo.FilePath = "C:\\somefakelocation\\mockExperiment.teml"; //construct some simple m_experiment ExperimentNode node1 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 5, 5); ExperimentNode node2 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 5, 5); ExperimentNode node3 = experiment.AddComponentFromDefinition(m_emptyComponentMetaDefinition, 5, 5); node1.Data.Metadata.Label = "Broken Component"; experiment.AddConnection(experiment.StartNode, node1); experiment.AddConnection(node1, node2); experiment.AddConnection(node2, node3); experiment.AddConnection(node3, experiment.EndNode); //initiate mockNodesFactory MockNodesFactory mockNodesFactory = new MockNodesFactory(); RunnableExperimentBase template = GraphAdapter.Adapt(experiment, mockNodesFactory, AppContext.Components, AppContext.WorkspaceInstance.TypeDirectories); //adaptation should have failed and graph should be empty because broken node construction failed Assert.IsTrue(template.IsEmpty); //but also all of the previously created nodes before reaching the broken node during adaptation should have been disposed. foreach (MockNode node in mockNodesFactory.CreatedNodes) { Assert.IsTrue(node.disposed); } }
//実験条件に応じてターゲットとルンバのふるまいを変更 void ChangeTargetStatus(ExperimentManager experimentManager) { switch (experimentManager.expCondition) { //Visual: スクリーン内のオブジェクトはCD比=1,ディスプレイは動かない case ExperimentManager.ExpCondition.Visual: break; //Visual_: スクリーン内のオブジェクトはCD比制御,ディスプレイは動かない case ExperimentManager.ExpCondition.Visual_: break; //Visual_Physical: スクリーン内オブジェクトはCD比制御,ディスプレイはCD比=1 case ExperimentManager.ExpCondition.Visual_Physical: MoveDisplay_staticCD(); break; //Visual_Physical_: オブジェクト,ディスプレイ共にCD比制御 case ExperimentManager.ExpCondition.Visual_Physical_: MoveDisplay_variableCD((int)(_inputSpeed * (_CDratio / 2))); break; //VisualPhysical_: スクリーン内のオブジェクトはCD比=1,ディスプレイはCD比制御 //Physical_: オブジェクトはスクリーン内で固定+ディスプレイはCD比制御 default: MoveDisplay_variableCD(_outputSpeed); break; } }
public CompareExperimentsViewModel(int id1, int id2, ExperimentDefinition def1, ExperimentDefinition def2, ExperimentManager manager, IUIService message) { if (manager == null) { throw new ArgumentNullException("manager"); } if (message == null) { throw new ArgumentNullException("message"); } this.manager = manager; this.uiService = message; this.id1 = id1; this.id2 = id2; this.checkIgnoreCategory = false; this.checkIgnorePostfix = false; this.checkIgnorePrefix = false; this.extension1 = "." + def1.BenchmarkFileExtension.Split('|')[0]; this.extension2 = "." + def2.BenchmarkFileExtension.Split('|')[0]; this.category1 = def1.Category; this.category2 = def2.Category; this.sharedDirectory1 = def1.BenchmarkDirectory; this.sharedDirectory2 = def2.BenchmarkDirectory; this.isFiltering = false; DownloadResultsAsync(); }
public override void Initialize() { AvaloniaXamlLoader.Load(this); /* Clean everything from the old run up */ if (PlatformUtils.IsWindows) { #if WindowsNoARM ThePBone.Interop.Win32.TrayIcon.ResourceLoader.ClearCache(); #endif } if (Loc.IsTranslatorModeEnabled()) { SettingsProvider.Instance.Locale = Locales.custom; } ThemeUtils.Reload(); Loc.Load(); MediaKeyRemoteImpl.Init(); DeviceMessageCache.Init(); UpdateManager.Init(); ExperimentManager.Init(); Log.Information($"Translator mode file location: {Loc.GetTranslatorModeFile()}"); ScriptManager.Instance.RegisterUserHooks(); }
private void ControlDisplayScreen(ExperimentManager experimentManager) { if (experimentManager.expCondition == ExperimentManager.ExpCondition.Physical_) { displayScreen.transform.position = target.transform.position; } }
public void DefineCompositeComponentBasicTestSelectSubraphWithNoEndAndStart() { // load the experiment to be exported string experimentFilename = System.IO.Path.Combine(AppContext.BaseTestDirectory, "experiment_define_composite_component_basic_test.teml"); Experiment experiment = ExperimentManager.Load(experimentFilename, AppContext.Components); experiment.Settings = AppContext.Settings; //assure that we apply global settings //select just one node foreach (ExperimentNode node in experiment.Vertices) { if (node.ID == TestImporterID) { node.IsSelected = true; } } DefiningCompositeComponentSetup setup = new DefiningCompositeComponentSetup(experiment); Assert.IsNotNull(setup); Assert.AreEqual(1, setup.InputSettings.Count); Assert.AreEqual(1, setup.OutputSettings.Count); Assert.AreEqual(0, setup.ConfigSettings.Count); Assert.IsTrue(setup.InputSettings["test1"].Include); Assert.IsTrue(setup.OutputSettings["test2"].Include); //rescan library to be sure it is fresh scan int numberOfComponentsInLibrary = GetCountOfComponentsInLibrary(); //let's export the experiment as composite component setup.CompositeComponentLocationFilePath = exportFile; Assert.IsFalse(File.Exists(exportFile)); setup.DefineComponent(); Assert.IsTrue(File.Exists(exportFile)); int updatedNumberOfComponents = GetCountOfComponentsInLibrary(); //after rescan there should be one more component in the library Assert.AreEqual(numberOfComponentsInLibrary + 1, updatedNumberOfComponents); //iterate through all components until find new composite component CompositeComponentMetadataDefinition compositeComponentDefinition = FindCompositeComponent(exportFile); //assure that composite component definition has been found Assert.IsNotNull(compositeComponentDefinition); //if fails, composite component has not been found Assert.AreEqual(setup.Name, compositeComponentDefinition.Label); Assert.AreEqual(setup.Description, compositeComponentDefinition.Description); Assert.AreEqual(setup.Author, compositeComponentDefinition.Author); Assert.IsNotNull(compositeComponentDefinition.ComponentGraph); //the number of configuration properties should be the same Assert.AreEqual(setup.ConfigSettings.Count, compositeComponentDefinition.ConfigurationWrapperDefinition.Properties.Count); Assert.AreEqual(1, compositeComponentDefinition.IOSpecDefinition.Input.Count); //one input was included Assert.AreEqual(1, compositeComponentDefinition.IOSpecDefinition.Output.Count); //one output was included }
private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); _startMarker = GameObject.Find("StartMarker"); _endMarker = GameObject.Find("EndMarker"); _poleLeft = GameObject.Find("PoleLeft"); _poleRight = GameObject.Find("PoleRight"); InitialiseUIDisplay(); UI.LoadInstructions(_fileInstructions); Parameters.LoadParameters(Parameters.ParametersFile); RandomiseAtoBRatiosForTrials(); InitialisePolePositions(); InitialiseCalibrationLines(); InitialiseStartAndEndMarkers(); _rightHandIndex = SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.Rightmost); _leftHandIndex = SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.Leftmost); UI.WriteLineToExperimenterScreen(); UI.WriteLineToExperimenterScreen("Press space to begin tracker calibration."); }
/// <summary> /// Extracts all assemblies containing the components and types used in the current experiment and passes /// them to the Package Builder. /// </summary> /// <param name="param">The Application View Model Wrapper.</param> private void PackExperimentFunc(object param) { bool isExperimentSaved = !this.CurrentView.IsModified; if (isExperimentSaved == false) { MessageBoxResult result = MessageBox.Show("To create a package, the experiment needs to be saved first.\nWould you like to proceed?", "Save modified experiment", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { try { isExperimentSaved = ExperimentManager.Save(this.CurrentView.GetExperiment(), this.CurrentView.ExperimentInfo.FilePath); } catch (Exception e) { isExperimentSaved = false; MessageBox.Show("Package building process interrupted. The following error ocurred:\n" + e.Message, "Error while saving experiment", MessageBoxButton.OK, MessageBoxImage.Error); } } } if (isExperimentSaved && param is ApplicationViewModelWrapper) { ApplicationViewModelWrapper AppVMWrapper = (ApplicationViewModelWrapper)param; Experiment originalExperiment = (Experiment)this.TopLevel; TraceLab.UI.WPF.Views.PackageBuilder.PackageBuilderMainWindow pkgBuilderWindow = new TraceLab.UI.WPF.Views.PackageBuilder.PackageBuilderMainWindow(originalExperiment, AppVMWrapper.WorkspaceViewModel.SupportedTypes); pkgBuilderWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; pkgBuilderWindow.ShowDialog(); } }
public void ScopeNestedWorkspaceWrapperTearDownTest() { MockProgress progress = new MockProgress(); Experiment experiment = ExperimentManager.Load("DecisionScopeTest.teml", AppContext.Components); using (var dispatcher = ExperimentRunnerHelper.CreateExperimentRunner(experiment, AppContext.WorkspaceInstance, AppContext.Components)) { dispatcher.ExecuteExperiment(progress); } Assert.AreEqual(2, AppContext.WorkspaceInstance.Units.Count); foreach (WorkspaceUnit unit in AppContext.WorkspaceInstance.Units) { bool isCorrect = false; if (unit.FriendlyUnitName.Equals("a") && (int)unit.Data == 1) { isCorrect = true; } else if (unit.FriendlyUnitName.Equals("b") && (int)unit.Data == 7) { isCorrect = true; } Assert.IsTrue(isCorrect); } }
public ShowResultsViewModel(ExperimentStatusViewModel st, string sharedDirectory, ExperimentManager manager, AzureExperimentManagerViewModel managerVm, ExperimentListViewModel experimentsVm, RecentValuesStorage recentValues, IUIService uiService) { if (manager == null) { throw new ArgumentNullException("manager"); } if (managerVm == null) { throw new ArgumentNullException(nameof(managerVm)); } if (uiService == null) { throw new ArgumentNullException("uiService"); } if (experimentsVm == null) { throw new ArgumentNullException(nameof(experimentsVm)); } this.manager = manager; this.managerVm = managerVm; this.experimentsVm = experimentsVm; this.uiService = uiService; this.statusVm = st; this.id = st.ID; this.sharedDirectory = sharedDirectory; this.benchmarkTimeout = st.Definition.BenchmarkTimeout; this.jobStatus = ExperimentExecutionStateVM.Loading; this.benchmarkContainerUri = st.Definition.BenchmarkContainerUri; this.recentValues = recentValues; RefreshResultsAsync(); }
// run public void RunTrial() { // initialization // reference to ExperimentManager experimentManagerObj = GameObject.Find("Experiment Manager"); experimentManager = experimentManagerObj.GetComponent <ExperimentManager>(); // reference to TiltManager tiltManagerObj = GameObject.Find("Tilt Manager"); tiltManager = tiltManagerObj.GetComponent <TiltManager>(); // prepare start area startAreaObj = (GameObject)Instantiate(startAreaPrefab, Vector3.zero, Quaternion.identity); startArea = startAreaObj.GetComponent <StartArea>(); startArea.SetStartAreaParameters(experimentalParameters); // 初期位置のサイズを設定・変更 // prepare target targetObj = (GameObject)Instantiate(targetPrefab, Vector3.zero, Quaternion.identity); target = targetObj.GetComponent <Target>(); target.Initialize(experimentalParameters); // 初期位置のサイズを設定・変更 // set cursor parameter in 1st trial if (experimentManager.iTrial == 1) { cursorObj = GameObject.Find("Cursor"); cursor = cursorObj.GetComponent <Cursor>(); cursor.SetCursorParameters(experimentalParameters); } // activate start area startAreaObj.SetActive(true); // next state state = stateStartAreaDisplayed; }
public void ScopeWithCompositeComponent_ScopeNestedWorkspaceWrapperTearDownTest() { MockProgress progress = new MockProgress(); string testExperimentFilepath = System.IO.Path.Combine(AppContext.BaseTestDirectory, "Decision Scope with composite component.teml"); Experiment experiment = ExperimentManager.Load(testExperimentFilepath, AppContext.Components); using (var dispatcher = ExperimentRunnerHelper.CreateExperimentRunner(experiment, AppContext.WorkspaceInstance, AppContext.Components)) { dispatcher.ExecuteExperiment(progress); } Assert.AreEqual(3, AppContext.WorkspaceInstance.Units.Count); HashSet <string> expectedUnitNames = new HashSet <string>(); expectedUnitNames.Add("targetArtifacts"); expectedUnitNames.Add("sourceArtifacts"); expectedUnitNames.Add("similarityMatrix"); foreach (WorkspaceUnit unit in AppContext.WorkspaceInstance.Units) { bool isCorrect = false; if (expectedUnitNames.Contains(unit.FriendlyUnitName)) { isCorrect = true; } Assert.IsTrue(isCorrect); } }
//-------------------------------------------------------------------------------------------------// protected void Application_Start(object sender, EventArgs e) { const string STRLOG_MethodName = "Application_Start"; // // Set the filepath for the log files // string rootFilePath = HostingEnvironment.ApplicationPhysicalPath; string logFilesPath = Utilities.GetAppSetting(Consts.STRCFG_LogFilesPath); Logfile.SetFilePath(Path.Combine(rootFilePath, logFilesPath)); Logfile.Write(""); Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName); // // Create the experiment manager // allowedServiceBrokers = new AllowedServiceBrokersDB(); configuration = new Library.LabServer.Configuration(rootFilePath); experimentManager = new ExperimentManager(allowedServiceBrokers, configuration); experimentManager.Create(); // // Now start the experiment manager // experimentManager.Start(); Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName); }
// Start is called before the first frame update void Start() { experimentManager = GameObject.Find("Manager").GetComponent <ExperimentManager>(); target = GameObject.Find("Target").GetComponent <Target>(); agent = GameObject.FindGameObjectWithTag("Agent").GetComponent <Agent>(); }
public async Task FindExperiments() { ExperimentDefinition def1 = ExperimentDefinition.Create("LinearEquationSolver.exe", ExperimentDefinition.LocalDiskContainerUri, "benchmarks_2", "csv", "{0} 1", TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(0), "default", category: "IdentitySquare"); ExperimentDefinition def2 = ExperimentDefinition.Create("LinearEquationSolver.exe", ExperimentDefinition.LocalDiskContainerUri, "benchmarks_2", "csv", "{0} 2", TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(0), "default", category: "IdentitySquare"); ExperimentManager manager = NewManager(); var e1 = await manager.StartExperiment(def1); var e2 = await manager.StartExperiment(def1); var e4 = await manager.StartExperiment(def2); var r1 = await Task.WhenAll(manager.GetResults(e1)); var r2 = await Task.WhenAll(manager.GetResults(e2)); var r4 = await Task.WhenAll(manager.GetResults(e4)); var loaded = (await manager.FindExperiments()).ToArray(); Assert.AreEqual(3, loaded.Length, "Number of found experiments (same manager)"); var manager2 = OpenManager(manager); var loaded2 = (await manager2.FindExperiments()).ToArray(); Assert.AreEqual(3, loaded2.Length, "Number of found experiments (reloaded)"); var loaded3 = (await manager2.FindExperiments(new ExperimentManager.ExperimentFilter { ParametersEquals = "{0} 2" })).ToArray(); Assert.AreEqual(1, loaded3.Length, "Number of found experiments (reloaded, filtered)"); }
/// <summary> /// エージェントの動作制御 /// </summary> /// <param name="experimentManager"></param> void ControlMovement(ExperimentManager experimentManager) { Vector3 TransformVector = Vector3.zero; //VisualPhysical_: CD比を操作しない条件 if (experimentManager.expCondition == ExperimentManager.ExpCondition.VisualPhysical_) { //コントローラとエージェントの位置・回転を同期 rb.position = controller.transform.position + offsetPos; rb.rotation = controller.transform.rotation; } //Visual_, Physical_, Visual_Physical, Visual_Physical_: CD比を操作する条件 else { //ターゲット接触時にエージェント側の移動量を操作 if (target._isInteract) { //CD比を反映した移動ベクトル TransformVector = viveController.GetMovingVector() * experimentManager.CDratio; rb.position += TransformVector; } else { rb.position += viveController.GetMovingVector(); } //回転はコントローラに同期 rb.rotation = controller.transform.rotation; } }
private void initializeExperimentManager() { this.experimentManager = new ExperimentManager(this); }
// Ensure that the instance is destroyed when the game is stopped in the editor. void OnApplicationQuit() { s_Instance = null; }
public static void ResetInstance() { s_Instance = null; }