3using System.Collections.Generic;
5using System.Drawing.Imaging;
8using System.Runtime.Serialization;
18 [ServiceContract(SessionMode=SessionMode.Required, CallbackContract=typeof(IXMyCaffeGymUiCallback))]
28 [OperationContract(IsOneWay =
false)]
29 int OpenUi(
string strName,
int nId,
bool bStartRecording =
false);
34 [OperationContract(IsOneWay =
true)]
41 [OperationContract(IsOneWay =
true)]
48 [OperationContract(IsOneWay =
false)]
60 [OperationContract(IsOneWay=
true)]
75 bool m_bRequireDisplayImage =
false;
86 public Observation(Bitmap imgDisp, Bitmap img,
bool bRequireDisplayImg,
double[] rgState,
double dfReward,
bool bDone)
89 m_dfReward = dfReward;
92 m_imgDisplay = imgDisp;
93 m_bRequireDisplayImage = bRequireDisplayImg;
102 Bitmap bmp = (m_img ==
null) ?
null :
new Bitmap(m_img);
103 Bitmap bmpDisp = (m_imgDisplay ==
null) ?
null :
new Bitmap(m_imgDisplay);
104 double[] rgState =
new double[m_rgState.Length];
105 Array.Copy(m_rgState, rgState, rgState.Length);
107 return new Observation(bmpDisp, bmp, m_bRequireDisplayImage, rgState, m_dfReward, m_bDone);
116 get {
return m_rgState; }
117 set { m_rgState = value; }
126 get {
return m_img; }
127 set { m_img = value; }
136 get {
return m_imgDisplay; }
137 set { m_imgDisplay = value; }
146 get {
return m_bRequireDisplayImage; }
147 set { m_bRequireDisplayImage = value; }
156 get {
return m_dfReward; }
157 set { m_dfReward = value; }
166 get {
return m_bDone; }
167 set { m_bDone = value; }
The Observation contains data describing the Gym as it runs.
bool RequireDisplayImage
Get/set whether or not the image for display (ImageDisplay) is required.
Bitmap ImageDisplay
Get/set the image to display.
bool Done
Get/set the done state.
double Reward
Get/set the reward.
Observation(Bitmap imgDisp, Bitmap img, bool bRequireDisplayImg, double[] rgState, double dfReward, bool bDone)
The constructor.
Bitmap Image
Get/set the action image, if it exists.
Observation Clone()
Returns a copy of the Observation.
The State class defines an abstract base class for the state information and gym data.
The IXMyCaffeGymUiCallback is used to interact with the user of the IXMyCaffeGymUiService interface.
void Closing()
The Closing method is called when closing the Gym user interface.
The IXMYCaffeGymUiService interface provides access to the MyCaffeGymUiService used to display the vi...
bool IsOpen(int nId)
Returns true when the visualization is open, false otherwise.
int OpenUi(string strName, int nId, bool bStartRecording=false)
Open the user interface of a Gym.
void Render(int nId, Observation obs)
Render an observation on the Gym user-interface.
void CloseUi(int nId)
Close the user interface of a Gym.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.gym namespace contains all classes related to the Gym's supported by MyCaffe.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...