FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > > Class Template Reference

A ProblemInterface that does not require the use of the XCSP format. More...

Inheritance diagram for frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >:

Public Member Functions

 Problem (boolean maximize)
 Constructor.
 Problem (boolean maximize, boolean publicAgents, boolean mpc, boolean extendedRandNeighborhoods)
 Constructor.
 Problem (String agentName, Set< String > agents, Map< String, String > owners, Map< String, V[]> domains, Set< String > randVars, List< ? extends UtilitySolutionSpace< V, U > > spaces, Map< String, ? extends UtilitySolutionSpace< V, U > > probSpaces, Map< String, Set< String > > varScopes, Class< V > domClass, Class< U > utilClass)
 Constructor for a minimization problem.
 Problem (String agentName, Set< String > agents, Map< String, String > owners, Map< String, V[]> domains, Set< String > randVars, List< ? extends UtilitySolutionSpace< V, U > > spaces, Map< String, ? extends UtilitySolutionSpace< V, U > > probSpaces, Map< String, Set< String > > varScopes, Class< V > domClass, Class< U > utilClass, boolean maximize)
 Constructor.
String toString ()
void reset (ProblemInterface< V, U > newProblem)
void reset (String agentName, Set< String > agents, Map< String, String > owners, Map< String, V[]> domains, Set< String > randVars, List< ? extends UtilitySolutionSpace< V, U > > spaces, Map< String, ? extends UtilitySolutionSpace< V, U > > probSpaces, Map< String, Set< String > > varScopes, Class< V > domClass, Class< U > utilClass, boolean maximize)
 Resets the problem.
void setDomClass (Class< V > domClass)
Class< V > getDomClass ()
void setAgent (String agent)
 Sets the name of the agent.
Set< String > getExtVars ()
boolean addVariable (String name, String owner, String domain)
boolean addVariable (String name, String owner, V[] domain)
boolean addRandomVar (String name, V[] domain)
 Adds a random variable.
boolean setOwner (String var, String owner)
void setDomain (String var, V[] dom)
List< UtilitySolutionSpace< V, U > > getProbabilitySpaces ()
Map< String, ? extends UtilitySolutionSpace< V, U > > getProbabilitySpacePerRandVar ()
List< UtilitySolutionSpace< V, U > > getProbabilitySpaces (String var)
void setProbSpace (String var, Map< V, Double > prob)
boolean removeSpace (String name)
boolean addSolutionSpace (UtilitySolutionSpace< V, U > space)
void addProbabilitySpace (String randVar, UtilitySolutionSpace< V, U > prob)
 Adds a probability space for a given variable.
void incrNCCCs (long incr)
void setNCCCs (long ncccs)
long getNCCCs ()
void rescale (U multiply, U add)
UtilitySolutionSpace< V, U > getUtility (Map< String, V > assignments, boolean withAnonymVars)
UtilitySolutionSpace< V, U > getExpectedUtility (Map< String, V > assignments)
UtilitySolutionSpace< V, U > getParamUtility (Map< String[], BasicUtilitySolutionSpace< V, ArrayList< V > > > assignments)
Problem< V, U > getSubProblem (String agent)
boolean multipleTypes ()
void ground (String var, V val)
Public Member Functions inherited from frodo2.algorithms.AbstractProblem< V, U >
String toString ()
String getAgent ()
Set< String > getVariables (final String owner)
V[] getDomain (String var)
int getDomainSize (String var)
Map< String, Set< String > > getNeighborhoods ()
Map< String, Set< String > > getAnonymNeighborhoods ()
Map< String, Integer > getNeighborhoodSizes ()
int getNbrNeighbors (String var)
HashSet< String > getNeighborVars (String var)
int getNumberOfCoordinationConstraints ()
Map< String, Set< String > > getAgentNeighborhoods ()
Map< String, Set< String > > getVarScopes ()
void setAgent (String name)
 Sets the name of the agent owning this subproblem.
Set< String > getAgents ()
Class< U > getUtilClass ()
getMinInfUtility ()
getPlusInfUtility ()
int getNbrVars ()
int getNbrIntVars ()
Map< String, String > getOwners ()
String getOwner (String var)
boolean isRandom (String var)
List< ? extends UtilitySolutionSpace< V, U > > getSolutionSpaces ()
UtilitySolutionSpace< V, U > getUtility (Map< String, V > assignments)
Set< String > getMyVars ()
Set< String > getAnonymVars ()
Set< String > getRandVars ()
Set< String > getAllVars ()
getZeroUtility ()
void setMaximize (final boolean maximize)
void setUtilClass (Class< U > utilClass)
boolean addAgent (String agent)
UtilitySolutionSpace< V, U > addUnarySpace (String name, String var, V[] dom, U[] utils)

Private Member Functions

void setDomain (String var, ArrayList< V > domain, Map< V, Double > weights)
 Sets the domain of a variable.

Private Attributes

long ncccCount
 The NCCC count.
HashMap< String, UtilitySolutionSpace< V, U > > probSpaces = new HashMap< String, UtilitySolutionSpace<V, U> > ()
 For each random variable, its probability space.
Class< V > domClass = (Class<V>) AddableInteger.class
 The class of variable values.

Static Private Attributes

static final long serialVersionUID = -7670751554969143041L
 Used for serialization.

Additional Inherited Members

Protected Member Functions inherited from frodo2.algorithms.AbstractProblem< V, U >
 AbstractProblem ()
 Constructor.
Set< String > getScope (String var)
 Returns the agent scope of the input anonymous variable.
getInfeasibleUtil ()
void setVarScope (String var, Set< String > scope)
 Sets the agent scope of a shared variable.
Protected Attributes inherited from frodo2.algorithms.AbstractProblem< V, U >
boolean maximize
 Whether this is a maximization or a minimization problem.
Map< String, String > owners
 For each variable, the name of its owner agent.
Set< String > randVars
 The random variables.
HashSet< String > agents
 The set of agents.
List< UtilitySolutionSpace< V, U > > spaces
 The list of solution spaces.
Map< String, V[]> domains
 The domain of each variable.
Class< U > utilClass
 The class used for utility values.
String agentName
 The name of the agent owning this subproblem.
final boolean publicAgents
 Whether each agent knows the identities of all agents.
final boolean extendedRandNeighborhoods
 If true, neighborhood relationships between decision variables are extended through random variables.
final boolean mpc
 Whether to behave in MPC mode.
HashMap< String, Set< String > > varScopes
 For each shared variable, the names of the agents in its scope.

Detailed Description

A ProblemInterface that does not require the use of the XCSP format.

Author
Thomas Leaute
Parameters
<V>the class used for variable values
<U>the class used for utility values
Todo
Add support for NCCCs

Constructor & Destructor Documentation

◆ Problem() [1/4]

frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.Problem ( boolean maximize)

Constructor.

Parameters
maximizeWhether this is a maximization or a minimization problem

References frodo2.algorithms.AbstractProblem< V, U >.maximize, and Problem().

Referenced by getSubProblem(), Problem(), and reset().

Here is the call graph for this function:

◆ Problem() [2/4]

frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.Problem ( boolean maximize,
boolean publicAgents,
boolean mpc,
boolean extendedRandNeighborhoods )

Constructor.

Parameters
maximizeWhether this is a maximization or a minimization problem
publicAgentsWhether each agent knows the identities of all agents
mpcWhether to behave in MPC mode (each agent knows the identities of all agents and knows all variables)
extendedRandNeighborhoodsWhether neighborhood relationships between decision variables are extended through random variables

References frodo2.algorithms.AbstractProblem< V, U >.extendedRandNeighborhoods, frodo2.algorithms.AbstractProblem< V, U >.maximize, frodo2.algorithms.AbstractProblem< V, U >.mpc, and frodo2.algorithms.AbstractProblem< V, U >.publicAgents.

◆ Problem() [3/4]

frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.Problem ( String agentName,
Set< String > agents,
Map< String, String > owners,
Map< String, V[]> domains,
Set< String > randVars,
List< ? extends UtilitySolutionSpace< V, U > > spaces,
Map< String, ? extends UtilitySolutionSpace< V, U > > probSpaces,
Map< String, Set< String > > varScopes,
Class< V > domClass,
Class< U > utilClass )

Constructor for a minimization problem.

Parameters
agentNamethe name of the agent owning this subproblem
agentsthe agents
ownersfor each variable, the name of its owner agent
domainsthe domain of each variable
randVarsthe random variables
spacesthe list of solution spaces
probSpacesthe probability space for each random variable
varScopesthe variable scopes
domClasstbe class of variable values
utilClassthe utility class

References frodo2.algorithms.AbstractProblem< V, U >.agentName, frodo2.algorithms.AbstractProblem< V, U >.agents, frodo2.algorithms.AbstractProblem< V, U >.domains, domClass, frodo2.algorithms.AbstractProblem< V, U >.owners, probSpaces, frodo2.algorithms.AbstractProblem< V, U >.randVars, frodo2.algorithms.AbstractProblem< V, U >.spaces, frodo2.algorithms.AbstractProblem< V, U >.utilClass, and frodo2.algorithms.AbstractProblem< V, U >.varScopes.

◆ Problem() [4/4]

frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.Problem ( String agentName,
Set< String > agents,
Map< String, String > owners,
Map< String, V[]> domains,
Set< String > randVars,
List< ? extends UtilitySolutionSpace< V, U > > spaces,
Map< String, ? extends UtilitySolutionSpace< V, U > > probSpaces,
Map< String, Set< String > > varScopes,
Class< V > domClass,
Class< U > utilClass,
boolean maximize )

Constructor.

Parameters
agentNamethe name of the agent owning this subproblem
agentsthe agents
ownersfor each variable, the name of its owner agent
domainsthe domain of each variable
randVarsthe random variables
spacesthe list of solution spaces
probSpacesthe probability space for each random variable
varScopesthe variable scopes
domClasstbe class of variable values
utilClassthe utility class
maximizewhether this is a maximization or a minimization problem

References frodo2.algorithms.AbstractProblem< V, U >.agentName, frodo2.algorithms.AbstractProblem< V, U >.agents, frodo2.algorithms.AbstractProblem< V, U >.domains, domClass, frodo2.algorithms.AbstractProblem< V, U >.maximize, frodo2.algorithms.AbstractProblem< V, U >.owners, probSpaces, frodo2.algorithms.AbstractProblem< V, U >.randVars, reset(), frodo2.algorithms.AbstractProblem< V, U >.spaces, frodo2.algorithms.AbstractProblem< V, U >.utilClass, and frodo2.algorithms.AbstractProblem< V, U >.varScopes.

Here is the call graph for this function:

Member Function Documentation

◆ addProbabilitySpace()

void frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.addProbabilitySpace ( String randVar,
UtilitySolutionSpace< V, U > prob )

Adds a probability space for a given variable.

Parameters
randVarthe name of the random variable
probthe probabiliy space

Referenced by frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse().

◆ addRandomVar()

boolean frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.addRandomVar ( String name,
V[] domain )

Adds a random variable.

Parameters
namethe name of the variable
domainthe domain of the variable
Returns
true if the variable was added; false if it already exists

References frodo2.algorithms.AbstractProblem< V, U >.domains, and frodo2.algorithms.AbstractProblem< V, U >.randVars.

Referenced by getSubProblem(), and frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse().

◆ addSolutionSpace()

boolean frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.addSolutionSpace ( UtilitySolutionSpace< V, U > space)
See also
DCOPProblemInterface#addSolutionSpace(UtilitySolutionSpace)

References frodo2.algorithms.AbstractProblem< V, U >.spaces.

Referenced by getSubProblem(), ground(), and frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse().

◆ addVariable() [1/2]

boolean frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.addVariable ( String name,
String owner,
String domain )
See also
DCOPProblemInterface.addVariable(java.lang.String, java.lang.String, java.lang.String)
Todo
Auto-generated method stub

Referenced by getSubProblem(), and frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse().

◆ addVariable() [2/2]

boolean frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.addVariable ( String name,
String owner,
V[] domain )

◆ getDomClass()

Class< V > frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.getDomClass ( )

◆ getExpectedUtility()

UtilitySolutionSpace< V, U > frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.getExpectedUtility ( Map< String, V > assignments)
See also
DCOPProblemInterface#getExpectedUtility(Map)

References frodo2.solutionSpaces.UtilitySolutionSpace< V extends Addable< V >, U extends Addable< U > >.expectation(), getProbabilitySpaces(), and getUtility().

Here is the call graph for this function:

◆ getExtVars()

Set< String > frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.getExtVars ( )

◆ getNCCCs()

long frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.getNCCCs ( )

◆ getParamUtility()

◆ getProbabilitySpacePerRandVar()

Map< String, ? extends UtilitySolutionSpace< V, U > > frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.getProbabilitySpacePerRandVar ( )

◆ getProbabilitySpaces() [1/2]

List< UtilitySolutionSpace< V, U > > frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.getProbabilitySpaces ( )

◆ getProbabilitySpaces() [2/2]

List< UtilitySolutionSpace< V, U > > frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.getProbabilitySpaces ( String var)
See also
DCOPProblemInterface.getProbabilitySpaces(java.lang.String)

◆ getSubProblem()

◆ getUtility()

UtilitySolutionSpace< V, U > frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.getUtility ( Map< String, V > assignments,
boolean withAnonymVars )

◆ ground()

◆ incrNCCCs()

void frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.incrNCCCs ( long incr)

◆ multipleTypes()

boolean frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.multipleTypes ( )

◆ removeSpace()

boolean frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.removeSpace ( String name)

◆ rescale()

void frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.rescale ( U multiply,
U add )
See also
DCOPProblemInterface#rescale(Addable, Addable)

References frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.Iterator< V >.hasNext(), and frodo2.algorithms.AbstractProblem< V, U >.spaces.

Here is the call graph for this function:

◆ reset() [1/2]

void frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.reset ( ProblemInterface< V, U > newProblem)
See also
DCOPProblemInterface#reset(ProblemInterface)

References frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.agentName, frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.agents, frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.domains, domClass, frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.maximize, frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.owners, Problem(), probSpaces, frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.randVars, reset(), frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.spaces, frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.utilClass, and frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.varScopes.

Referenced by Problem(), reset(), frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.setUp(), frodo2.algorithms.afb.test.AFBagentTest< V extends Addable< V >, U extends Addable< U > >.setUp(), frodo2.algorithms.dpop.param.test.ParamDPOPtest< V extends Addable< V >, U extends Addable< U > >.setUp(), frodo2.algorithms.synchbb.test.SynchBBagentTest< V extends Addable< V >, U extends Addable< U > >.setUp(), frodo2.algorithms.asodpop.tests.ASODPOPagentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.asodpop.tests.ASODPOPBinaryAgentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.localSearch.mgm.mgm2.tests.MGM2agentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), and frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.testRandom().

Here is the call graph for this function:

◆ reset() [2/2]

void frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.reset ( String agentName,
Set< String > agents,
Map< String, String > owners,
Map< String, V[]> domains,
Set< String > randVars,
List< ? extends UtilitySolutionSpace< V, U > > spaces,
Map< String, ? extends UtilitySolutionSpace< V, U > > probSpaces,
Map< String, Set< String > > varScopes,
Class< V > domClass,
Class< U > utilClass,
boolean maximize )

Resets the problem.

Parameters
agentNamethe name of the agent owning this subproblem
agentsthe agents
ownersfor each variable, the name of its owner agent
domainsthe domain of each variable
randVarsthe random variables
spacesthe list of solution spaces
probSpacesthe probability space for each random variable
varScopesthe variable scopes
domClasstbe class of variable values
utilClassthe utility class
maximizewhether this is a maximization or a minimization problem

References frodo2.algorithms.AbstractProblem< V, U >.agentName, frodo2.algorithms.AbstractProblem< V, U >.agents, frodo2.algorithms.AbstractProblem< V, U >.domains, domClass, frodo2.algorithms.AbstractProblem< V, U >.maximize, frodo2.algorithms.AbstractProblem< V, U >.owners, probSpaces, frodo2.algorithms.AbstractProblem< V, U >.randVars, frodo2.algorithms.AbstractProblem< V, U >.spaces, frodo2.algorithms.AbstractProblem< V, U >.utilClass, and frodo2.algorithms.AbstractProblem< V, U >.varScopes.

◆ setAgent()

void frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.setAgent ( String agent)

Sets the name of the agent.

Parameters
agentthe name of the agent

Referenced by getSubProblem(), and frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse().

◆ setDomain() [1/2]

void frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.setDomain ( String var,
ArrayList< V > domain,
Map< V, Double > weights )
private

Sets the domain of a variable.

Parameters
varthe variable
domainits new domain
weightsnormalized weights for each value in the new domain (used only if the variable is random)

References frodo2.algorithms.AbstractProblem< V, U >.domains, frodo2.algorithms.AbstractProblem< V, U >.isRandom(), and setDomain().

Here is the call graph for this function:

◆ setDomain() [2/2]

void frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.setDomain ( String var,
V[] dom )
See also
DCOPProblemInterface.setDomain(java.lang.String, Addable[])

References setDomain().

Referenced by setDomain(), setDomain(), and setProbSpace().

Here is the call graph for this function:

◆ setDomClass()

◆ setNCCCs()

void frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.setNCCCs ( long ncccs)

◆ setOwner()

boolean frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.setOwner ( String var,
String owner )

◆ setProbSpace()

void frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.setProbSpace ( String var,
Map< V, Double > prob )
See also
DCOPProblemInterface.setProbSpace(java.lang.String, java.util.Map)

References setDomain().

Here is the call graph for this function:

◆ toString()

String frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.toString ( )

Member Data Documentation

◆ domClass

Class<V> frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.domClass = (Class<V>) AddableInteger.class
private

The class of variable values.

Referenced by getDomClass(), getSubProblem(), getUtility(), Problem(), Problem(), reset(), reset(), and setDomClass().

◆ ncccCount

long frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.ncccCount
private

The NCCC count.

◆ probSpaces

HashMap< String, UtilitySolutionSpace<V, U> > frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.probSpaces = new HashMap< String, UtilitySolutionSpace<V, U> > ()
private

For each random variable, its probability space.

Referenced by getSubProblem(), Problem(), Problem(), reset(), and reset().

◆ serialVersionUID

final long frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.serialVersionUID = -7670751554969143041L
staticprivate

Used for serialization.


The documentation for this class was generated from the following file: