protected void HandleGotFocus(object sender, EventArgs e) { TabItem ti = sender as TabItem; string hdr = ti.Header.ToString(); ViewModel.SelectedTab = hdr; // Need to figure this out int accountnum = -1; if (hdr != "Accounts") { accountnum = GetAcctNum(hdr); } if (accountnum != -1) { AccountResultsViewModel ar = ViewModel.AccountResultsList[accountnum]; lbErrors[accountnum].Items.Clear(); for (int i = 0; i < ar.AccountProblemsList.Count; i++) { ProblemInfo problemInfo = ar.AccountProblemsList[i]; if (problemInfo != null) { ListBoxItem item = new ListBoxItem(); // hack for now -- will do it right with binding later item.Content = problemInfo.FormattedMsg; lbErrors[accountnum].Items.Add(item); } } } }
/// <summary> /// Select Problems tab page and open a specific problem description /// </summary> /// <param name="pnum">Problem Number</param> public static void ShowProblem(long pnum) { try { if (!LocalDatabase.HasProblem(pnum)) { return; } problems.BeginInvoke((MethodInvoker) delegate { ProblemInfo pinfo = LocalDatabase.GetProblem(pnum); problems.ShowAllProblems(); problems.problemListView.SelectedObject = pinfo; problems.problemListView.EnsureVisible(problems.problemListView.SelectedIndex); }); mainForm.BeginInvoke((MethodInvoker) delegate { mainForm.customTabControl1.SelectedTab = mainForm.problemTab; mainForm.BringToFront(); }); } catch (System.Exception ex) { Logger.Add(ex.Message, "Interactivity|ShowProblem()"); } }
public void ClearAll() { current = null; titleBox1.Text = "No problem selected"; problemMessage.Text = (string)problemMessage.Tag; //problemWebBrowser.GoHome(); }
public Individual(ProblemInfo inf) { info = inf; fitness = 0f; problem = new BrachystochroneProblem(info); trackPoints = new Dictionary <float, float> (); }
private static void LoadList(List <List <object> > datalist) { //Load problem from list foreach (List <object> lst in datalist) { ProblemInfo plist = new ProblemInfo(lst); problem_list.Add(plist); SetProblem(plist.pnum, plist); SetNumber(plist.pid, plist.pnum); //add problem to volume string vol = string.Format("Volume {0:000}", plist.volume); category_root[VolRoot][vol].AddProblem(plist, false); } //load book categories string file = LocalDirectory.GetCategoryPath(); string data = File.ReadAllText(file); List <ContextBook> catlist = JsonConvert.DeserializeObject <List <ContextBook> >(data); foreach (ContextBook book in catlist) { book.Process(); } }
// Use this for initialization void Start() { info = new ProblemInfo(); info.startPointX = startPointX; info.startPointY = startPointY; info.endPointX = endPointX; info.endPointY = endPointY; info.g = g; info.startVelocity = startVelocity; info.numTrackPoints = numTrackPoints; if (selecao == 0) { selection = new RandomSelection(); } if (selecao == 1) { selection = new SelecaoTorneio(tamTorneio); } stats = new StatisticsLogger(statsFilename); drawer = new PolygonGenerator(); InitPopulation(); evaluatedIndividuals = 0; currentGeneration = 0; evolving = true; drawing = false; }
public ExampleIndividual(ProblemInfo info) : base(info) { MinX = info.startPointX; MaxX = info.endPointX; MaxY = info.startPointY > info.endPointY ? info.startPointY : info.endPointY; MinY = MaxY - 2 * (Mathf.Abs(info.startPointY - info.endPointY)); }
private ProblemContainer CreateRandomProblem() { Level currentLevel = Gp.Blocks[Gp.N]; int randomIndex = _randome.Next(0, currentLevel.Count); ProblemInfo problemInfo = currentLevel[randomIndex]; return(ProblemFactoryInstance.CreateProblem(problemInfo)); }
public NovoIndividuo(ProblemInfo info, int ptsCorte) : base(info) { MinX = info.startPointX; MaxX = info.endPointX; MaxY = info.startPointY > info.endPointY ? info.startPointY : info.endPointY; MinY = MaxY - 2 * (Mathf.Abs(info.startPointY - info.endPointY)); numPontosCorte = ptsCorte; }
public IActionResult Create([Bind] ProblemInfo objPro) { if (ModelState.IsValid) { problemDAL.AddProblem(objPro); return(RedirectToAction("Index")); } return(View(objPro)); }
public void Delete(int ProblemID) { ProblemInfo pi = problems.FirstOrDefault(p => p.ProblemID == ProblemID); if (pi != null) { problems.Remove(pi); } }
static double[][] TimeProblem(ProblemInfo info, IMatrix A, double[] b) { ISolver solver = new LOSLU(); LSlaeBuilder tsb = new LSlaeBuilder(info); double[] t = info.TimeMesh; double[][] Q = new double[info.TimeMesh.Length][]; Q[0] = new double[A.N]; for (int i = 0; i < A.N; i++) { Q[0][i] = 25.0; } tsb.Layer = new TwoLayer(); tsb.Layer.SetQ(new double[1][] { Q[0] }); tsb.Layer.SetT(new double[] { t[0], t[1] }); tsb.CurrentT = info.TimeMesh[1]; tsb.Build(A, b); Q[1] = solver.Solve(A, b); ClearMatrix(A, b); tsb.Layer = new ThreeLayer(); tsb.Layer.SetQ(new double[2][] { Q[0], Q[1] }); tsb.Layer.SetT(new double[3] { t[0], t[1], t[2] }); tsb.CurrentT = t[2]; tsb.Build(A, b); Q[2] = solver.Solve(A, b); ClearMatrix(A, b); tsb.Layer = new FourLayer(); tsb.Layer.SetQ(new double[3][] { Q[0], Q[1], Q[2] }); tsb.Layer.SetT(new double[4] { t[0], t[1], t[2], t[3] }); tsb.CurrentT = t[3]; tsb.Build(A, b); Q[3] = solver.Solve(A, b); ClearMatrix(A, b); for (int i = 4; i < info.TimeMesh.Length; i++) { tsb.Layer.SetQ(new double[3][] { Q[i - 3], Q[i - 2], Q[i - 1] }); tsb.Layer.SetT(new double[4] { t[i - 3], t[i - 2], t[i - 1], t[i] }); tsb.CurrentT = t[i]; tsb.Build(A, b); Q[i] = solver.Solve(A, b); Console.WriteLine($"Невязка = {solver.Difference:E4}"); ClearMatrix(A, b); } return(Q); }
public PortraitBuilder(ProblemInfo info) { this.info = info; nodeCount = info.Mesh.NodeCount; connections = new SortedSet<int>[nodeCount]; for (int i = 0; i < nodeCount; i++) connections[i] = new SortedSet<int>(); BuildConnections(info.Mesh); }
static void Problem(ProblemInfo info, IMatrix A, double[] b) { LSlaeBuilder builder = new LSlaeBuilder(info); builder.Build(A, b); ISolver solver = new LOSLU(); double[] q = solver.Solve(A, b); }
private void nextButton_Click(object sender, EventArgs e) { if (current != null) { previous.Push(current); backButton.Enabled = true; } current = next.Pop(); nextButton.Enabled = (next.Count > 0); ShowCurrent(); }
public IActionResult Edit(int?id, [Bind] ProblemInfo objPro) { if (id == null) { return(NotFound()); } if (ModelState.IsValid) { problemDAL.AddProblem(objPro); return(RedirectToAction("Index")); } return(View(problemDAL)); }
public Functional(ProblemInfo info) { receivers = info.Receivers; n = info.Receivers.Length; K = info.P.Length; xCellCount = info.X.Length - 1; zCellCount = info.Z.Length - 1; alpha = info.Alpha; gamma = info.Gamma; g = new double[n]; realG = info.realG; calc = new GravityCalculator(info.X, info.Z, null); }
private void LoadInfosFromFiles() { infoDirectory = "c:\\tempSeqex\\" + txtAssemblyName.Text + "\\"; assemblyName = txtAssemblyName.Text; objectCreationProblemFileName = infoDirectory + assemblyName + ".object.bin"; notCoveredBranchFileName = infoDirectory + assemblyName + ".assembly.bin"; insufficientObjectFactoryFieldInfoFileName = infoDirectory + assemblyName + ".insufficientFields.bin"; insufficientFieldInfoWithBranchInfoFileName = infoDirectory + assemblyName + ".insufficientFields.branch.bin"; resultTrackingInfoFileName = infoDirectory + assemblyName + ".resultTrack.bin"; candidateObjectCreationProblemFileName = infoDirectory + assemblyName + ".candidateObjectCreationIssue.bin"; uninstrumentedMethodProblemFileName = infoDirectory + assemblyName + ".uninstrumented.bin"; foundUninstrumentedInObjectCreationFileName = infoDirectory + assemblyName + ".uninstrumentObj.bin"; exceptionExternalMethodsFileName = infoDirectory + assemblyName + ".exceptionExternalMethods.bin"; foundObjectTypeFileName = infoDirectory + assemblyName + ".foundObjectType.bin"; insufficientObjectFactoryFieldInfo = (InsufficientObjectFactoryFieldInfo) LoadInfoFromFile(insufficientObjectFactoryFieldInfo, insufficientObjectFactoryFieldInfoFileName); _problemInfo = (ProblemInfo) LoadInfoFromFile(_problemInfo, objectCreationProblemFileName); _nonCoveredBranchInfo = (NonCoveredBranchInfo) LoadInfoFromFile(_nonCoveredBranchInfo, notCoveredBranchFileName); insufficientFieldInfoWithBranchInfo = (InsufficientFieldInfoWithBranchInfo) LoadInfoFromFile(insufficientObjectFactoryFieldInfo, insufficientFieldInfoWithBranchInfoFileName); resultTrackingInfo = (ResultTrackingInfo) LoadInfoFromFile(resultTrackingInfo, resultTrackingInfoFileName); unInstrumentedMethodNames = (List<string>) LoadInfoFromFile(unInstrumentedMethodNames, uninstrumentedMethodProblemFileName); _candidateObjectCreationProblems = (HashSet<CandidateObjectCreationProblem>) LoadInfoFromFile(_candidateObjectCreationProblems, candidateObjectCreationProblemFileName); uninstrumentedMethodsFoundInObj = (Dictionary<string, HashSet<BranchInfo>>) LoadInfoFromFile(uninstrumentedMethodsFoundInObj, foundUninstrumentedInObjectCreationFileName); ExceptionExternalMethods = (HashSet<ExceptionExternalMethod>) LoadInfoFromFile(ExceptionExternalMethods, exceptionExternalMethodsFileName); FoundTypes = (HashSet<string>) LoadInfoFromFile(FoundTypes, foundObjectTypeFileName); if (FoundTypes != null && FoundTypes.Contains("System.Object")) { FoundTypes.Remove("System.Object"); } }
public IActionResult Delect(int?id) { if (id == null) { return(NotFound()); } ProblemInfo pro = problemDAL.GetProblemById(id); if (pro == null) { return(NotFound()); } return(View(pro)); }
public SlaeBuilder(ProblemInfo info) { this.info = info; points = info.Mesh.Points; local = new double[info.Basis.Size, info.Basis.Size]; localb = new double[info.Basis.Size]; psi = info.Basis.GetFuncs(); psiDers = info.Basis.GetDers(); boundaryPsi = info.BoundaryBasis.GetFuncs(); }
public CategoryChange(ProblemInfo pinfo) { InitializeComponent(); this.problem = pinfo; if (pinfo == null) { this.DialogResult = System.Windows.Forms.DialogResult.Abort; this.Close(); return; } LoadAllCategory(); nativeTreeView1.PathSeparator = CategoryNode.SEPARATOR.ToString(); }
/// <summary> Save problem info for given problem number </summary> public static void SetProblem(long pnum, ProblemInfo plist) { if (problemNum == null) { return; } if (HasProblem(pnum)) { problemNum[pnum] = plist; } else { problemNum.Add(pnum, plist); } }
public void Add(ProblemInfo PI) { ProblemInfo pi = problems.FirstOrDefault(p => p.ProblemID == PI.ProblemID); if (pi == null) { problems.Add(PI); } else { pi.IsCorrect = PI.IsCorrect; pi.Info = PI.Info; pi.LastModifiedTime = PI.LastModifiedTime; } }
void loadData(ProblemInfo pinfo) { titleLabel.Text = string.Format(title, pinfo.pnum, pinfo.ptitle); int num = 1; string data = head; foreach (var node in pinfo.categories) { string path = getPath(node).Replace(Environment.NewLine, @"\par\n\pard "); data += string.Format(catpath, path, num++); data += string.Format(probnote, node.GetCategoryNote(pinfo.pnum)); } data += tail; richTextBox1.Rtf = data; }
private static void LoadList(List <List <object> > datalist) { SortedDictionary <int, List <ProblemInfo> > catData = new SortedDictionary <int, List <ProblemInfo> >(); //Load problem from list foreach (List <object> lst in datalist) { ProblemInfo plist = new ProblemInfo(lst); problemList.Add(plist); //set the file size string file = LocalDirectory.GetProblemHtml(plist.pnum); if (File.Exists(file)) { plist.FileSize = (new System.IO.FileInfo(file)).Length; } SetProblem(plist.pnum, plist); SetNumber(plist.pid, plist.pnum); //Categorize if (!catData.ContainsKey(plist.Volume)) { catData.Add(plist.Volume, new List <ProblemInfo>()); } catData[plist.Volume].Add(plist); } //add volume category var volCat = new CategoryNode("Volumes", "Problem list by volumes"); categoryRoot.branches.Add(volCat); foreach (var data in catData.Values) { string vol = string.Format("Volume {0:000}", data[0].Volume); var nod = new CategoryNode(vol, "", volCat); volCat.branches.Add(nod); foreach (var p in data) { nod.problems.Add(new CategoryProblem(p.pnum)); } } volCat.ProcessData(); }
/// <summary> /// Send non-existing and updated problems to tester /// </summary> public void SendNewProblems() { ThreadPool.QueueUserWorkItem(s => { IRepository repository = _kernel.Get <IRepository>(); _logger.Info("Sending new problems"); _logger.Debug("Wait for canSendRequest"); _canSendRequest.Wait(); _canSendRequest.Reset(); _logger.Debug("SendRequestForReceivingProblem"); SendRequestForReceivingProblem(); _logger.Debug("Wait for clientReadyForReceivingProblem"); _clientReadyForReceivingProblem.WaitOne(); repository.Problems.Each(p => { try { ProblemInfo problemInfo = Problems.FirstOrDefault(pi => pi.ProblemID == p.ProblemID); if (problemInfo == null || DateTime.Compare( problemInfo.LastModifiedTime.Truncate(TimeSpan.FromSeconds(1)), p.LastModifiedTime.Truncate(TimeSpan.FromSeconds(1))) < 0) { SendProblemFile(p.ProblemID); _clientReceivedProblem.WaitOne(); } } catch (Exception ex) { _logger.Error("Error occurred on problem " + p.ProblemID + " sending: ", ex); } }); _logger.Debug("SendRequestForEndOfReceivingProblem"); SendRequestForEndOfReceivingProblem(); _logger.Debug("canSendRequest"); _canSendRequest.Set(); _logger.Debug("SendRequestForProblemsInfo"); SendRequestForProblemsInfo(); }); }
public void drawCurve(Dictionary <float, float> trackpoints, ProblemInfo info) { vertices2D = new Vector2[trackpoints.Count * 2]; startposition = new Vector2(info.startPointX, info.startPointY); int index = 0; foreach (float key in trackpoints.Keys) { vertices2D[index++] = new Vector2(key, trackpoints[key]); } //in order for the mesh to have thickness index = vertices2D.Length - 1; foreach (float key in trackpoints.Keys) { vertices2D[index--] = new Vector2(key, trackpoints[key] - 0.2f); } Triangulator tr = new Triangulator(vertices2D); int[] indices = tr.Triangulate(); Vector3[] vertices = new Vector3[vertices2D.Length]; for (int i = 0; i < vertices.Length; i++) { vertices[i] = new Vector3(vertices2D[i].x, vertices2D[i].y, 0); } Mesh msh = new Mesh(); msh.vertices = vertices; msh.triangles = indices; msh.RecalculateNormals(); msh.RecalculateBounds(); GameObject curve = new GameObject(); Renderer rend = curve.AddComponent(typeof(MeshRenderer)) as Renderer; MeshFilter filter = curve.AddComponent(typeof(MeshFilter)) as MeshFilter; filter.mesh = msh; rend.material.SetColor("_Color", Color.black); curve.AddComponent(typeof(MeshCollider)); }
//problem list context menus private void problemContextMenu_Opening(object sender, CancelEventArgs e) { bool marked = false; if (problemListView.SelectedObject != null) { ProblemInfo pinfo = (ProblemInfo)problemListView.SelectedObject; marked = pinfo.Marked; } if (marked) { markAsFavorite.Text = "Remove From Favorite"; } else { markAsFavorite.Text = "Mark As Favorite"; } }
public static ProblemInfo SerializeProblem(ProblemContainer problem) { ProblemInfo problemInfo = ScriptableObject.CreateInstance <ProblemInfo>(); List <BlockInfo> listOfBlockInfos = new List <BlockInfo>(); for (int i = 0; i < problem.transform.childCount; i++) { BlockInfo bi = BlockInfo.InfoOfBlock(problem.transform.GetChild(i).gameObject); listOfBlockInfos.Add(bi); } listOfBlockInfos.Sort((el1, el2) => el1.Position.x.CompareTo(el2.Position.x)); problemInfo.ProblemBlocks = listOfBlockInfos.ToArray(); string folderName = @"Assets/Problems/"; AssetDatabase.CreateAsset(problemInfo, folderName + problem.gameObject.name + ".asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = problemInfo; return(problemInfo); }
// Use this for initialization void Start() { info = new ProblemInfo(); info.startPointX = startPointX; info.startPointY = startPointY; info.endPointX = endPointX; info.endPointY = endPointY; info.g = g; info.startVelocity = startVelocity; info.numTrackPoints = numTrackPoints; info.numberOfCrossoverPoints = numberOfCrossoverPoints; tournamentSelection = new TournamentSelection(); //change accordingly stats = new StatisticsLogger(statsFilename); drawer = new PolygonGenerator(); InitPopulation(); evaluatedIndividuals = 0; currentGeneration = 0; evolving = true; drawing = false; }