Пример #1
0
        //НЕЧЕТКИЕ ФУНКЦИИ
        public static int Calc(double[][] arr)
        {
            Input inp = new inputs();

            //Function[] func;
            Function[] func = new Function[6] {
                new mS(), new mMS(), new mP(), new mVS(), new mS(), new mUS()
            };
            int STATUS = -1;

            try
            {
                Facade f = new Facade(true, true, true);

                inp.initFunc(func);

                Matrix   M = f.calcD(inp.makeRules(arr));
                double[] C = f.calcC(M);

                STATUS = f.getBest(C);

                Console.WriteLine("THE BEST:{0}", STATUS);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }
            return(STATUS);
        }
Пример #2
0
        private static bool uploadToOrg(inputs theInputs, string csv)
        {
            string filename  = "buildUsageReport_" + String.Format("{0:MM-dd-yyyy}", DateTime.Now) + ".csv";
            string baseUrl   = $"https://dev.azure.com/{theInputs.Org}/{theInputs.project}/_apis/wit/";
            string attachUrl = $"attachments?fileName={filename}&api-version=5.1";
            string linkUrl   = $"workitems/{theInputs.witID}?api-version=5.1";

            // first we must upload the file to Azure DevOps
            string response = RunPostAPI(theInputs.Pat, baseUrl + attachUrl, csv);

            if (!string.IsNullOrEmpty(response))
            {
                // response is not null so the upload was successful
                uploadAttachmentResponse attach = JsonConvert.DeserializeObject <uploadAttachmentResponse>(response);

                // then we can link the work item to the uploaded file
                workItemLink link = new workItemLink();
                link.rel        = "AttachedFile";
                link.url        = attach.url;
                link.attributes = new attribute("Adding CSV report to work item");
                object[] patchDocument = new object[1];
                patchDocument[0] = new { op = "add", path = "/relations/-", value = link };
                bool success = RunPatchAPI(theInputs.Pat, baseUrl + linkUrl, patchDocument);

                // return true if we successfully linked the work item, false if not
                return(success ? true : false);
            }
            else
            {
                // response was null so upload failed
                return(false);
            }
        }
Пример #3
0
        private static inputCheck InvalidInputs(inputs theInputs, ILogger log)
        {
            inputCheck ic = new inputCheck();

            ic.failed = false;

            if (string.IsNullOrEmpty(theInputs.Pat))
            {
                log.LogInformation("PAT is null");
                ic.failed    = true;
                ic.Field     = "PAT";
                ic.HowFailed = "null or missing";
                return(ic);
            }
            else if (string.IsNullOrEmpty(theInputs.Org))
            {
                log.LogInformation("Org is null");
                ic.failed    = true;
                ic.Field     = "Org";
                ic.HowFailed = "null or missing";
                return(ic);
            }
            else if (string.IsNullOrEmpty(theInputs.scope))
            {
                log.LogInformation("Scope is null");
                ic.failed    = true;
                ic.Field     = "Scope";
                ic.HowFailed = "null or missing";
                return(ic);
            }
            else if (string.IsNullOrEmpty(theInputs.witID))
            {
                log.LogInformation("witID is null");
                ic.failed    = true;
                ic.Field     = "witID";
                ic.HowFailed = "null or missing";
                return(ic);
            }
            else if (string.IsNullOrEmpty(theInputs.project))
            {
                log.LogInformation("Project is null");
                ic.failed    = true;
                ic.Field     = "Project";
                ic.HowFailed = "null or missing";
                return(ic);
            }
            else
            {
                // nothing was wrong with the input
                return(ic);
            }
        }
Пример #4
0
        private static List <projectDetails> getProjects(inputs theInputs)
        {
            // get all the projects in the org
            string url = $"https://dev.azure.com/{theInputs.Org}/_apis/projects?api-version=5.1";

            string response = RunGetAPI(theInputs.Pat, url);

            if (!string.IsNullOrEmpty(response))
            {
                project ret = JsonConvert.DeserializeObject <project>(response);
                return(ret.value);
            }
            else
            {
                return(null);
            }
        }
Пример #5
0
    static void Main(String[] args)
    {
        bool isInitialized = false;

        String[] arrInputs = new String[6];
        inputs   myInputs  = new inputs();

        while (true)
        {
            if (!isInitialized)
            {
                int length;
                length = Convert.ToInt32(Console.ReadLine());
                for (int i = 0; i < length; i++)
                {
                    myInputs.addGroundCoordinates(Console.ReadLine());
                }
                isInitialized = true;
            }
            else
            {
                arrInputs   = Console.ReadLine().Split(' ');
                myInputs.X  = Convert.ToInt32(arrInputs[0]);
                myInputs.Y  = Convert.ToInt32(arrInputs[1]);
                myInputs.HS = Convert.ToInt32(arrInputs[2]);
                myInputs.VS = Convert.ToInt32(arrInputs[3]);
                myInputs.F  = Convert.ToInt32(arrInputs[4]);
                myInputs.R  = Convert.ToInt32(arrInputs[5]);
                myInputs.P  = Convert.ToInt32(arrInputs[6]);

                Console.WriteLine(myInputs.calculateOutput());
                Console.Error.WriteLine("Coordinates: " + myInputs.Coordinates);
                Console.Error.WriteLine(String.Join(" ", arrInputs));
                //Console.Error.WriteLine(myInputs.rotation + " " + myInputs.power);

                Console.Error.WriteLine("TargetX1: " + myInputs.TargetX + " TargetX2: " + myInputs.TargetX2);

                //Console.WriteLine("-20 3");
            }
        }
    }
Пример #6
0
        private static List <buildDetails> getBuilds(List <projectDetails> projects, inputs theInputs)
        {
            List <buildDetails> builds = new List <buildDetails>();

            // get the builds for the last 30 days
            string startDate = string.Format("{0:M-d-yyyy}", DateTime.Now.AddDays(-30));

            foreach (projectDetails p in projects)
            {
                string url = $"https://dev.azure.com/{theInputs.Org}/{p.name}/_apis/build/builds?minTime={startDate}&api-version=5.1";

                string response = RunGetAPI(theInputs.Pat, url);
                if (!string.IsNullOrEmpty(response))
                {
                    build ret = JsonConvert.DeserializeObject <build>(response);

                    // set the project name for all the builds and then append to our master list
                    builds.AddRange(ret.value.Select(c => { c.theproject = p.name; return(c); }).ToList());
                }
            }

            return(builds);
        }
Пример #7
0
 => new RawStochasticsValueByTuple(inputs, periodCount).Compute(startIndex, endIndex);
Пример #8
0
 => new ParabolicStopAndReverseByTuple(inputs, step, maximumStep).Compute(startIndex, endIndex);
Пример #9
0
    static void Main(String[] args)
    {
        bool isInitialized = false;
        String[] arrInputs = new String[6];
        inputs myInputs = new inputs();

        while (true) {

            if(!isInitialized) {
                int length;
                length = Convert.ToInt32(Console.ReadLine());
                for(int i=0; i < length; i++) {
                    myInputs.addGroundCoordinates(Console.ReadLine());
                }
                isInitialized = true;
            }
            else {
                arrInputs = Console.ReadLine().Split(' ');
                myInputs.X = Convert.ToInt32(arrInputs[0]);
                myInputs.Y = Convert.ToInt32(arrInputs[1]);
                myInputs.HS = Convert.ToInt32(arrInputs[2]);
                myInputs.VS = Convert.ToInt32(arrInputs[3]);
                myInputs.F = Convert.ToInt32(arrInputs[4]);
                myInputs.R = Convert.ToInt32(arrInputs[5]);
                myInputs.P = Convert.ToInt32(arrInputs[6]);

                Console.WriteLine(myInputs.calculateOutput());
                Console.Error.WriteLine("Coordinates: " + myInputs.Coordinates);
                Console.Error.WriteLine(String.Join(" ",arrInputs));
                //Console.Error.WriteLine(myInputs.rotation + " " + myInputs.power);

                Console.Error.WriteLine("TargetX1: " + myInputs.TargetX + " TargetX2: " + myInputs.TargetX2);

                //Console.WriteLine("-20 3");
            }
        }
    }
Пример #10
0
 => new MovingAverageConvergenceDivergenceByTuple(inputs, emaPeriodCount1, emaPeriodCount2, demPeriodCount).Compute(startIndex, endIndex);
Пример #11
0
 Solve(inputs, taskExecutor);
Пример #12
0
    // Use this for initialization
    void Start()
    {
        #region PlayerPrefs Options
        volume = PlayerPrefs.GetFloat("Volume", volume);
        if (PlayerPrefs.HasKey("Volume"))
        {
            AudioListener.volume = PlayerPrefs.GetFloat("Volume");
        }
        else
        {
            PlayerPrefs.SetFloat("Volume", volume);
        }

        son = PlayerPrefs.GetInt("son", son);
        if (PlayerPrefs.HasKey("son"))
        {
            son = PlayerPrefs.GetInt("son", son);
            switch (son)
            {
            case 0:
                AudioSettings.speakerMode = AudioSpeakerMode.Mono;
                break;

            case 1:
                AudioSettings.speakerMode = AudioSpeakerMode.Stereo;
                break;

            case 2:
                AudioSettings.speakerMode = AudioSpeakerMode.Quad;
                break;

            case 3:
                AudioSettings.speakerMode = AudioSpeakerMode.Surround;
                break;

            case 4:
                AudioSettings.speakerMode = AudioSpeakerMode.Mode5point1;
                break;

            case 5:
                AudioSettings.speakerMode = AudioSpeakerMode.Mode7point1;
                break;
            }
        }
        else
        {
            PlayerPrefs.SetInt("son", son);
        }

        qualite_image = PlayerPrefs.GetInt("qualite_image", qualite_image);
        if (PlayerPrefs.HasKey("qualite_image"))
        {
            qualite_image = PlayerPrefs.GetInt("qualite_image", qualite_image);
            QualitySettings.SetQualityLevel(qualite_image);
        }
        else
        {
            PlayerPrefs.SetInt("qualite_image", qualite_image);
        }

        aliasing = PlayerPrefs.GetInt("aliasing", aliasing);
        if (PlayerPrefs.HasKey("aliasing"))
        {
            aliasing = PlayerPrefs.GetInt("aliasing", aliasing);
            switch (aliasing)
            {
            case 0:
                QualitySettings.antiAliasing = 0;
                break;

            case 1:
                QualitySettings.antiAliasing = 2;
                break;

            case 2:
                QualitySettings.antiAliasing = 4;
                break;

            case 3:
                QualitySettings.antiAliasing = 8;
                break;
            }
        }
        else
        {
            PlayerPrefs.SetInt("aliasing", aliasing);
        }

        anisotropic = PlayerPrefs.GetInt("anisotropic", anisotropic);
        if (PlayerPrefs.HasKey("anisotropic"))
        {
            qualite_image = PlayerPrefs.GetInt("anisotropic", anisotropic);
            switch (anisotropic)
            {
            case 0:
                QualitySettings.anisotropicFiltering = AnisotropicFiltering.Disable;
                break;

            case 1:
                QualitySettings.anisotropicFiltering = AnisotropicFiltering.Enable;
                break;

            case 2:
                QualitySettings.anisotropicFiltering = AnisotropicFiltering.ForceEnable;
                break;
            }
        }
        else
        {
            PlayerPrefs.SetInt("anisotropic", anisotropic);
        }
        #endregion

        if (mode_jeu == 1)
        {
            #region setup un joueur
            nb_joueur = PlayerPrefs.GetInt("nb_ia", nb_joueur);
            if (PlayerPrefs.HasKey("nb_ia"))
            {
                nb_joueur = PlayerPrefs.GetInt("nb_ia", nb_joueur);
            }
            else
            {
                PlayerPrefs.SetInt("nb_ia", nb_joueur);
            }

            nb_joueur++;

            all_spaceships = new GameObject[nb_joueur];

            choix = PlayerPrefs.GetInt("player", choix);
            if (PlayerPrefs.HasKey("player"))
            {
                choix = PlayerPrefs.GetInt("player", choix);
            }
            else
            {
                PlayerPrefs.SetInt("player", choix);
            }

            System.Random rnd = new System.Random();
            Vector3       pos = Vector3.zero;
            pos.Set(rnd.Next(-100, 100), rnd.Next(-10, 50), rnd.Next(-100, 100));

            //joueur
            switch (choix)
            {
            case 1:
                all_spaceships[0] = Instantiate(vaisseau1, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                break;

            case 2:
                all_spaceships[0] = Instantiate(vaisseau2, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                break;

            case 3:
                all_spaceships[0] = Instantiate(vaisseau3, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                break;

            default:
                all_spaceships[0] = Instantiate(vaisseau1, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                break;
            }


            //IAs
            for (int i = 1; i < nb_joueur; i++)
            {
                pos = Vector3.zero;
                pos.Set(rnd.Next(-100, 100), rnd.Next(-10, 50), rnd.Next(-100, 100));

                try
                {
                    switch (rnd.Next(0, 3))
                    {
                    case 0:
                        all_spaceships[i] = Instantiate(IA1, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                        break;

                    case 1:
                        all_spaceships[i] = Instantiate(IA2, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                        break;

                    case 2:
                        all_spaceships[i] = Instantiate(IA3, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                        break;

                    default:
                        all_spaceships[i] = Instantiate(IA1, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                        break;
                    }
                }
                catch { }
            }

            Camera        first        = all_spaceships[0].GetComponentInChildren <Camera>();
            controlcamera firstcontrol = first.GetComponent <controlcamera>();
            firstcontrol.vvv = this.all_spaceships;

            for (int i = 0; i < all_spaceships.Length; i++)
            {
                vie life = all_spaceships[i].GetComponent <vie>();
                if (life == null)
                {
                    life = all_spaceships[i].GetComponentInChildren <vie>();
                }

                life.global_cam     = this.camera;
                life.all_spaceships = this.all_spaceships;
                if (i == 0)
                {
                    life.name = "player";
                }
                else
                {
                    life.name = "computer " + i;
                }
            }
            #endregion
        }
        else if (mode_jeu == 2)
        {
            #region ecran splite
            nb_joueur = PlayerPrefs.GetInt("nb_ia", nb_joueur);
            if (PlayerPrefs.HasKey("nb_ia"))
            {
                nb_joueur = PlayerPrefs.GetInt("nb_ia", nb_joueur);
            }
            else
            {
                PlayerPrefs.SetInt("nb_ia", nb_joueur);
            }

            nb_joueur += 2;
            //aDebug.Log("nb joueur " + nb_joueur);

            all_spaceships = new GameObject[nb_joueur];

            choix = PlayerPrefs.GetInt("player", choix);
            if (PlayerPrefs.HasKey("player"))
            {
                choix = PlayerPrefs.GetInt("player", choix);
            }
            else
            {
                PlayerPrefs.SetInt("player", choix);
            }

            System.Random rnd = new System.Random();
            Vector3       pos = Vector3.zero;
            pos.Set(rnd.Next(-100, 100), rnd.Next(-10, 50), rnd.Next(-100, 100));

            //joueur
            switch (choix)
            {
            case 1:
                all_spaceships[0] = Instantiate(vaisseau1, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                all_spaceships[1] = Instantiate(vaisseau1, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                break;

            case 2:
                all_spaceships[0] = Instantiate(vaisseau2, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                all_spaceships[1] = Instantiate(vaisseau2, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                break;

            case 3:
                all_spaceships[0] = Instantiate(vaisseau3, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                all_spaceships[1] = Instantiate(vaisseau3, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                break;

            default:
                all_spaceships[0] = Instantiate(vaisseau1, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                all_spaceships[1] = Instantiate(vaisseau1, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                break;
            }

            //IAs
            for (int i = 2; i < nb_joueur; i++)
            {
                pos = Vector3.zero;
                pos.Set(rnd.Next(-100, 50), rnd.Next(-10, 50), rnd.Next(-100, 100));

                switch (rnd.Next(0, 3))
                {
                case 0:
                    all_spaceships[i] = Instantiate(IA1, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                    break;

                case 1:
                    all_spaceships[i] = Instantiate(IA2, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                    break;

                case 2:
                    all_spaceships[i] = Instantiate(IA3, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                    break;

                default:
                    all_spaceships[i] = Instantiate(IA1, pos, Quaternion.AngleAxis(0, Vector3.left)) as GameObject;
                    break;
                }
            }

            Camera first = all_spaceships[0].GetComponentInChildren <Camera>();
            first.rect = new Rect(0, 0, 1f, 0.5f);
            controlcamera firstcontrol = first.GetComponent <controlcamera>();
            firstcontrol.vvv = this.all_spaceships;
            inputs toucheplayer1 = all_spaceships[0].GetComponentInChildren <inputs>();
            toucheplayer1.i = 1;

            Camera second = all_spaceships[1].GetComponentInChildren <Camera>();
            second.rect = new Rect(0, 0.5f, 1f, 0.5f);
            second.GetComponent <AudioListener>().enabled = false;
            controlcamera secondcontrol = second.GetComponent <controlcamera>();
            secondcontrol.vvv = this.all_spaceships;
            inputs toucheplayer2 = all_spaceships[1].GetComponentInChildren <inputs>();
            toucheplayer2.i = 2;



            for (int i = 0; i < all_spaceships.Length; i++)
            {
                vie life = all_spaceships[i].GetComponent <vie>();
                if (life == null)
                {
                    life = all_spaceships[i].GetComponentInChildren <vie>();
                }

                life.global_cam     = this.camera;
                life.all_spaceships = this.all_spaceships;
                if (i <= 1)
                {
                    life.name = "player " + (i + 1);
                }
                else
                {
                    life.name = "computer " + (i - 1);
                }
            }
            #endregion
        }
        else if (mode_jeu == 3)
        {
            #region multijoueur
            menu  = 0;
            choix = PlayerPrefs.GetInt("player", choix);

            if (PlayerPrefs.HasKey("player"))
            {
                choix = PlayerPrefs.GetInt("player", choix);
            }
            else
            {
                PlayerPrefs.SetInt("player", choix);
            }
            #endregion
        }
    }
Пример #13
0
 => new ChandelierExitByTuple(inputs, periodCount, atrCount).Compute(startIndex, endIndex);
Пример #14
0
 => new IchimokuCloudByTuple(inputs, shortPeriodCount, middlePeriodCount, longPeriodCount).Compute(startIndex, endIndex);
Пример #15
0
 => new AverageDirectionalIndexRatingByTuple(inputs, periodCount, adxrPeriodCount).Compute(startIndex, endIndex);
Пример #16
0
 => new BollingerBandsByTuple(inputs, periodCount, sdCount).Compute(startIndex, endIndex);
Пример #17
0
 => new StochasticsMomentumIndexByTuple(inputs, periodCount, smoothingPeriodA, smoothingPeriodB).Compute(startIndex, endIndex);
Пример #18
0
 public machine(ref ptr <Regexp> re = default, ref ptr <syntax.Prog> p = default, queue q0 = default, queue q1 = default, slice <ptr <thread> > pool = default, bool matched = default, slice <long> matchcap = default, inputs inputs = default)
 {
     this.re       = re;
     this.p        = p;
     this.q0       = q0;
     this.q1       = q1;
     this.pool     = pool;
     this.matched  = matched;
     this.matchcap = matchcap;
     this.inputs   = inputs;
 }
Пример #19
0
 InitializeNetwork(inputs, hiddenLayers, outputs, true);
Пример #20
0
 public onePassMachine(inputs inputs = default, slice <long> matchcap = default)
 {
     this.inputs   = inputs;
     this.matchcap = matchcap;
 }
Пример #21
0
 Func <double[], double[], double> distance) => Train(k, classes, inputs, outputs, distance);
Пример #22
0
 => new AroonOscillatorByTuple(inputs, periodCount).Compute(startIndex, endIndex);
Пример #23
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            log.LogInformation("Begin BuildsTriggeredPerUser function");

            // read the request body
            string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            inputs theInputs   = JsonConvert.DeserializeObject <inputs>(requestBody);

            theInputs.Pat   = Environment.GetEnvironmentVariable("pat");
            theInputs.scope = theInputs.scope.ToLower();

            // check that all required parameters are present
            inputCheck ic = InvalidInputs(theInputs, log);

            if (ic.failed)
            {
                // at least one input was missing, inform user and end
                log.LogInformation($"The parameter \"{ic.Field}\" is {ic.HowFailed}");
                return(new BadRequestObjectResult($"The parameter \"{ic.Field}\" is {ic.HowFailed}"));
            }
            else
            {
                // all inputs are present, proceed with getting the builds

                // first get all the projects in the org
                List <projectDetails> projects = getProjects(theInputs);

                // quick error check
                if (projects == null)
                {
                    log.LogInformation("GetProjects API failed");
                    return(new BadRequestObjectResult("Unable to retrieve projects - API call unsuccessful"));
                }

                // next, get the builds
                List <buildDetails> builds = getBuilds(projects, theInputs);

                // count the builds per user
                // using SortedDictionary here to ensure columns line up correctly for CSV
                SortedDictionary <string, SortedDictionary <string, int> > usage = getUsage(builds, theInputs.scope);

                // check if we found any users who performed builds
                if (usage.Count > 0)
                {
                    // create CSV report
                    string csv     = createCSV(usage);
                    bool   success = uploadToOrg(theInputs, csv);
                    if (success)
                    {
                        log.LogInformation("Successfully uploaded the report");
                        return(new OkObjectResult($"CSV Uploaded Successfully"));
                    }
                    else
                    {
                        // inform that we failed to upload the report to Azure DevOps
                        log.LogInformation("Failed to upload the report");
                        return(new BadRequestObjectResult("Failed to upload the report"));
                    }
                }
                else
                {
                    // inform that no usage was found
                    log.LogInformation("Didn't find any build usage");
                    return(new BadRequestObjectResult("No Usage Found"));
                }
            }
        }
Пример #24
0
 => new AverageTrueRangeByTuple(inputs, periodCount).Compute(startIndex, endIndex);
Пример #25
0
 public bitState(long end = default, slice <long> cap = default, slice <long> matchcap = default, slice <job> jobs = default, slice <uint> visited = default, inputs inputs = default)
 {
     this.end      = end;
     this.cap      = cap;
     this.matchcap = matchcap;
     this.jobs     = jobs;
     this.visited  = visited;
     this.inputs   = inputs;
 }
Пример #26
0
 => new CommodityChannelIndexByTuple(inputs, periodCount).Compute(startIndex, endIndex);
Пример #27
0
 => new KeltnerChannelsByTuple(inputs, periodCount, sdCount, atrPeriodCount).Compute(startIndex, endIndex);
Пример #28
0
 => new DirectionalMovementIndexByTuple(inputs, periodCount).Compute(startIndex, endIndex);
Пример #29
0
 => new VolumeWeightedAveragePriceByTuple(inputs, period).Compute(startIndex, endIndex);
Пример #30
0
 => new MinusDirectionalIndicatorByTuple(inputs, periodCount).Compute(startIndex, endIndex);
 return(new FFmpegCommand(
            inputs: ImmutableList.CreateRange(