FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > > Interface Template Reference

This interface defines common functionalities in all solution spaces. More...

Inheritance diagram for frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >:

Classes

interface  SparseIterator
 A SolutionSpace iterator that skips infeasible solutions. More...
interface  Iterator
 An iterator that does NOT skip infeasible solutions. More...

Public Member Functions

void setProblem (ProblemInterface< V, ?> problem)
 Sets the problem that should be notified of constraint checks.
boolean countsCCs ()
String getName ()
void setName (String name)
 Sets the name of this space.
String getRelationName ()
void setRelationName (String name)
 Sets the name of the underlying relation for this space.
String getOwner ()
void setOwner (String owner)
 Sets the owner.
long getNumberOfSolutions ()
 Returns the number of solutions in the SolutionSpace.
String[] getVariables ()
 Returns the internal order of variables used within the SolutionSpace.
int getNumberOfVariables ()
 Returns the number of variables in the SolutionSpace.
String getVariable (int index)
 Returns the variable corresponding to the provided index.
void renameVariable (String oldName, String newName)
 Renames a variable.
SolutionSpace< V > renameAllVars (String[] newVarNames)
 Creates a shallow clone of this space, with different variable names.
int getIndex (String variable)
 Returns the index of the input variable in this SolutionSpace.
V[][] getDomains ()
 Returns the array containing the domains of the variables.
V[] getDomain (String variable)
 Returns an array of all possible values that the variable provided as a parameter can take in this SolutionSpace.
V[] getDomain (int index)
 Returns the domain of the variable that corresponds to the provided index.
V[] getDomain (String variable, int index)
 Returns the variable's domain if index is the variable's index in the array of variables order.
void setDomain (String var, V[] dom)
 Sets the domain of a variable.
void augment (V[] variables_values)
 Augments the SolutionSpace with a new combination of variable values which constitutes a new solution.
SolutionSpace< V > slice (String[] variables_names, V[][] sub_domains)
 Returns a slice of this SolutionSpace.
SolutionSpace< V > slice (String[] variables_names, V[] values)
 Returns a slice of this SolutionSpace.
SolutionSpace< V > slice (String var, V[] subDomain)
 Slices this SolutionSpace over a single variable.
SolutionSpace< V > slice (String var, V val)
 Slices this SolutionSpace over a single variable-value assignment.
SolutionSpace< V > slice (V[] variables_values)
 Returns a slice of this SolutionSpace.
boolean knows (Class<?> spaceClass)
 Returns whether this space knows how to handle other spaces of the input class.
SolutionSpace< V > join (SolutionSpace< V > space, String[] total_variables)
 Returns a SolutionSpace object obtained by joining this SolutionSpace object with the one provided as a parameter.
SolutionSpace< V > join (SolutionSpace< V > space)
 Computes the join of this SolutionSpace with the input SolutionSpace.
SolutionSpace< V > join (SolutionSpace< V >[] spaces, String[] total_variables_order)
 Returns a SolutionSpace object obtained by joining the SolutionSpace for which this method is called and the SolutionSpaces present in the array of SolutionSpaces given to this method as a parameter.
SolutionSpace< V > join (SolutionSpace< V >[] spaces)
 Returns a SolutionSpace object obtained by joining the SolutionSpace for which this method is called and the SolutionSpaces present in the array of SolutionSpaces given to this method as a parameter.
boolean equals (Object o)
 Checks for equality.
SolutionSpace< V > clone ()
SolutionSpace< V > resolve ()
SolutionSpace< V > resolve (boolean sparse)
 Returns an explicit representation of this space.
SparseIterator< V > sparseIter ()
SparseIterator< V > sparseIter (String[] order)
 Returns a sparse iterator with a specific variable order.
Iterator< V > iterator ()
Iterator< V > iterator (String[] order)
 Returns an iterator with a specific variable order.

Detailed Description

This interface defines common functionalities in all solution spaces.

A solution space is a representation of combinations of assignments to variables that are the solution to some problem.

Author
Radoslaw Szymanek, Thomas Leaute
Parameters
<V>the type used for variable values
Todo
Define an isIncludedIn() method?

Member Function Documentation

◆ augment()

void frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.augment ( V[] variables_values)

Augments the SolutionSpace with a new combination of variable values which constitutes a new solution.

Parameters
variables_valuesthe assignments to the solution space's variables
Note
If the corresponding solution already exists then nothing will change.

◆ clone()

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.clone ( )
Returns
a clone of this solution space

◆ countsCCs()

boolean frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.countsCCs ( )
Returns
whether this space counts constraint checks

◆ equals()

boolean frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.equals ( Object o)

Checks for equality.

Parameters
oan Object to be compared with this SolutionSpace
Returns
whether the input Object equals this SolutionSpace
Todo
Also define an equivalent() method.

◆ getDomain() [1/3]

V[] frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getDomain ( int index)

Returns the domain of the variable that corresponds to the provided index.

Parameters
indexindex of the variable
Returns
Array containing all the possible values of the variable corresponding to the provided index

◆ getDomain() [2/3]

V[] frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getDomain ( String variable)

Returns an array of all possible values that the variable provided as a parameter can take in this SolutionSpace.

Parameters
variablethe name of the variable
Returns
the variable's domain

Referenced by frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.equivalent(), and frodo2.solutionSpaces.hypercube.tests.HypercubeTest.testConsensusWeighted().

◆ getDomain() [3/3]

V[] frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getDomain ( String variable,
int index )

Returns the variable's domain if index is the variable's index in the array of variables order.

Parameters
variablethe name of the variable
indexthe index of the variable
Returns
Array containing the domain of the variable or null if the variable doesn't exist in this SolutionSpace at the provided index

◆ getDomains()

V[][] frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getDomains ( )

Returns the array containing the domains of the variables.

Returns
two-dimensional array containing the domains of the variables

◆ getIndex()

int frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getIndex ( String variable)

Returns the index of the input variable in this SolutionSpace.

Parameters
variablethe name of the variable
Returns
integer representing the index of the variable in the SolutionSpace

◆ getName()

String frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getName ( )
Returns
the name of this space, if any

◆ getNumberOfSolutions()

long frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getNumberOfSolutions ( )

Returns the number of solutions in the SolutionSpace.

Returns
integer representing the number of possible assignments in the SolutionSpace

Referenced by frodo2.algorithms.dpop.param.ParamVALUE< Val extends Addable< Val > >.sendVALUEmessage(), and frodo2.solutionSpaces.hypercube.tests.HypercubeTest.testConsensusWeighted().

◆ getNumberOfVariables()

int frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getNumberOfVariables ( )

◆ getOwner()

String frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getOwner ( )
Returns
the agent that owns this space, or "PUBLIC" if it is public, or null if the space is owned by all agents involved

◆ getRelationName()

String frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getRelationName ( )
Returns
the name of the underlying relation for this space, if any

◆ getVariable()

String frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getVariable ( int index)

Returns the variable corresponding to the provided index.

Parameters
indexindex of the variable in this SolutionSpace
Returns
String representing the variable corresponding to the provided index

◆ getVariables()

String[] frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getVariables ( )

◆ iterator() [1/2]

Iterator< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.iterator ( )
Returns
an iterator which can be used to iterate through solutions

◆ iterator() [2/2]

Iterator< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.iterator ( String[] order)

Returns an iterator with a specific variable order.

Parameters
orderthe order of iteration of the variables
Returns
an iterator which can be used to iterate through solutions
Warning
The input array of variables must contain exactly all of the space's variables.

◆ join() [1/4]

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.join ( SolutionSpace< V > space)

Computes the join of this SolutionSpace with the input SolutionSpace.

Order of variables in the resulting SolutionSpace is not specified.

Parameters
spacethe SolutionSpace to join with this one
Returns
the result of the join of the two SolutionSpaces

◆ join() [2/4]

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.join ( SolutionSpace< V > space,
String[] total_variables )

Returns a SolutionSpace object obtained by joining this SolutionSpace object with the one provided as a parameter.

Parameters
spacethe SolutionSpace to join with this one
total_variablesthe order of the variables to be used in the resulting SolutionSpace
Returns
SolutionSpace object obtained by joining this SolutionSpace with the one provided as a parameter

◆ join() [3/4]

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.join ( SolutionSpace< V >[] spaces)

Returns a SolutionSpace object obtained by joining the SolutionSpace for which this method is called and the SolutionSpaces present in the array of SolutionSpaces given to this method as a parameter.

The order of the variables in the resulting SolutionSpace is not defined.

Parameters
spacesan array of the SolutionSpaces to be added to this SolutionSpace
Returns
SolutionSpace object obtained by joining this SolutionSpace with all the SolutionSpaces in the array of SolutionSpaces

◆ join() [4/4]

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.join ( SolutionSpace< V >[] spaces,
String[] total_variables_order )

Returns a SolutionSpace object obtained by joining the SolutionSpace for which this method is called and the SolutionSpaces present in the array of SolutionSpaces given to this method as a parameter.

Parameters
spacesan array of SolutionSpaces to be added to this SolutionSpace
total_variables_orderthe order of variables to be used in the resulting SolutionSpace
Returns
SolutionSpace object obtained by joining this SolutionSpace with all the SolutionSpaces in the array of SolutionSpaces

◆ knows()

boolean frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.knows ( Class<?> spaceClass)

Returns whether this space knows how to handle other spaces of the input class.

Parameters
spaceClassclass of the other spaces
Returns
whether this space knows how to handle the input type of spaces

◆ renameAllVars()

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.renameAllVars ( String[] newVarNames)

Creates a shallow clone of this space, with different variable names.

Parameters
newVarNamesthe new variable names
Returns
a shallow clone of this space, with the specified variable names

◆ renameVariable()

void frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.renameVariable ( String oldName,
String newName )

Renames a variable.

Parameters
oldNamethe current name of the variable
newNamethe new name for the variable

◆ resolve() [1/2]

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.resolve ( )
Returns
resolve(true)

◆ resolve() [2/2]

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.resolve ( boolean sparse)

Returns an explicit representation of this space.

Parameters
sparsewhether to use a sparse iterator to resolve the space
Returns
an explicit representation of this space

◆ setDomain()

void frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.setDomain ( String var,
V[] dom )

Sets the domain of a variable.

Parameters
varthe variable
domthe new domain for the variable

◆ setName()

void frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.setName ( String name)

Sets the name of this space.

Parameters
namethe name of this space

◆ setOwner()

void frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.setOwner ( String owner)

Sets the owner.

Parameters
ownerthe owner of this space

◆ setProblem()

void frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.setProblem ( ProblemInterface< V, ?> problem)

Sets the problem that should be notified of constraint checks.

Parameters
problemthe problem

◆ setRelationName()

void frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.setRelationName ( String name)

Sets the name of the underlying relation for this space.

Parameters
namethe name of the underlying relation for this space

◆ slice() [1/5]

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.slice ( String var,
V val )

Slices this SolutionSpace over a single variable-value assignment.

Parameters
varthe variable to be assigned a value
valthe value to assign to the variable
Returns
the SolutionSpace resulting from this slice

◆ slice() [2/5]

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.slice ( String var,
V[] subDomain )

Slices this SolutionSpace over a single variable.

Parameters
varthe variable to be assigned a value
subDomainthe new domain for this variable (must be a subset of the original domain)
Returns
the SolutionSpace resulting from this slice

◆ slice() [3/5]

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.slice ( String[] variables_names,
V[] values )

Returns a slice of this SolutionSpace.

Slicing corresponds to grounding some of the variables.

Parameters
variables_namesthe variables to slice
valuesthe values for the variables
Returns
a SolutionSpace representing a slice of this SolutionSpace

◆ slice() [4/5]

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.slice ( String[] variables_names,
V sub_domains[][] )

Returns a slice of this SolutionSpace.

Slicing corresponds to reducing the domains of some of the variables.

Parameters
variables_namesthe variables to slice
sub_domainsthe new domains for the variables
Returns
a SolutionSpace representing a slice of this SolutionSpace

◆ slice() [5/5]

SolutionSpace< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.slice ( V[] variables_values)

Returns a slice of this SolutionSpace.

Parameters
variables_valuesarray containing values of the last variables of the SolutionSpace
Returns
SolutionSpace object obtained by associating given values to the last variables of the SolutionSpace. The number of these variables depends on the length of the provided array of variable values.

◆ sparseIter() [1/2]

SparseIterator< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.sparseIter ( )
Returns
a sparse iterator which can be used to iterate through feasible solutions

◆ sparseIter() [2/2]

SparseIterator< V > frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.sparseIter ( String[] order)

Returns a sparse iterator with a specific variable order.

Parameters
orderthe order of iteration of the variables
Returns
an iterator which can be used to iterate through solutions
Warning
The input array of variables must contain exactly all of the space's variables.

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