3using System.Collections.Generic;
8using System.Threading.Tasks;
17 List<IXMyCaffeGym> m_rgGym =
new List<IXMyCaffeGym>();
34 public List<Exception>
Load()
42 return addCustomGyms();
45 private List<Exception> addCustomGyms()
47 string codeBase = Assembly.GetExecutingAssembly().CodeBase;
48 UriBuilder uri =
new UriBuilder(codeBase);
49 string path = Uri.UnescapeDataString(uri.Path);
50 string strPath = Path.GetDirectoryName(path);
51 List<Exception> rgErr =
new List<Exception>();
53 strPath +=
"\\CustomGyms";
55 if (Directory.Exists(strPath))
57 string[] rgstrFiles = Directory.GetFiles(strPath);
59 foreach (
string strFile
in rgstrFiles)
61 FileInfo fi =
new FileInfo(strFile);
63 if (fi.Extension.ToLower() ==
".dll")
71 else if (excpt !=
null)
82 private IXMyCaffeGym loadCustomGym(
string strFile, out Exception err)
88 Assembly a = Assembly.LoadFile(strFile);
89 AssemblyName aName = a.GetName();
91 foreach (Type t
in a.GetTypes())
93 Type[] rgT = t.GetInterfaces();
95 foreach (Type iface
in rgT)
97 string strIface = iface.ToString();
98 if (strIface.Contains(
"IXMyCaffeGym"))
100 object obj = Activator.CreateInstance(t);
101 return obj as IXMyCaffeGym;
108 catch (Exception excpt)
110 if (excpt is
System.Reflection.ReflectionTypeLoadException)
112 var typeLoadException = excpt as ReflectionTypeLoadException;
113 var loaderExceptions = typeLoadException.LoaderExceptions;
115 if (loaderExceptions !=
null && loaderExceptions.Length > 0)
116 excpt =
new Exception(
"Gym '" + strFile +
"' failed to load!", loaderExceptions[0]);
132 int nPos = strName.IndexOf(
':');
134 strName = strName.Substring(0, nPos);
138 if (igym.
Name == strName)
151 return m_rgGym.GetEnumerator();
158 IEnumerator IEnumerable.GetEnumerator()
160 return m_rgGym.GetEnumerator();
The Atari Gym provides acess to the Atari-2600 Emulator from Stella (https://github....
The CartPole Gym provides a simulation of a cart with a balancing pole standing on top of it.
The Curve Gym provides a simulation of continuous curve such as Sin or Cos.
The DataGeneral Gym provides access to the MyCaffe Streaming Database with GENERAL query types.
The GymCollection contains the available Gyms.
GymCollection()
The constructor.
List< Exception > Load()
Loads the default and dynamic gyms.
IXMyCaffeGym Find(string strName)
Search for a given Gym by its name.
IEnumerator< IXMyCaffeGym > GetEnumerator()
Returns the collections enumerator.
The Model Gym runs a given Project over the dataset specified within the project where each step adva...
The IXMyCaffeGym interface is used to interact with each Gym.
string Name
Returns the name of the gym.
The MyCaffe.gym namespace contains all classes related to the Gym's supported by MyCaffe.