Esempio n. 1
0
        private void BindAuto(Rubric rub)
        {
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);

            Result.ResultList ress = rubda.GetResults(rub.ID, GetSubID());

            lblEvalID.Text = rub.EvalID.ToString();
            if (ress.Count == 0)
            {
                if (!IsStudent())
                {
                    mpViews.SelectedIndex = 2;
                }
                else
                {
                    mpViews.SelectedIndex = 5;
                }
            }
            else
            {
                AutoResult res = ress[0] as AutoResult;

                XmlWizard xmlwiz = new XmlWizard();
                xmlwiz.DisplayDivXslt(res.XmlResult, Path.Combine(Globals.WWWDirectory, "Xml/reshtml.xslt"), divAuto);

                mpViews.SelectedIndex = 3;
            }
        }
Esempio n. 2
0
        private void BindAuto(Rubric rub)
        {
            Result.ResultList ress =
                new Rubrics(Globals.CurrentIdentity).GetResults(rub.ID, GetCurrentSub());

            if (ress.Count == 0)
            {
                divAuto.InnerHtml = "<i>There are no results for this evaluation item</i>";
                return;
            }

            AutoResult   res    = ress[0] as AutoResult;
            MemoryStream xmlstr = new MemoryStream(Encoding.ASCII.GetBytes(res.XmlResult));

            XslTransform xslt = new XslTransform();

            XPathDocument  xpathdoc = new XPathDocument(xmlstr);
            XPathNavigator nav      = xpathdoc.CreateNavigator();

            XPathDocument xsldoc = new XPathDocument(
                Path.Combine(Globals.WWWDirectory, "Xml/reshtml.xslt"));

            StringBuilder strb = new StringBuilder();

            xslt.Load(xsldoc, null, null);
            xslt.Transform(xpathdoc, null, new XmlTextWriter(new StringWriter(strb)), (XmlResolver)null);

            divAuto.InnerHtml = strb.ToString();
        }
Esempio n. 3
0
        protected string RunDependencies(Zone tzone, ZoneService testsvc,
                                         Evaluations.DependencyGraph dg)
        {
            Evaluation.EvaluationList border = dg.GetBuildOrder();
            bool suc;

            //Copy zones first
            foreach (AutoEvaluation eval in border)
            {
                Zone ezone = testsvc.Synchronize(eval);
                testsvc.CopyZone(tzone, ezone);
            }

            //Run the deps
            foreach (AutoEvaluation eval in border)
            {
                m_logger.Log("Running Dep: " + eval.Name);
                if (eval.IsBuild)
                {
                    RunBuildTest(tzone, eval, out suc);
                }
                else
                {
                    string xmlout = RunTest(tzone, eval);
                    if (eval.ResultType == Result.AUTO_TYPE)
                    {
                        AutoResult res = new AutoResult();
                        res.XmlResult = xmlout;

                        suc = (res.Success != AutoResult.CRITICALLYFLAWED);
                    }
                    else
                    {
                        suc = true;
                    }
                }

                if (!suc)
                {
                    return(eval.Name);
                }
            }

            return(null);
        }
Esempio n. 4
0
            public int Compare(object x, object y)
            {
                AutoResult ax = (AutoResult)x;
                AutoResult ay = (AutoResult)y;

                if (ax.CompetitionScore > ay.CompetitionScore)
                {
                    return(-1);
                }
                else if (ax.CompetitionScore == ay.CompetitionScore)
                {
                    return(0);
                }
                else
                {
                    return(1);
                }
            }
Esempio n. 5
0
        private static IList <PointPairList> FindNthThickSegments(int i, AutoResult result, IList <double[]> series)
        {
            var oThickSegments = new List <PointPairList>();

            int nLast    = 0;
            int nLastDir = -1;

            for (int j = 0; j < result.Positions.Count; j++)
            {
                IntPair oPos = result.Positions[j];
                int     nCurrentSliceLength = oPos.Key - 1 - nLast;
                var     oXSlice             = new double[nCurrentSliceLength];
                var     oYSlice             = new double[nCurrentSliceLength];

                Array.Copy(series[0], nLast, oXSlice, 0, nCurrentSliceLength);
                Array.Copy(series[i + 1], nLast, oYSlice, 0, nCurrentSliceLength);
                nLastDir = oPos.Value;

                if (nLastDir > 0)
                {
                    oThickSegments.Add(new PointPairList(oXSlice, oYSlice));
                }

                nLast = oPos.Key;
            }

            if (nLast < series[0].Length)
            {
                int nLastSliceLength = series[0].Length - nLast;

                var oXSlice = new double[nLastSliceLength];
                var oYSlice = new double[nLastSliceLength];

                Array.Copy(series[0], nLast, oXSlice, 0, nLastSliceLength);
                Array.Copy(series[i + 1], nLast, oYSlice, 0, nLastSliceLength);

                if (nLastDir * -1 > 0)
                {
                    oThickSegments.Add(new PointPairList(oXSlice, oYSlice));
                }
            }
            return(oThickSegments);
        }
Esempio n. 6
0
        /// <summary>
        /// Create a auto result.
        /// </summary>
        public bool CreateAuto(int evalID, string grader, int subID, string result)
        {
            //Check permission
            Submissions subac = new Submissions(m_ident);

            Components.Submission sub  = subac.GetInfo(subID);
            Assignment            asst = new Assignments(m_ident).GetInfo(sub.AsstID);

            Authorize(asst.CourseID, "createauto", asst.ID, null);

            AutoResult res = new AutoResult();

            res.EvalID       = evalID; res.Grader = grader;
            res.SubmissionID = subID; res.XmlResult = result;

            //Clear out all results for this evaluation
            Submission.SubmissionList subs =
                new Principals(m_ident).GetSubmissions(sub.PrincipalID, sub.AsstID);

            //Delete all old results
            foreach (Submission s in subs)
            {
                Result.ResultList ress = subac.GetResults(s.ID);
                foreach (Result r in ress)
                {
                    if (r.Type == Result.AUTO_TYPE)
                    {
                        AutoResult ar = r as AutoResult;
                        if (ar.EvalID == evalID)
                        {
                            Delete(ar.ID);
                        }
                    }
                }
            }

            return(m_dp.CreateAutoResult(res));
        }
Esempio n. 7
0
        private void RunContinuationForTripple(IntTripple tripple)
        {
            try
            {
                if (SBML == null || SBML.Length == 0)
                {
                    return;
                }

                string fort8 = AutoResult.NewFort8; //.Replace(" 7 ", " 12 ");
                //string fort7 = AutoResult.NewFort7;

                ResetAuto();

                setupControl1.RunContinuation = true;
                setupControl1.Label           = tripple.Value1;

                string originalConfig = setupControl1.CurrentConfig.ToInputString();

                //setupControl1.CurrentConfig.IPS = 2;
                setupControl1.CurrentConfig.IRS = tripple.Value1;
                //setupControl1.CurrentConfig.ILP = 1;

                setupControl1.CurrentConfig.NICP = 2;
                setupControl1.CurrentConfig.ICP.Clear();
                setupControl1.CurrentConfig.ICP.Add(0);
                setupControl1.CurrentConfig.ICP.Add(10);

                //setupControl1.CurrentConfig.NCOL = 4;
                //setupControl1.CurrentConfig.IAD = 3;
                //setupControl1.CurrentConfig.ISP = 1;
                //setupControl1.CurrentConfig.ISW = 1;

                setupControl1.CurrentConfig.MXBF = 10;

                setupControl1.CurrentConfig.NTHL = 1;
                setupControl1.CurrentConfig.THL.Add(new IntDoublePair(10, 0));

                txtConfig.Text = setupControl1.Configuration;

                SetupAuto();

                AutoInterface.setFort2File(txtConfig.Text, txtConfig.Text.Length);

                AutoInterface.setFort3File(fort8, fort8.Length);

                if (setupControl1.CurrentConfig.IPS != 1)
                {
                    if (
                        MessageBox.Show(
                            "Currently only IPS = 1 is supported, any other value will make the library unstable. It is recommendet that you Quit (yes).",
                            "Unsupported Values", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        return;
                    }
                }


                AutoInterface.CallAuto();
                string lastMessage = AutoInterface.GetLastMessage();

                //fort7 = fort7 + AutoResult.NewFort7;
                //AutoInterface.setFort7File(fort7, fort7.Length);

                fort8 = fort8 + AutoResult.NewFort8;
                AutoInterface.setFort8File(fort8, fort8.Length);

                CurrentResult  = new AutoResult();
                txtResult.Text = CurrentResult.Fort7;

                RemoveWartermark();
                if (CurrentResult.ErrorOccured && CurrentResult.NumPoints < 10)
                {
                    AddWaterMark("Auto\ndid not\nreturn\nresults.");
                }
                else if (CurrentResult.NumPoints < 10)
                {
                    AddWaterMark("Not\nenough\npoints\nreturned.");
                }


                setupControl1.CurrentConfig = AutoInputConstants.FromContent(originalConfig);


                if (!string.IsNullOrEmpty(lastMessage))
                {
                    RemoveWartermark();
                    AddWaterMark(lastMessage);
                    return;
                }


                PlotResults(CurrentResult);


                if (setupControl1.ReloadAfterRun)
                {
                    try
                    {
                        //Simulator.loadSBML(SBML);
                        cmdSendToAuto_Click(this, EventArgs.Empty);
                    }
                    catch (Exception)
                    {
                        //
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "An Error occured while running Auto", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Esempio n. 8
0
        internal void RunAuto()
        {
            Cursor originalCursor = Cursor;

            try
            {
                Cursor = Cursors.WaitCursor;

                if (string.IsNullOrEmpty(SBML))
                {
                    OpenSBML();
                }

                ResetAuto();
                setupControl1.RunContinuation = false;
                SetupAuto();


                AutoInterface.setFort2File(txtConfig.Text, txtConfig.Text.Length);

                if (setupControl1.CurrentConfig.IPS != 1)
                {
                    if (
                        MessageBox.Show(
                            "Currently only IPS = 1 is supported, any other value will make the library unstable. It is recommendet that you Quit (yes).",
                            "Unsupported Values", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        return;
                    }
                }


                AutoInterface.CallAuto();

                CurrentResult  = new AutoResult();
                txtResult.Text = CurrentResult.Fort7;

                RemoveWartermark();
                if (CurrentResult.ErrorOccured)
                {
                    AddWaterMark("Auto\ndid not\nreturn\nresults.");
                }
                else if (CurrentResult.NumPoints < 10)
                {
                    AddWaterMark("Not\nenough\npoints\nreturned.");
                }

                PlotResults(CurrentResult);


                //if (setupControl1.ReloadAfterRun)
                //{
                //    try
                //    {
                //        //Simulator.loadSBML(SBML);
                //        cmdSendToAuto_Click(this, EventArgs.Empty);
                //    }
                //    catch (Exception)
                //    {
                //        //
                //    }
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "An Error occured while running Auto", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = originalCursor;
            }
        }
Esempio n. 9
0
        private void PlotResults(AutoResult oResult)
        {
            graphControl1.ZedControl.GraphPane.CurveList.Clear();
            var oRot = new ColorSymbolRotator();

            CurrentPlot = new List <PlotInfo>();

            foreach (AutoResultRun run in oResult.AllRuns)
            {
                var series = run.DataSeries;

                if (series.Count < 2)
                {
                    continue;
                }


                if (series[0].Length < 10)
                {
                    continue;
                }

                for (int i = 0; i < series.Count - 1; i++)
                {
                    var sLabel     = GetNthName(i);
                    var oLineColor = oRot.NextColor;
                    var info       = new PlotInfo {
                        Label     = sLabel,
                        MainCurve = new PointPairList(series[0], series[i + 1])
                    };

                    if (oResult.Positions.Count == 0)
                    {
                        AddNthCurveToGraph(i, series, sLabel, oLineColor);
                    }
                    else
                    {
                        var thickSegments = FindNthThickSegments(i, oResult, series);
                        AddNthSegmentedCurveToGraph(i, thickSegments, series, sLabel, oLineColor);
                        info.ThickSegments = thickSegments;
                    }
                    CurrentPlot.Add(info);
                }


                foreach (IntTripple tripple in oResult.Labels)
                {
                    for (int i = 0; i < series.Count - 1; i++)
                    {
                        int currentPos = UtilLib.FindClosestStablePoint(tripple.Key, oResult.Positions);

                        double x    = series[0][currentPos];
                        double y    = series[1 + i][currentPos];
                        var    text = new TextObj(UtilLib.ConvertIntTypeToShortString(tripple.Value2), x, y);
                        text.Tag = new TagData {
                            Series = 1 + i, Tripple = tripple, Label = GetNthName(i)
                        };

                        graphControl1.ZedControl.GraphPane.GraphObjList.Add(text);
                    }
                }
            }

            graphControl1.ZedControl.GraphPane.XAxis.Scale.MaxGrace = 0f;
            graphControl1.ZedControl.GraphPane.XAxis.Scale.MinGrace = 0f;
            graphControl1.ZedControl.GraphPane.YAxis.Scale.MaxGrace = 0f;
            graphControl1.ZedControl.GraphPane.YAxis.Scale.MinGrace = 0f;

            SetParameterAxisTitle();

            graphControl1.ZedControl.AxisChange();
            tabControl1.Refresh();
        }