Beispiel #1
0
        static Offset <FObjective> Serialise(FlatBufferBuilder b, EnvironmentDescription description)
        {
            var ob_name = "None";
            var ep_len  = -1;
            var a       = 0;
            var f       = 0f;
            var c       = 0f;
            var d       = false;

            if (description.ObjectiveFunction != null)
            {
                ob_name = description.ObjectiveFunction.Identifier;
                ep_len  = description.ObjectiveFunction.EpisodeLength;
                f       = description.ObjectiveFunction.SignalSpace.Min;
                c       = description.ObjectiveFunction.SignalSpace.Max;
                a       = description.ObjectiveFunction.SignalSpace.DecimalGranularity;
                d       = description.ObjectiveFunction.SignalSpace.NormalisedBool;
            }

            var objective_name_offset = b.CreateString(ob_name);

            FObjective.StartFObjective(b);
            FObjective.AddMaxEpisodeLength(b, ep_len);
            FObjective.AddSignalSpace(b,
                                      FRange.CreateFRange(b,
                                                          a,
                                                          f,
                                                          c,
                                                          d));
            FObjective.AddObjectiveName(b, objective_name_offset);
            return(FObjective.EndFObjective(b));
        }
Beispiel #2
0
        static Offset <FObjective> build_objective(FlatBufferBuilder b, EnvironmentDescription description)
        {
            var objective_name_offset = b.CreateString("Default objective");

            FObjective.StartFObjective(b);
            FObjective.AddMaxEpisodeLength(b, description.MaxSteps);
            FObjective.AddSolvedThreshold(b, description.SolvedThreshold);
            FObjective.AddObjectiveName(b, objective_name_offset);
            return(FObjective.EndFObjective(b));
        }