Пример #1
0
        void State_Starting(State state)
        {
            if (!_context.controlIteration || !_context.controlRecordingIteration)
            {
                return;
            }

            var key = new ElementId("STATE_" + state.name, null);

            if (_iterations.ContainsKey(key))
            {
                return;
            }

            List <Mutator> mutators = new List <Mutator>();

            foreach (Type t in _mutators)
            {
                // can add specific mutators here
                if (SupportedState(t, state))
                {
                    var mutator = GetMutatorInstance(t, state);
                    mutators.Add(mutator);
                }
            }

            if (mutators.Count > 0)
            {
                _iterations.Add(key, mutators);
            }
        }
Пример #2
0
 void State_Starting(State state)
 {
     if (_context.controlIteration && _context.controlRecordingIteration)
     {
         foreach (Type t in _mutators)
         {
             // can add specific mutators here
             if (SupportedState(t, state))
             {
                 var mutator = GetMutatorInstance(t, state);
                 _iterations.Add(new Tuple <string, Mutator, string>("STATE_" + state.name, mutator, null));
                 _count += (uint)mutator.count;
             }
         }
     }
 }
Пример #3
0
        private async void Refresh(object sender, RoutedEventArgs e)
        {
            _iterations = await Logic.GetTeamIterations(GlobalSettings.Instance.Team?.TeamId);

            Iterations.Clear();
            foreach (var iteration in _iterations)
            {
                if (iteration.Value.TimeFrame != "past")
                {
                    Iterations.Add(iteration.Value.Name);
                }
                if (iteration.Value.Attributes.TimeFrame == "current")
                {
                    CurrentIteration = iteration.Value.Name;
                }
            }

            var result = await Logic.GetWorkItemsByQuery(false);

            if (result != null)
            {
                _workItems          = result.WorkItems;
                _completedWorkItems = result.CompletedWorkItems;
                _auditIssues        = result.AuditIssues;
                OnCurrentIterationChanged();

                foreach (var completed in _completedWorkItems.Union(_workItems))
                {
                    var notes = completed.Notes;
                }
            }
        }
Пример #4
0
    // Update is called once per frame
    void Update()
    {
        //Keyboard movement
        float   translation = Input.GetAxis("Vertical") * verSpeed;   //y input
        float   straffe     = Input.GetAxis("Horizontal") * horSpeed; //x input
        Vector2 mvMent      = new Vector2(straffe, translation);      //Save inputs for recording

        translation *= Time.deltaTime;                                //calculate distance
        straffe     *= Time.deltaTime;
        translation  = Mathf.Clamp(translation, translation / 2, translation);
        character.transform.Translate(straffe, 0, translation);

        //Mouse Movement
        var     md        = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y")); //input
        Vector2 mseMvment = md;                                                                    //Save input for recording

        md          = Vector2.Scale(md, new Vector2(sensitivity * smoothing, sensitivity * 2 / 3 * smoothing));
        smoothV.x   = Mathf.Lerp(smoothV.x, md.x, 1f / smoothing);
        smoothV.y   = Mathf.Lerp(smoothV.y, md.y, 1f / smoothing);
        mouseLook  += smoothV;
        mouseLook.y = Mathf.Clamp(mouseLook.y, -25, 25); //limit how far up and down the player can look

        //Rotate view
        transform.localRotation           = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);
        character.transform.localRotation = Quaternion.AngleAxis(mouseLook.x, character.transform.up);

        //record full command
        currRec.Add(next: new Command(mvMent, mseMvment));

        //If next iteration is begun
        if (Input.GetKeyDown("space"))
        {
            //instantiate PastSelf for recorded iteration and save iteration to allRec
            Iteration temp = currRec;                                                                            //create duplicate
            temp.avatar = Instantiate(PastSelf, new Vector3(0, 2, -10 * (iterNum)), new Quaternion(0, 0, 0, 1)); //instantiate
            temp.avatar.GetComponentInChildren <Camera>().enabled          = false;                              //disable camera to avoid conflicts
            temp.avatar.GetComponentInChildren <PastCharacter>().iterNum   = iterNum++;                          //keep track of and iterate iteration number; MAY BE USEFUL FOR JUMPING BACK ITERATIONS IN CASE OF PARADOX
            temp.avatar.GetComponentInChildren <PastCharacter>().inputList = temp;                               //apply recorded commands to PastSelf
            allRec.Add(temp);                                                                                    //Add iteration to list of iterations

            //Reset recording iteration
            currRec = new Iteration();

            //place player for next iteration
            character.transform.position      = new Vector3(0, 2, -10 * iterNum);
            character.transform.localRotation = Quaternion.Euler(0, 0, 0);
            mouseLook.y = mouseLook.x = 0;
        }

        //Control of mouse visibility
        if (Input.GetKeyDown("escape")) //free mouse if esc is pressed
        {
            Cursor.lockState = CursorLockMode.None;
        }
        if (Input.GetMouseButtonDown(0)) //hide mouse if game is clicked
        {
            Cursor.lockState = CursorLockMode.Locked;
        }
    }
Пример #5
0
 /// <summary>
 /// Create a <see cref="For"/> with the specified <see cref="CodeObject"/> in the body.
 /// </summary>
 public For(LocalDecl initialization, Expression conditional, Expression iteration)
 {
     Initialization = initialization;
     Conditional    = conditional;
     if (iteration != null)
     {
         Iterations.Add(iteration);
     }
 }
Пример #6
0
 /// <summary>
 /// Create a <see cref="For"/> with the specified <see cref="CodeObject"/> in the body.
 /// </summary>
 public For(LocalDecl initialization, Expression conditional, Expression iteration, CodeObject body)
     : base(body, true)
 {
     Initialization = initialization;
     Conditional    = conditional;
     if (iteration != null)
     {
         Iterations.Add(iteration);
     }
 }
Пример #7
0
 /// <summary>
 /// Create a <see cref="For"/> with the specified <see cref="CodeObject"/> in the body.
 /// </summary>
 public For(Expression initialization, Expression conditional, Expression iteration)
 {
     if (initialization != null)
     {
         Initializations.Add(initialization);
     }
     Conditional = conditional;
     if (iteration != null)
     {
         Iterations.Add(iteration);
     }
 }
Пример #8
0
        private async Task GetIterationsAsync()
        {
            Iterations.Clear();
            var iterations = await _training.GetTrainedIterationsAysnc();

            foreach (var i in iterations)
            {
                Iterations.Add(i);
            }


            SelectedIteration = (Iterations.Count > 0) ? Iterations[0] : null;
            DownloadModel.RaiseCanExecuteChanged();
        }
Пример #9
0
        void State_Starting(State state)
        {
            if (!_context.controlIteration || !_context.controlRecordingIteration)
            {
                return;
            }

            var rec = new ElementId("Run_{0}.{1}".Fmt(state.runCount, state.name), "");

            foreach (Type t in _mutators)
            {
                // can add specific mutators here
                if (SupportedState(t, state))
                {
                    var mutator = GetMutatorInstance(t, state);
                    rec.Mutators.Add(mutator);
                }
            }

            if (rec.Mutators.Count > 0)
            {
                _iterations.Add(rec);
            }
        }
Пример #10
0
 /// <summary>
 /// Adds a new iteration
 /// </summary>
 /// <param name="iteration"></param>
 /// <returns></returns>
 private UMLIteration AddIteration(UMLIteration iteration)
 {
     foreach (UMLIteration i in Iterations)
     {
         if (iteration.Name == i.Name)
         {
             i.Owner    = iteration.Owner;
             i.UseCases = iteration.UseCases;
             return(i);
         }
     }
     iteration.Stereotype = Constants.UMLIteration.STEREOTYPE;
     Iterations.Add(iteration);
     return(iteration);
 }
        public void GetIterationsMethod()
        {
            Iterations.Clear();
            if (SelectedTeamProject == null)
            {
                return;
            }

            Status = "Getting iterations for team project " + SelectedTeamProject.Name;

            var itManager = new IterationManager(ConnectionManager.Instance);

            foreach (var iteration in itManager.GetAllIterationsForTeamProject(SelectedTeamProject.Name))
            {
                Iterations.Add(new IterationsViewModel(iteration));
            }
            Status = "All iteration loaded";
        }
Пример #12
0
        private void AddIterations()
        {
            // Add a "none" option - TFS stores the iteration name as the project name
            Iterations.Add(new IterationSummary()
            {
                Name = "None",
                Path = Name,
            });

            foreach (Node iterationNode in _project.IterationRootNodes)
            {
                Iterations.Add(new IterationSummary()
                {
                    Name = iterationNode.Name,
                    Path = iterationNode.Path,
                });
            }
        }
Пример #13
0
        /// <summary>
        /// Inicjalizuje początkową iterację dla zadanych dostawców i odbiorców.
        /// Jeżeli podczas tworzenia instancji solvera nie zostały przekazane dane wejściowe,
        /// po wykonaniu Init należy dodać koszty.
        /// Po wykonaniu Init, brak możliwości definiowania dostawców i odbiorców.
        /// </summary>
        public void Init(JobType a_jobType)
        {
            IterationBase iteracjaStartowa = null;
            var           isUserDataSet    = !(m_userData is null);

            if (!isUserDataSet && (Dostawcy.Count < 1 || Odbiorcy.Count < 1))
            {
                throw new Exception("Przed zainicjowaniem solvera należy dodać conajmniej jednego dostawcę oraz odbiorcę.");
            }

            GridCell[][] grid = isUserDataSet
                     ? m_userData.UnitCostGrid
                     : Utility.CreateEmptyCellGrid(Dostawcy.Count, Odbiorcy.Count);

            if (a_jobType == JobType.TransportCosts)
            {
                var isBalaced = IsBalanced();
                if (!isBalaced)
                {
                    AddVirtualInputData();
                }

                if (!isBalaced && isUserDataSet)
                {
                    RecalculateDataGrid();
                    grid = m_userData.UnitCostGrid;
                }
                iteracjaStartowa = new IterationTransportCosts(grid, JobType.TransportCosts, ++m_iterator);
            }

            if (a_jobType == JobType.Profit)
            {
                var(vDostawca, vOdbiorca) = IterationProfit.CreateVirtualInputData(Dostawcy, Odbiorcy);
                Dostawcy.Add(vDostawca);
                Odbiorcy.Add(vOdbiorca);
                RecalculateDataGrid();
                grid             = m_userData.UnitCostGrid;
                iteracjaStartowa = new IterationProfit(grid, JobType.Profit, ++m_iterator);
            }

            m_startIteration = iteracjaStartowa;
            Iterations.Add(iteracjaStartowa);
            m_isInit = true;
        }
        public async void GetIterationsMethod()
        {
            Iterations.Clear();
            if (SelectedTeamProject == null)
            {
                return;
            }

            Status = "Getting iterations for team project " + SelectedTeamProject.Name;

            WorkHttpClient workClient    = ConnectionManager.Instance.GetClient <WorkHttpClient>();
            var            allIterations = await workClient.GetTeamIterationsAsync(new TeamContext(SelectedTeamProject.Id));

            foreach (var iteration in allIterations)
            {
                Iterations.Add(new IterationsViewModel(iteration));
            }
            Status = "All iteration loaded";
        }
Пример #15
0
    // Update is called once per frame
    void FixedUpdate()
    {
        //Keyboard movement
        float   translation = Input.GetAxis("Vertical") * verSpeed;   //y input
        float   straffe     = Input.GetAxis("Horizontal") * horSpeed; //x input
        Vector2 mvMent      = new Vector2(straffe, translation);      //Save inputs for recording

        translation *= Time.deltaTime;                                //calculate distance
        straffe     *= Time.deltaTime;
        translation  = Mathf.Clamp(translation, translation / 2, translation);
        character.transform.Translate(straffe, 0, translation);

        //Mouse Movement
        var     md        = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y")); //input
        Vector2 mseMvment = md;                                                                    //Save input for recording

        md          = Vector2.Scale(md, new Vector2(sensitivity * smoothing, sensitivity * 2 / 3 * smoothing));
        smoothV.x   = Mathf.Lerp(smoothV.x, md.x, 1f / smoothing);
        smoothV.y   = Mathf.Lerp(smoothV.y, md.y, 1f / smoothing);
        mouseLook  += smoothV;
        mouseLook.y = Mathf.Clamp(mouseLook.y, yConstraints.x, yConstraints.y); //limit how far up and down the player can look

        //Rotate view
        view.transform.localRotation      = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);
        character.transform.localRotation = Quaternion.AngleAxis(mouseLook.x, character.transform.up);

        //record full command
        currRec.Add(next: new Command(mvMent, mseMvment));

        //checks to see if characters are within line of sight of each other
        //int layerMask = 1 << 9;
        //layerMask = ~layerMask;

        //for (int i = 0; i < allRec.Count(); i++)
        //{
        //    Debug.Log("allRec.Count = " + allRec.Count());
        //    Iteration itor = allRec[i];
        //    if (Physics.Linecast(transform.position, itor.avatar.transform.position, layerMask))
        //    {
        //        Debug.Log("No LOS");
        //    }
        //    else
        //    {
        //        Debug.Log("LOS");
        //    }
        //}

        //If next iteration is begun
        if (Input.GetKeyDown("space"))
        {
            //instantiate PastSelf for recorded iteration and save iteration to allRec
            Iteration temp = currRec;                                                                            //create duplicate
            temp.avatar = Instantiate(PastSelf, Spots.startLocator(Level, iterNum), new Quaternion(0, 0, 0, 1)); //instantiate
            temp.avatar.GetComponentInChildren <Camera>().enabled = false;                                       //disable camera to avoid conflicts
            temp.avatar.GetComponent <PastCharacter>().iterNum    = iterNum++;                                   //keep track of and iterate iteration number; MAY BE USEFUL FOR JUMPING BACK ITERATIONS IN CASE OF PARADOX
            temp.avatar.GetComponent <PastCharacter>().inputList  = temp;                                        //apply recorded commands to PastSelf
            allRec.Add(temp);                                                                                    //Add iteration to list of iterations

            //Reset recording iteration
            currRec = new Iteration();

            //place player for next iteration
            character.transform.position      = Spots.startLocator(Level, iterNum);
            character.transform.localRotation = Quaternion.Euler(0, 0, 0);
            mouseLook.y = mouseLook.x = 0;
        }

        //Control of mouse visibility
        if (Input.GetKeyDown("escape")) //free mouse if esc is pressed
        {
            Cursor.lockState = CursorLockMode.None;
        }
        if (Input.GetMouseButtonDown(0)) //hide mouse if game is clicked
        {
            Cursor.lockState = CursorLockMode.Locked;
        }

        //increment timing function
        timer++;
        //after around 3 seconds hide the text
        if (timer >= 180)
        {
            showText = false;
        }
    }
Пример #16
0
        /// <summary>
        /// Rozwiązuje zadanie w iteraciach.
        /// </summary>
        public void Resolve(JobType a_jobType)
        {
            CanByResolve();

            var           attempt  = 0;
            IterationBase iteracja = m_startIteration;
            int?          aktulaneWartoscOptymalna = null;

            OptimalSolutionFound = false;

            iteracja.CalculateGridInit(Dostawcy, Odbiorcy);
            aktulaneWartoscOptymalna = iteracja.IterationResultValue;

            while (!OptimalSolutionFound)
            {
                attempt++;
                var nextStepGrid = iteracja.CalculateNextIteration();

                if (iteracja.Error.IsError)
                {
                    ErrorMessage = iteracja.Error.Message;
                    return;
                }

                if (iteracja.IsOptimal)
                {
                    OptimalSolutionFound = true;
                    continue;
                }

                iteracja = a_jobType == JobType.TransportCosts
                              ? new IterationTransportCosts(nextStepGrid, JobType.TransportCosts, ++m_iterator) as IterationBase
                              : new IterationProfit(nextStepGrid, JobType.Profit, ++m_iterator) as IterationBase;

                iteracja.CalculateIterationResult();
                var zoptymalizowaneWartosc = iteracja.IterationResultValue;

                var express = a_jobType == JobType.TransportCosts
                                    ? aktulaneWartoscOptymalna > zoptymalizowaneWartosc
                                    : aktulaneWartoscOptymalna < zoptymalizowaneWartosc;

                if (express)
                {
                    aktulaneWartoscOptymalna = zoptymalizowaneWartosc;
                    Iterations.Add(iteracja);
                    iteracja.CalculateGrid(Dostawcy, Odbiorcy);

                    if (iteracja.Error.IsError)
                    {
                        ErrorMessage = iteracja.Error.Message;
                        return;
                    }

                    if (attempt >= AttemptsLimit)
                    {
                        ErrorMessage = "Nie udało się wyznaczyć optymalnego rozwiązania w iteracjach. Zweryfikuj wprowadzone dane";
                        return;
                    }
                    continue;
                }
                OptimalSolutionFound = true;
            }
        }