/// <summary> /// Gets a score representing how likely a studio is to crunch based on how /// frequently they put out games. The more often they put out games, the more /// likely they are to crunch. However, it also accounts for employees. A studio /// putting out a game a year with 2000 staff is less likely to be crunching than /// the same for a studio with 20 staff. /// </summary> /// <returns>The crunch overtime score.</returns> /// <param name="years">The year values for release dates of all of a studio's games.</param> /// <param name="employeeCount">How many employees work at the studio.</param> public static float GetCrunchOvertimeScore(int[] years, int employeeCount) { //Log information if (Logger.VERBOSE) { Logger.Log("Finding crunch over time score."); } //This is to counteract a bug, where the games that haven't been released yet //are returned as '1's. List <float> yearsF = new List <float>(); for (int a = 0; a < years.Length; a++) { if (years[a].ToString().Length >= 4) { yearsF.Add(years[a]); } } //Create a list of x-values. Basically just an array of incrementing values //that matches in length to the years. float[] inputs = MathUtils.GenInputs(yearsF.Count); //When plotted, the years form an exponential graph when sorted. The steeper //it is, the less frequently they put out games. BestFit bf = MathUtils.ExpRegression(inputs, yearsF.ToArray()); ExponentialEquation exp = (ExponentialEquation)bf.equation; //Return the rate. The higher the rate (steeper curve), the less likely to crunch. //Takes into account the number of employees. float x = exp.r * employeeCount; return(x); }
/// <summary> /// Fire the LanguageChange event. /// </summary> public static void OnLanguageChange() { LanguageChange?.Invoke(); #if BEST_FIT_TEXT_INCLUDED BestFit.OnResolutionChange(); #endif }
public void BestFitLineTest() { Point start = new Point(new Position(1, 1, 1), new Vector(-1, -1, 1)); Point end = new Point(new Position(3, 3, 3), new Vector(-1, -1, 1)); var line = new Line2D(start, end); var data = TestData.LinePoint_Nominal(100, line); var result1 = BestFit.BestFitLine(data, Unit.EvaluationMethod.Gauss); }
public static Curve Relax(this Curve c, double factor, bool make_single_curved = false, Plane?projection_plane = null, bool rebuild = false) { NurbsCurve NC = c.ToNurbsCurve(); List <Point3d> CtrlPts = NC.Points.Select(x => x.Location).ToList(); Line BestFit; Line.TryFitLineToPoints(CtrlPts, out BestFit); Plane plane = Plane.Unset; if (make_single_curved) { if (projection_plane.HasValue) { plane = projection_plane.Value; plane.Origin = NC.PointAt(NC.Domain.Mid); } else { Plane.FitPlaneToPoints(CtrlPts, out plane); } } for (int i = 0; i < CtrlPts.Count; ++i) { Vector3d v = BestFit.ClosestPoint(CtrlPts[i], false) - CtrlPts[i]; //NC.Points[i].Location += v * 0.2; Point3d pt = NC.Points[i].Location + v * factor; if (make_single_curved) { pt = pt.ProjectToPlane(plane); } NC.Points[i] = new ControlPoint(pt, NC.Points[i].Weight); } if (rebuild) { NC = NC.Rebuild(NC.Points.Count, NC.Degree, false); } NC.Domain = new Interval(0, NC.GetLength()); return(NC); }
public override void Run() { Verbose.Out("Bosters: Setting selectors to 'c'"); sc.selectors = "c"; Reservation r; if (sc.gRes != null) { r = sc.gRes; } else { r = new Reservation("20%,20%,20%,20%"); } Phantom p; for (int i = 0; i < sc.phantoms.Count; i++) { p = (Phantom)sc.phantoms.GetByIndex(i); p.AdjustReservation(r); } SortServersDescending(); Server s; for (int i = sc.servers.Count - 1; i > 0; i--) { s = (Server)sc.servers[i]; if (s.cpu > 1000) { Errors.Error("Server '" + s.name + "' is too big - cannot stack"); sc.servers.RemoveAt(i); } } Algorithm a = new BestFit(sc); a.Run(); }
// compute the best-fit plane via an array of vertices, return true if all vertices's // distances to plane is less than MaxDistError. public static bool BestFitPlane(Vector3[] verts, ref HalfSpace plane, float maxDistErr) { Vector4 p = Vector4.zero; BestFit.ComputeBestFitPlane(verts, null, ref p); Vector3 normal = new Vector3(p[0], p[1], p[2]); plane.Normal = normal; plane.Dist = -p[3]; // now check the distance error... for (int i = 0; i < verts.Length; i++) { if (plane.Dist2Plane(verts[i]) > maxDistErr) { return(false); } } return(true); }