Exemplo n.º 1
0
 private void DisconnectOnProblemIfNeeded(ProblemStatus status)
 {
     if ((status == ProblemStatus.SocketMethodInvokeError) || ((status == ProblemStatus.SendError) || (status == ProblemStatus.ReceiveError)))
     {
         this.Disconnect(status);
     }
 }
Exemplo n.º 2
0
            public static bool TryParse(string value, out ProblemStatus result)
            {
                result = default(ProblemStatus);

                if (value == "provisional")
                {
                    result = ProblemStatus.Provisional;
                }
                else if (value == "working")
                {
                    result = ProblemStatus.Working;
                }
                else if (value == "confirmed")
                {
                    result = ProblemStatus.Confirmed;
                }
                else if (value == "refuted")
                {
                    result = ProblemStatus.Refuted;
                }
                else
                {
                    return(false);
                }

                return(true);
            }
Exemplo n.º 3
0
 private static string GetStatusColor(ProblemStatus status)
 {
     return(status switch
     {
         ProblemStatus.Accept => Colors.Green,
         ProblemStatus.UnAccept => Colors.Red,
         ProblemStatus.Pending => Colors.Yellow,
         ProblemStatus.NotTried => Colors.DarkGray,
         ProblemStatus.FirstBlood => Colors.DarkGreen,
         _ => throw new ArgumentOutOfRangeException(nameof(status), status, null)
     });
Exemplo n.º 4
0
        ///<summary>Changes the value of the DateTStamp column to the current time stamp for all diseases of a patient that are the status specified.</summary>
        public static void ResetTimeStamps(long patNum, ProblemStatus status)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), patNum, status);
                return;
            }
            string command = "UPDATE disease SET DateTStamp = CURRENT_TIMESTAMP WHERE PatNum =" + POut.Long(patNum);

            command += " AND ProbStatus = " + POut.Int((int)status);
            Db.NonQ(command);
        }
Exemplo n.º 5
0
 public Problem(
     string userId,
     string function,
     string function2,
     ProblemType taskType,
     ProblemStatus taskStatus)
 {
     this.UserId = userId;
     this.Function = function;
     this.Function2 = function2;
     this.ProblemType = taskType;
     this.ProblemStatus = taskStatus;
 }
Exemplo n.º 6
0
 protected void Disconnect(ProblemStatus status)
 {
     this.log.InfoFormat("Disconnect by {0}.", status);
     if (!this.IsConnected)
     {
         this.log.Warn("Closing not connected socket.");
     }
     else
     {
         try
         {
             this.socket.Disconnect();
             this.log.Debug("DISCONNECTED");
         }
         catch (ObjectDisposedException exception)
         {
             this.log.Fatal("Disconnect error.", exception);
         }
     }
 }
Exemplo n.º 7
0
 public static string ToString(ProblemStatus value)
 {
     if (value == ProblemStatus.Provisional)
     {
         return("provisional");
     }
     else if (value == ProblemStatus.Working)
     {
         return("working");
     }
     else if (value == ProblemStatus.Confirmed)
     {
         return("confirmed");
     }
     else if (value == ProblemStatus.Refuted)
     {
         return("refuted");
     }
     else
     {
         throw new ArgumentException("Unrecognized ProblemStatus value: " + value.ToString());
     }
 }
Exemplo n.º 8
0
            public static bool TryParse(string value, out ProblemStatus result)
            {
                result = default(ProblemStatus);

                if( value=="provisional")
                    result = ProblemStatus.Provisional;
                else if( value=="working")
                    result = ProblemStatus.Working;
                else if( value=="confirmed")
                    result = ProblemStatus.Confirmed;
                else if( value=="refuted")
                    result = ProblemStatus.Refuted;
                else
                    return false;

                return true;
            }
Exemplo n.º 9
0
 public static string ToString(ProblemStatus value)
 {
     if( value==ProblemStatus.Provisional )
         return "provisional";
     else if( value==ProblemStatus.Working )
         return "working";
     else if( value==ProblemStatus.Confirmed )
         return "confirmed";
     else if( value==ProblemStatus.Refuted )
         return "refuted";
     else
         throw new ArgumentException("Unrecognized ProblemStatus value: " + value.ToString());
 }
Exemplo n.º 10
0
 public IList <ViewModel.ProblemModel> GetExclude(ProblemStatus status)
 {
     return(_problems.Where(p => p.Status != status).ToList());
 }
Exemplo n.º 11
0
 public IList <Problem> GetExclude(ProblemStatus status)
 {
     return(_problem.Where(p => p.Status == status).ToList());
 }
Exemplo n.º 12
0
        public void SetData(List <object> data)
        {
            //number of property to be assign
            //const int number_of_property = 20;

            //Type t = typeof(ProblemInfo);
            //PropertyInfo[] pcol = t.GetProperties();
            //for (int i = 0; i <= number_of_property; ++i)
            //{
            //    pcol[i].SetValue(this, data[i], null);
            //}

            //assign properties
            //Problem ID
            pid = (long)data[0];
            //Problem Number
            pnum = (long)data[1];
            //Problem Title
            ptitle = (string)data[2];
            //Number of Distinct Accepted User (DACU)
            dacu = (long)data[3];
            //Best Runtime of an Accepted Submission
            run = (long)data[4];
            //Best Memory used of an Accepted Submission
            mem = (long)data[5];
            //Number of No Verdict Given (can be ignored)
            nver = (long)data[6];
            //Number of Submission Error
            sube = (long)data[7];
            //Number of Can't be Judged
            cbj = (long)data[8];
            //Number of In Queue
            inq = (long)data[9];
            //Number of Compilation Error
            ce = (long)data[10];
            //Number of Restricted Function
            resf = (long)data[11];
            //Number of Runtime Error
            re = (long)data[12];
            //Number of Output Limit Exceeded
            ole = (long)data[13];
            //Number of Time Limit Exceeded
            tle = (long)data[14];
            //Number of Memory Limit Exceeded
            mle = (long)data[15];
            //Number of Wrong Answer
            wa = (long)data[16];
            //Number of Presentation Error
            pe = (long)data[17];
            //Number of Accepted
            ac = (long)data[18];
            //Problem Run-Time Limit (milliseconds)
            rtl = (long)data[19];
            //Problem Status (0 = unavailable, 1 = normal, 2 = special judge)
            stat = (long)data[20];

            //load other
            Solved = false; //default is false
            Volume = (int)(pnum / 100);
            if (run >= 1000000000)
            {
                run = -1;
            }
            if (mem >= 1000000000)
            {
                mem = -1;
            }

            Total = ac + wa + cbj + ce + mle + tle + ole + nver + pe + re + resf + sube;

            if (stat == 0)
            {
                Status = ProblemStatus.Unavailable;
            }
            else if (stat == 1)
            {
                Status = ProblemStatus.Normal;
            }
            else
            {
                Status = ProblemStatus.Special_Judge;
            }

            //set level
            const int MAX_LEVEL = 9;

            this.Level = 1 + MAX_LEVEL;
            if (this.dacu > 0)
            {
                this.Level -= Math.Min(MAX_LEVEL, Math.Floor(Math.Log(this.dacu)));
            }
        }
Exemplo n.º 13
0
        public static void Main(String[] argv)
        {
            Model M = new Model();

            // (Optional) set a log stream
            // M.SetLogHandler(Console.Out);

            // (Optional) uncomment to see what happens when solution status is unknown
            // M.SetSolverParam("intpntMaxIterations", 1);

            // In this example we set up a small conic problem
            SetupExample(M);

            // Optimize
            try
            {
                M.Solve();

                // We expect solution status OPTIMAL (this is also default)
                M.AcceptedSolutionStatus(AccSolutionStatus.Optimal);

                Variable x     = M.GetVariable("x");
                long     xsize = x.GetSize();
                double[] xVal  = x.Level();
                Console.Write("Optimal value of x = ");
                for (int i = 0; i < xsize; ++i)
                {
                    Console.Write(xVal[i] + " ");
                }
                Console.WriteLine("\nOptimal primal objective: " + M.PrimalObjValue());
                // .. continue analyzing the solution
            }
            catch (OptimizeError e)
            {
                Console.WriteLine("Optimization failed. Error: " + e.ToString());
            }
            catch (SolutionError)
            {
                // The solution with at least the expected status was not available.
                // We try to diagnoze why.
                Console.WriteLine("Requested solution was not available.");
                ProblemStatus prosta = M.GetProblemStatus();
                switch (prosta)
                {
                case ProblemStatus.DualInfeasible:
                    Console.WriteLine("Dual infeasibility certificate found.");
                    break;

                case ProblemStatus.PrimalInfeasible:
                    Console.WriteLine("Primal infeasibility certificate found.");
                    break;

                case ProblemStatus.Unknown:
                    // The solutions status is unknown. The termination code
                    // indicates why the optimizer terminated prematurely.
                    Console.WriteLine("The solution status is unknown.");
                    StringBuilder symname = new StringBuilder();
                    StringBuilder desc    = new StringBuilder();
                    Env.getcodedesc((rescode)M.GetSolverIntInfo("optimizeResponse"), symname, desc);
                    Console.WriteLine("  Termination code: {0} {1}", symname, desc);
                    break;

                default:
                    Console.WriteLine("Another unexpected problem status: " + prosta);
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Unexpected error: " + e.ToString());
            }

            M.Dispose();
        }
Exemplo n.º 14
0
 /// <summary>
 /// Konstruktor tymczasowo wysłanego problemu.
 /// </summary>
 /// <param name="problemId">ID problemu</param>
 /// <param name="status">Status</param>
 /// <param name="partialProblems">Lista PartialProblems</param>
 public TempProblem(ulong problemId, ProblemStatus status, List<TempPartial> partialProblems)
 {
     ProblemId = problemId;
     Status = status;
     PartialProblems = partialProblems;
 }
Exemplo n.º 15
0
 private void OnSocketProblem(ProblemStatus status, Exception e)
 {
     this.DisconnectOnProblemIfNeeded(status);
     throw new NetworkException("OnSocketProblem " + status, e);
 }
Exemplo n.º 16
0
		///<summary>Changes the value of the DateTStamp column to the current time stamp for all diseases of a patient that are the status specified.</summary>
		public static void ResetTimeStamps(long patNum,ProblemStatus status) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),patNum,status);
				return;
			}
			string command="UPDATE disease SET DateTStamp = CURRENT_TIMESTAMP WHERE PatNum ="+POut.Long(patNum);
				command+=" AND ProbStatus = "+POut.Int((int)status);
			Db.NonQ(command);
		}