// TODO : Add other transforms #endregion #region Object methods /** * <inheritdoc /> */ public override bool Equals(Object obj) { LMS lmsObj = obj as LMS; if (lmsObj == this) { return(true); } if (lmsObj == null) { return(false); } return(L == lmsObj.L && M == lmsObj.M && S == lmsObj.S); }
public static CommonMessages SaveEmployeeLeave(LMS Data) { CommonMessages MessagesObj = new CommonMessages(); try { using (var Cmd = new DBSqlCommand()) { Cmd.AddParameters(Data.UserEmployeeId, CommonConstants.UserEmployeeId, SqlDbType.Int); Cmd.AddParameters(Data.FromDate, CommonConstants.FromDate, SqlDbType.DateTime); Cmd.AddParameters(Data.ToDate, CommonConstants.ToDate, SqlDbType.DateTime); Cmd.AddParameters(Data.LeaveTypeId, CommonConstants.LeaveTypeId, SqlDbType.Int); Cmd.AddParameters(Data.LeaveReasonId, CommonConstants.LeaveReasonId, SqlDbType.Int); Cmd.AddParameters(Data.BusinessId, CommonConstants.BusinessID, SqlDbType.Int); Cmd.AddParameters(Data.CurrentLeaveBalance, CommonConstants.CurrentLeaveBalance, SqlDbType.Int); Cmd.AddParameters(Data.EffectiveLeave, CommonConstants.EffectiveLeave, SqlDbType.Int); Cmd.AddParameters(Data.UserId, CommonConstants.UserId, SqlDbType.Int); Cmd.AddParameters(Data.Description, CommonConstants.Description, SqlDbType.NVarChar); Cmd.AddParameters(Data.FilePath, CommonConstants.FilePath, SqlDbType.NVarChar); //Result = (int)Cmd.ExecuteScalar(SqlProcedures.Insert_EmployeeLeaves); IDataReader ireader = Cmd.ExecuteDataReader(SqlProcedures.Insert_EmployeeLeaves); while (ireader.Read()) { var EmpDet = new CommonMessages { Message = ireader.GetString(CommonColumns.ErrorMessage), Result = ireader.GetInt32(CommonColumns.EmployeeLeaveId), ErrorSeverity = ireader.GetString(CommonColumns.ErrorSeverity), ErrorState = ireader.GetString(CommonColumns.ErrorState) }; MessagesObj = EmpDet; } } return(MessagesObj); } catch (Exception Ex) { MessagesObj.Result = 0; MessagesObj.Message = Ex.Message; MessagesObj.ErrorSeverity = Ex.Message; MessagesObj.ErrorState = Ex.Message; return(MessagesObj); } }
static void Main() { //pesos iguais 0.5 Algorithm algorithm = new LMS(); int playerID1 = 1, playerID2 = 2; //set algoritmo e tipo jogador LearnPlayer learner = new LearnPlayer(algorithm, playerID1); RandomPlayer randomer = new RandomPlayer(algorithm, playerID2); Game game = new Game(learner, randomer, algorithm); //game.normalLearning(1000); //# of iterations game.vsHuman(); //game.Statistic(500); }
private LMS ReadLMS(string path) { if (FileSystem.FileExists(path)) { LMS lms = new LMS(FileSystem.GetFileReadStream(path)); if (lms != null && exportTextures) { string lvlFolder = gameDataBinFolder + ConvertCase(lvlName + "/", Settings.CapsType.LevelFolder); for (int i = 0; i < lms.Count; i++) { Util.ByteArrayToFile(lvlFolder + "textures/" + ConvertCase(lvlName + "_" + i + ".png", Settings.CapsType.LevelFile), lms.textures[i].EncodeToPNG()); } } return(lms); } return(null); }
/// <summary> /// Transforms XYZ color to destination reference white. /// </summary> public XYZ Transform(XYZ sourceColor, XYZ sourceWhitePoint, XYZ targetWhitePoint) { if (sourceColor == null) { throw new ArgumentNullException(nameof(sourceColor)); } if (sourceWhitePoint == null) { throw new ArgumentNullException(nameof(sourceWhitePoint)); } if (targetWhitePoint == null) { throw new ArgumentNullException(nameof(targetWhitePoint)); } if (sourceWhitePoint.Equals(targetWhitePoint)) { return(sourceColor); } var sourceColorLMS = _conversionToLMS.Convert(sourceColor); if (sourceWhitePoint != _lastSourceWhitePoint || targetWhitePoint != _lastTargetWhitePoint) { var sourceWhitePointLMS = _conversionToLMS.Convert(sourceWhitePoint); var targetWhitePointLMS = _conversionToLMS.Convert(targetWhitePoint); _cachedDiagonalMatrix = Matrix.Diagonal(targetWhitePointLMS.L / sourceWhitePointLMS.L, targetWhitePointLMS.M / sourceWhitePointLMS.M, targetWhitePointLMS.S / sourceWhitePointLMS.S); _lastSourceWhitePoint = sourceWhitePoint; _lastTargetWhitePoint = targetWhitePoint; } var targetColorLMS = new LMS(_cachedDiagonalMatrix.Multiply(sourceColorLMS.Vector)); var targetColor = _conversionToXYZ.Convert(targetColorLMS); return(targetColor); }
/** * <inheritdoc /> */ public override LMS ToLMS(LMSStrategy strategy = LMSStrategy.Bradford) { LMS lmsDS = DataSource as LMS; if (lmsDS != null) { // TODO : Check chromatic adaptation, depends on "connecting" the ASimpleColor class // TODO : Use the added historic data about strategy in LMS... return(lmsDS); } if (strategy == LMSStrategy.Bradford) { return(BradfordTransform()); } if (strategy == LMSStrategy.VonKries) { return(VonKriesTransform()); } throw new NotImplementedException(); }
public ActionResult ApplyLeave() { LMS _ApplyLeave = new LMS(); ViewBag.EmployeeList = new SelectList(LMSBAL.Get_Employees(UserId, BusinessId), "key", "value"); ViewBag.LeaveList = new SelectList(LMSBAL.Get_LeaveType(UserId), "key", "value"); ViewBag.ReasonList = new SelectList(LMSBAL.Get_ReasonType(UserId), "key", "value"); ViewBag.UserName = UserName; ViewBag.RoleId = RoleId; ViewBag.UserEmployeeId = UserSessionEmployeeId; var balance = BAL.PreferencesBAL.GetManageLeaveDetails(this.BusinessId).FirstOrDefault(); if (balance == null) { ViewBag.CurrentBalance = 0; } else { ViewBag.CurrentBalance = balance.Leavevalue; } return(View()); }
public void OrderMovesRootNode() { LMS = LMS.OrderByDescending(o => o.IDScore).ToList(); }
public ActionResult AddApplyLeave(string EmployeeID, string FromDate, string ToDate, string LeaveTypeId, string LeaveReasonId, string Description) { string Message = string.Empty; ExceptionLog.WriteDebugLog("methodname:SaveDocuments", "FromDate=" + FromDate + "ToDate=" + ToDate + "EmployeeID=" + EmployeeID + "LeaveTypeId=" + LeaveTypeId + "LeaveReasonId=" + LeaveReasonId + "Description=" + Description); try { HttpPostedFileBase file1 = null; string fname1 = ""; LMS _LMS = new LMS(); _LMS.BusinessId = BusinessId; _LMS.UserId = UserId; _LMS.UserEmployeeId = Convert.ToInt32(EmployeeID); _LMS.FromDate = DateTime.ParseExact(FromDate, "MM/dd/yyyy", null); _LMS.ToDate = DateTime.ParseExact(ToDate, "MM/dd/yyyy", null); _LMS.LeaveTypeId = Convert.ToInt32(LeaveTypeId); _LMS.LeaveReasonId = Convert.ToInt32(LeaveReasonId); _LMS.CurrentLeaveBalance = 0; _LMS.EffectiveLeave = 0; _LMS.Description = Description; if (Request.Files.Count > 0) { HttpFileCollectionBase files1 = Request.Files; for (int i = 0; i < files1.Count; i++) { file1 = files1[i]; if (Request.Browser.Browser.ToUpper() == "IE" || Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER") { string[] testfiles = file1.FileName.Split(new char[] { '\\' }); fname1 = testfiles[testfiles.Length - 1]; } else { fname1 = file1.FileName; } } } //_DocumentCabinet.FilePath =Path.Combine(ConfigurationManager.AppSettings["FilepathPdf"].ToString()); _LMS.FilePath = Path.Combine(Server.MapPath(ConfigurationManager.AppSettings["LeavesFilePath"].ToString()), fname1); CommonMessages MessagesObj = new CommonMessages(); MessagesObj = BAL.LMSBAL.SaveEmployeeLeave(_LMS); if (MessagesObj.Result > 0) { string extension = Path.GetExtension(fname1); fname1 = Path.Combine(Server.MapPath(ConfigurationManager.AppSettings["LeavesFilePath"].ToString()), MessagesObj.Result + extension); if (System.IO.File.Exists(fname1)) { System.IO.FileInfo fileinfo = new System.IO.FileInfo(fname1); fileinfo.Delete(); file1.SaveAs(fname1); } else { //file1.SaveAs(fname1); } Message = EMSResources.SavedSuccessfully; } else { Message = MessagesObj.Message; } return(Json(Message, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ExceptionLog.WriteLog(ex, "Method:AddApplyLeave,Parameters: EmployeeID=" + EmployeeID + ",FromDate=" + FromDate + ",ToDate=" + ToDate + ",LeaveTypeId=" + LeaveTypeId + ",LeaveReasonId=" + LeaveReasonId + ",Description=" + Description); ErrorSignal.FromCurrentContext().Raise(ex); return(null); } }
protected override async Task Load() { try { if (gameDataBinFolder == null || gameDataBinFolder.Trim().Equals("")) { throw new Exception("GAMEDATABIN folder doesn't exist"); } if (lvlName == null || lvlName.Trim() == "") { throw new Exception("No level name specified!"); } globals = new Globals(); gameDataBinFolder += "/"; await FileSystem.CheckDirectory(gameDataBinFolder); if (!FileSystem.DirectoryExists(gameDataBinFolder)) { throw new Exception("GAMEDATABIN folder doesn't exist"); } loadingState = "Initializing files"; await CreateCNT(); if (lvlName.EndsWith(".exe")) { if (!Settings.s.hasMemorySupport) { throw new Exception("This game does not have memory support."); } Settings.s.loadFromMemory = true; MemoryFile mem = new MemoryFile(lvlName); files_array[0] = mem; await WaitIfNecessary(); LoadMemory(); } else { // Prepare folder names string fixFolder = gameDataBinFolder + ConvertCase("Fix/", Settings.CapsType.LevelFolder); string lvlFolder = gameDataBinFolder + ConvertCase(lvlName + "/", Settings.CapsType.LevelFolder); // Prepare paths paths["fix.lvl"] = fixFolder + ConvertCase("Fix.lvl", Settings.CapsType.LevelFile); paths["fix.ptr"] = fixFolder + ConvertCase("Fix.ptr", Settings.CapsType.LevelFile); paths["fix.pbt"] = fixFolder + ConvertCase("Fix.pbt", Settings.CapsType.LevelFile); paths["lvl.lvl"] = lvlFolder + ConvertCase(lvlName + ".lvl", Settings.CapsType.LevelFile); paths["lvl.ptr"] = lvlFolder + ConvertCase(lvlName + ".ptr", Settings.CapsType.LevelFile); paths["lvl.pbt"] = lvlFolder + ConvertCase(lvlName + ".pbt", Settings.CapsType.LevelFile); paths["lvl.lms"] = lvlFolder + ConvertCase(lvlName + ".lms", Settings.CapsType.LMFile); // Download files foreach (KeyValuePair <string, string> path in paths) { if (path.Value != null) { await PrepareFile(path.Value); } } lvlNames[Mem.Fix] = "fix"; lvlPaths[Mem.Fix] = paths["fix.lvl"]; ptrPaths[Mem.Fix] = paths["fix.ptr"]; lvlNames[Mem.Lvl] = lvlName; lvlPaths[Mem.Lvl] = paths["lvl.lvl"]; ptrPaths[Mem.Lvl] = paths["lvl.ptr"]; for (int i = 0; i < lvlPaths.Length; i++) { if (lvlPaths[i] == null) { continue; } if (FileSystem.FileExists(lvlPaths[i])) { files_array[i] = new LVL(lvlNames[i], lvlPaths[i], i); } } ReadLargoLVL(Mem.Fix, fixFolder + ConvertCase("Fix.dmp", Settings.CapsType.LevelFile)); ReadLargoLVL(Mem.Lvl, lvlFolder + ConvertCase(lvlName + ".dmp", Settings.CapsType.LevelFile)); if (FileSystem.mode != FileSystem.Mode.Web) { pbt[Mem.Fix] = ReadPBT(paths["fix.pbt"], fixFolder + ConvertCase("Fix_PBT.dmp", Settings.CapsType.LevelFile)); pbt[Mem.Lvl] = ReadPBT(paths["lvl.pbt"], lvlFolder + ConvertCase(lvlName + "_PBT.dmp", Settings.CapsType.LevelFile)); lms = ReadLMS(paths["lvl.lms"]); } for (int i = 0; i < loadOrder.Length; i++) { int j = loadOrder[i]; if (files_array[j] != null && FileSystem.FileExists(ptrPaths[j])) { ((LVL)files_array[j]).ReadPTR(ptrPaths[j]); } } await LoadFIX(); await LoadLVL(); } } finally { for (int i = 0; i < files_array.Length; i++) { if (files_array[i] != null) { if (!(files_array[i] is MemoryFile)) { files_array[i].Dispose(); } } } if (cnt != null) { cnt.Dispose(); } } await WaitIfNecessary(); InitModdables(); }
public virtual void handleLearningEvent(LearningEvent @event) { LMS lr = (LMS)@event.Source; Console.WriteLine(lr.CurrentIteration + ". iteration | Total network error: " + lr.TotalNetworkError); }