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

An abstract problem instance. More...

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

Public Member Functions

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, Set< String > > getAnonymNeighborhoods (String agent)
Map< String, Integer > getNeighborhoodSizes ()
Map< String, Integer > getNeighborhoodSizes (String agent)
int getNbrNeighbors (String var)
int getNbrNeighbors (String var, boolean withAnonymVars)
HashSet< String > getNeighborVars (String var)
HashSet< String > getNeighborVars (String var, boolean withAnonymVars)
int getNumberOfCoordinationConstraints ()
Map< String, Set< String > > getAgentNeighborhoods ()
Map< String, Set< String > > getAgentNeighborhoods (String agent)
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 getNbrVars (String agent)
int getNbrIntVars ()
Map< String, String > getOwners ()
String getOwner (String var)
boolean isRandom (String var)
List< ? extends UtilitySolutionSpace< V, U > > getSolutionSpaces ()
List< ? extends UtilitySolutionSpace< V, U > > getSolutionSpaces (boolean withAnonymVars)
List< ? extends UtilitySolutionSpace< V, U > > getSolutionSpaces (String var, boolean withAnonymVars)
List<? extends UtilitySolutionSpace< V, U > > getSolutionSpaces (String var, Set< String > forbiddenVars)
List<? extends UtilitySolutionSpace< V, U > > getSolutionSpaces (String var, final boolean withAnonymVars, Set< String > forbiddenVars)
List<? extends UtilitySolutionSpace< V, U > > getSolutionSpaces (Set< String > vars, boolean withAnonymVars, Set< String > forbiddenVars)
UtilitySolutionSpace< V, U > getUtility (Map< String, V > assignments)
Set< String > getVariables ()
Set< String > getMyVars ()
Set< String > getAnonymVars ()
Set< String > getRandVars ()
Set< String > getAllVars ()
getZeroUtility ()
boolean maximize ()
void setMaximize (final boolean maximize)
void setUtilClass (Class< U > utilClass)
boolean addAgent (String agent)
Map< String, Set< String > > getNeighborhoods (String agent)
Map< String, Set< String > > getNeighborhoods (String agent, boolean withAnonymVars, boolean onlyAnonymVars)
UtilitySolutionSpace< V, U > addUnarySpace (String name, String var, V[] dom, U[] utils)
Public Member Functions inherited from frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >
Set< String > getExtVars ()
boolean addVariable (String name, String owner, String domain)
 Adds a new variable.
boolean addVariable (String name, String owner, V[] domain)
 Adds a new variable.
void rescale (U multiply, U add)
 Rescales the problem.
void setDomain (String var, V[] dom)
 Sets the domain of a variable.
boolean setOwner (String var, String owner)
 Sets the owner agent for the input variable.
List< ? extends UtilitySolutionSpace< V, U > > getProbabilitySpaces ()
 Returns the probability spaces in the problem.
Map< String, ? extends UtilitySolutionSpace< V, U > > getProbabilitySpacePerRandVar ()
 Returns the probability space of each random variable in the problem.
List< ? extends UtilitySolutionSpace< V, U > > getProbabilitySpaces (String var)
 Returns the probability spaces involving the input variable.
void setProbSpace (String var, Map< V, Double > prob)
 Adds to the problem a probability space for the input random variable.
boolean removeSpace (String name)
 Removes the space with the given name.
boolean addSolutionSpace (UtilitySolutionSpace< V, U > space)
 Adds a solution space to the problem.
UtilitySolutionSpace< V, U > getUtility (Map< String, V > assignments, final boolean withAnonymVars)
 Computes the total utility of the input assignment to variables.
UtilitySolutionSpace< V, U > getExpectedUtility (Map< String, V > assignments)
 Computes the expectation over the random variables of the utility for the input assignments.
UtilitySolutionSpace< V, U > getParamUtility (Map< String[], BasicUtilitySolutionSpace< V, ArrayList< V > > > assignments)
 Computes the total utility of the input assignment to variables, conditioned on the values of parameters.
DCOPProblemInterface< V, U > getSubProblem (String agent)
void ground (String var, V val)
 Adds a constraint that enforces that var = val.
Public Member Functions inherited from frodo2.solutionSpaces.ProblemInterface< V, U >
void reset (ProblemInterface< V, U > newProblem)
 Resets this problem to be the same as the input one.
void setDomClass (Class< V > domClass)
 Sets the class to be used for variable values.
Class< V > getDomClass ()
void setUtilClass (Class< U > utilClass)
 Sets the class to be used for utility values.
Class< U > getUtilClass ()
getZeroUtility ()
getPlusInfUtility ()
getMinInfUtility ()
String getAgent ()
Set< String > getAgents ()
ProblemInterface< V, U > getSubProblem (String agent)
 Builds the subproblem description for a given agent by extracting it from the overall problem description.
boolean multipleTypes ()
void incrNCCCs (long incr)
 Increments the number of constraint checks.
long getNCCCs ()
void setNCCCs (long ncccs)
 Sets the NCCC count.

Protected Member Functions

 AbstractProblem ()
 Constructor.
 AbstractProblem (boolean maximize, boolean publicAgents, boolean mpc, boolean extendedRandNeighborhoods)
 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

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 = new HashSet<String> ()
 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 = (Class<U>) AddableInteger.class
 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 = new HashMap<String, Set<String>> ()
 For each shared variable, the names of the agents in its scope.

Private Member Functions

HashSet< String > getAgentNeighbors (String var)
 Returns the neighboring agents of the input variable.

Static Private Attributes

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

Detailed Description

An abstract problem instance.

Author
Thomas Leaute
Parameters
<V>the class used for variable values
<U>the class used for utility values

Constructor & Destructor Documentation

◆ AbstractProblem() [1/2]

frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.AbstractProblem ( )
protected

Constructor.

References AbstractProblem().

Referenced by AbstractProblem().

Here is the call graph for this function:

◆ AbstractProblem() [2/2]

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

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 extendedRandNeighborhoods, maximize, mpc, and publicAgents.

Member Function Documentation

◆ addAgent()

◆ addUnarySpace()

UtilitySolutionSpace< V, U > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.addUnarySpace ( String name,
String var,
V[] dom,
U[] utils )
See also
DCOPProblemInterface#addUnarySpace(String, String, Addable[], Addable[])

Implements frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.

References frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.addSolutionSpace(), and getInfeasibleUtil().

Here is the call graph for this function:

◆ getAgent()

◆ getAgentNeighborhoods() [1/2]

Map< String, Set< String > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getAgentNeighborhoods ( )

◆ getAgentNeighborhoods() [2/2]

Map< String, Set< String > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getAgentNeighborhoods ( String agent)

◆ getAgentNeighbors()

HashSet< String > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getAgentNeighbors ( String var)
private

Returns the neighboring agents of the input variable.

Parameters
varthe variable
Returns
the variable's neighboring agents

References extendedRandNeighborhoods, getOwner(), getScope(), and isRandom().

Referenced by getAgentNeighborhoods().

Here is the call graph for this function:

◆ getAgents()

◆ getAllVars()

Set< String > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getAllVars ( )

◆ getAnonymNeighborhoods() [1/2]

Map< String, Set< String > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getAnonymNeighborhoods ( )

◆ getAnonymNeighborhoods() [2/2]

Map< String, Set< String > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getAnonymNeighborhoods ( String agent)

◆ getAnonymVars()

◆ getDomain()

◆ getDomainSize()

int frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getDomainSize ( String var)
See also
DCOPProblemInterface.getDomainSize(java.lang.String)

Implements frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.

References getDomain().

Here is the call graph for this function:

◆ getInfeasibleUtil()

U frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getInfeasibleUtil ( )
protected
Returns
-INF if we are maximizing, +INF if we are minimizing

References getMinInfUtility(), and getPlusInfUtility().

Referenced by addUnarySpace(), and frodo2.solutionSpaces.JaCoP.JaCoPproblem< V extends Addable< V > >.getUtility().

Here is the call graph for this function:

◆ getMinInfUtility()

U frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getMinInfUtility ( )

◆ getMyVars()

◆ getNbrIntVars()

int frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getNbrIntVars ( )

◆ getNbrNeighbors() [1/2]

int frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getNbrNeighbors ( String var)
See also
DCOPProblemInterface.getNbrNeighbors(java.lang.String)

Implements frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.

References getNbrNeighbors().

Referenced by getNbrNeighbors().

Here is the call graph for this function:

◆ getNbrNeighbors() [2/2]

int frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getNbrNeighbors ( String var,
boolean withAnonymVars )
See also
DCOPProblemInterface.getNbrNeighbors(java.lang.String, boolean)

Implements frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.

References getNeighborVars().

Here is the call graph for this function:

◆ getNbrVars() [1/2]

◆ getNbrVars() [2/2]

◆ getNeighborhoods() [1/3]

Map< String, Set< String > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getNeighborhoods ( )

◆ getNeighborhoods() [2/3]

Map< String, Set< String > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getNeighborhoods ( String agent)

◆ getNeighborhoods() [3/3]

Map< String, Set< String > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getNeighborhoods ( String agent,
boolean withAnonymVars,
boolean onlyAnonymVars )
See also
DCOPProblemInterface.getNeighborhoods(java.lang.String, boolean, boolean)

Implements frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.

References getNeighborVars(), getVariables(), and isRandom().

Here is the call graph for this function:

◆ getNeighborhoodSizes() [1/2]

Map< String, Integer > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getNeighborhoodSizes ( )

◆ getNeighborhoodSizes() [2/2]

Map< String, Integer > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getNeighborhoodSizes ( String agent)

◆ getNeighborVars() [1/2]

HashSet< String > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getNeighborVars ( String var)

◆ getNeighborVars() [2/2]

HashSet< String > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getNeighborVars ( String var,
boolean withAnonymVars )
See also
DCOPProblemInterface.getNeighborVars(java.lang.String, boolean)

Implements frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.

References extendedRandNeighborhoods, and getOwner().

Here is the call graph for this function:

◆ getNumberOfCoordinationConstraints()

◆ getOwner()

◆ getOwners()

◆ getPlusInfUtility()

U frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getPlusInfUtility ( )

◆ getRandVars()

◆ getScope()

Set< String > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getScope ( String var)
protected

Returns the agent scope of the input anonymous variable.

Parameters
varthe variable
Returns
the agent scope of the variable

References varScopes.

Referenced by getAgentNeighbors().

◆ getSolutionSpaces() [1/6]

◆ getSolutionSpaces() [2/6]

List< ? extends UtilitySolutionSpace< V, U > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getSolutionSpaces ( boolean withAnonymVars)

◆ getSolutionSpaces() [3/6]

List<? extends UtilitySolutionSpace< V, U > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getSolutionSpaces ( Set< String > vars,
boolean withAnonymVars,
Set< String > forbiddenVars )

◆ getSolutionSpaces() [4/6]

List< ? extends UtilitySolutionSpace< V, U > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getSolutionSpaces ( String var,
boolean withAnonymVars )

◆ getSolutionSpaces() [5/6]

List<? extends UtilitySolutionSpace< V, U > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getSolutionSpaces ( String var,
final boolean withAnonymVars,
Set< String > forbiddenVars )
See also
DCOPProblemInterface.getSolutionSpaces(java.lang.String, boolean, java.util.Set)

Implements frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.

References getSolutionSpaces().

Here is the call graph for this function:

◆ getSolutionSpaces() [6/6]

List<? extends UtilitySolutionSpace< V, U > > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getSolutionSpaces ( String var,
Set< String > forbiddenVars )
See also
DCOPProblemInterface.getSolutionSpaces(java.lang.String, java.util.Set)

Implements frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.

References getSolutionSpaces().

Here is the call graph for this function:

◆ getUtilClass()

Class< U > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getUtilClass ( )

◆ getUtility()

UtilitySolutionSpace< V, U > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getUtility ( Map< String, V > assignments)
See also
DCOPProblemInterface.getUtility(java.util.Map)
Todo
Test this method.

Implements frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.

References getUtility().

Referenced by getUtility().

Here is the call graph for this function:

◆ getVariables() [1/2]

◆ getVariables() [2/2]

Set< String > frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.getVariables ( final String owner)
See also
DCOPProblemInterface.getVariables(java.lang.String)

Implements frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.

References getOwner(), and getVariables().

Here is the call graph for this function:

◆ getVarScopes()

◆ getZeroUtility()

◆ isRandom()

◆ maximize()

◆ setAgent()

◆ setMaximize()

void frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.setMaximize ( final boolean maximize)

◆ setUtilClass()

◆ setVarScope()

void frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.setVarScope ( String var,
Set< String > scope )
protected

Sets the agent scope of a shared variable.

Parameters
varthe variable
scopethe names of the agents in the variable's scope

References getOwner(), and varScopes.

Referenced by frodo2.solutionSpaces.JaCoP.JaCoPproblem< V extends Addable< V > >.getSubProblem().

Here is the call graph for this function:

◆ toString()

String frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.toString ( )
See also
java.lang.Object#toString()

References agentName, extendedRandNeighborhoods, mpc, publicAgents, and utilClass.

Member Data Documentation

◆ agentName

String frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.agentName
protected

◆ agents

◆ domains

◆ extendedRandNeighborhoods

final boolean frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.extendedRandNeighborhoods
protected

If true, neighborhood relationships between decision variables are extended through random variables.

In other words, for a given decision variable x, its neighborhood consists of:

  • the decision variables that share constraints with x (as usual),
  • the decision variables that are direct neighbors of any random variable that can be reached from x by a path that involves only random variables.

Referenced by AbstractProblem(), frodo2.solutionSpaces.JaCoP.JaCoPproblem< V extends Addable< V > >.clone(), getAgentNeighbors(), getNeighborVars(), frodo2.solutionSpaces.JaCoP.JaCoPproblem< V extends Addable< V > >.getSubProblem(), frodo2.solutionSpaces.JaCoP.JaCoPproblem< V extends Addable< V > >.JaCoPproblem(), and toString().

◆ maximize

◆ mpc

final boolean frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.mpc
protected

Whether to behave in MPC mode.

In MPC mode:

  • each agent knows the identities of all agents;
  • all variables are known to all agents.

Referenced by AbstractProblem(), and toString().

◆ owners

Map<String, String> frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.owners
protected

◆ publicAgents

◆ randVars

Set<String> frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.randVars
protected

◆ serialVersionUID

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

Used for serialization.

◆ spaces

◆ utilClass

◆ varScopes


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