#ifndef FPAUNKNOWN_HPP
#define FPAUNKNOWN_HPP
#include "bceabstractgame.hpp"
{
private:
int numValues;
double entryCost;
double reservePrice;
double highbid;
double lowbid;
public:
FPAUnknown(int na, int nv, double _alpha,
double _highbid,double _reservePrice,double _entryCost)
entryCost(_entryCost), highbid(_highbid),
lowbid(0.0), reservePrice(_reservePrice)
{
}
int getNumValues(){return numValues;} const
int stateToPrivateValues(int state, vector<int> &values) const
{
values.resize(2);
values[0]=state%numValues;
state-=values[0];
values[1]=state/numValues;
}
double prior (
int state,
const vector<int> &types)
const
{
vector<int> values;
stateToPrivateValues(state,values);
double v0 = static_cast<double>(values[0]+1)/numValues;
double v1 = static_cast<double>(values[1]+1)/numValues;
double incr = 1.0/numValues;
if (numValues == 2)
{
double p = 0.25;
if (v0 == 1 && v1 == 0
|| v0 == 0 && v1 == 1)
return p;
return (1.0-2*p)/2.0;
}
return distribution.
PDF(v0,v1,incr);
}
double objective(
int state,
const vector<int> &actions,
int objectiveIndex)
const
{
vector<int> values(2,0);
stateToPrivateValues(state,values);
double obj = 0;
double winbid = (actions[0]>actions[1]? actions[0]: actions[1])
* (highbid-lowbid) / (numActions[0]-1.0) + lowbid;
if (winbid < reservePrice)
return 0.0;
if (objectiveIndex < 2)
{
int player = objectiveIndex;
double mybid = lowbid
+ (highbid-lowbid)*actions[player]/(numActions[player]-1.0);
if (actions[player]>actions[1-player]
|| (actions[player]==actions[1-player]
&& values[player]>values[1-player]))
obj = (1.0*values[player]/(numValues-1.0)-mybid);
else if (actions[player]==actions[1-player]
&& values[player]==values[1-player])
obj = (1.0*values[player]/(numValues-1.0)-mybid)/2.0;
obj -= (actions[player]>0? entryCost : 0.0);
}
else if (objectiveIndex==2)
{
obj = winbid;
obj += (actions[0]>0? entryCost : 0.0);
obj += (actions[1]>0? entryCost : 0.0);
}
return obj;
}
bool dominated(
int a,
int t,
int player)
const
{
return false;
}
};
#endif
The base class for games of incomplete information.
Definition: bceabstractgame.hpp:52
virtual bool dominated(int action, int type, int player) const
Indicates if a combination of actions and types is dominated.
Definition: bceabstractgame.hpp:164
bool setNumPrivateStates(const vector< int > &_numPrivateStates)
Definition: bceabstractgame.hpp:187
virtual double objective(int state, const vector< int > &actions, int obj) const =0
Objective function.
void setHasProductStructureData(bool hasProductStructure)
Allows user to specify if the game has a product structure.
Definition: bceabstractgame.hpp:108
virtual double prior(int state, const vector< int > &types) const =0
Prior over state and types.
BCEAbstractGame()
Default constructor.
Definition: bceabstractgame.cpp:25
Weighted sum of distributions.
Definition: bcedistr.hpp:71
bool push_back(BCEDistr *newDistr, double newWeight)
Add a new distribution to the array.
Definition: bcedistr.hpp:97
double PDF(double v0, double incr0, double v1, double incr1) const
Discretized PDF for the BCEDistr.
Definition: bcedistr.hpp:47
CDF is of the form .
Definition: bcedistr.hpp:352