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

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

Inheritance diagram for frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >:

Classes

interface  SparseIterator
 A BasicUtilitySolutionSpace iterator that skips infeasible solutions. More...
interface  Iterator
 A BasicUtilitySolutionSpace iterator that doest NOT skip infeasible solutions. More...

Public Member Functions

BasicUtilitySolutionSpace< V, U > clone ()
BasicUtilitySolutionSpace< V, U > resolve ()
BasicUtilitySolutionSpace< V, U > resolve (boolean sparse)
String prettyPrint (U ignoredUtil)
 A human-friendly version of toString().
getUtility (V[] variables_values)
 Returns an object representing the utility value corresponding to the provided variables values representing a solution.
getUtility (String[] variables_names, V[] variables_values)
 Returns an object representing the utility value corresponding to the provided variables values representing a solution.
getUtility (Map< String, V > assignments)
 Returns the utility corresponding to the input assignments.
getUtility (long index)
 Returns the utility value corresponding to the solution at the provided index.
Class< U > getClassOfU ()
boolean setUtility (V[] variables_values, U utility)
 Sets the utility value corresponding to a given assignment to variables.
void setUtility (long index, U utility)
 Sets the utility value for the solution at the provided index.
void setDefaultUtility (U utility)
 Sets the default utility value.
getDefaultUtility ()
void setInfeasibleUtility (U utility)
 Sets the utility associated with infeasible solutions.
void augment (V[] variables_values, U utility_value)
 Augments this BasicUtilitySolutionSpace with a new combination of variables values associated with a given utility.
boolean equivalent (BasicUtilitySolutionSpace< V, U > space)
 Returns whether the input BasicUtilitySolutionSpace represents the same space as this BasicUtilitySolutionSpace.
boolean isIncludedIn (BasicUtilitySolutionSpace< V, U > space)
 Checks if this BasicUtilitySolutionSpace is included in the provided BasicUtilitySolutionSpace.
BasicUtilitySolutionSpace< V, U > changeVariablesOrder (String[] variables_order)
 Returns a new BasicUtilitySolutionSpace by changing the order of the variables of this BasicUtilitySolutionSpace.
BasicUtilitySolutionSpace< V, U > slice (String[] variables_names, V[][] sub_domains)
 Returns a slice of this BasicUtilitySolutionSpace.
BasicUtilitySolutionSpace< V, U > slice (String[] variables_names, V[] values)
 Returns a slice of this BasicUtilitySolutionSpace.
BasicUtilitySolutionSpace< V, U > slice (String var, V[] subDomain)
 Slices this SolutionSpace over a single variable.
BasicUtilitySolutionSpace< V, U > slice (String var, V val)
 Slices this BasicUtilitySolutionSpace over a single variable-value assignment.
BasicUtilitySolutionSpace< V, U > slice (V[] variables_values)
 Returns a slice of this solution space.
BasicUtilitySolutionSpace< V, U > compose (String[] vars, BasicUtilitySolutionSpace< V, ArrayList< V > > substitution)
 Substitutes some of the variables in this utility space with functions.
SparseIterator< V, U > sparseIter ()
SparseIterator< V, U > sparseIter (String[] order)
SparseIterator< V, U > sparseIter (String[] variables, V[][] domains)
 Returns a sparse iterator.
SparseIterator< V, U > sparseIter (String[] variables, V[][] domains, V[] assignment)
 Returns a sparse iterator.
Iterator< V, U > iterator ()
Iterator< V, U > iterator (String[] order)
Iterator< V, U > iterator (String[] variables, V[][] domains)
 Returns an iterator.
Iterator< V, U > iterator (String[] variables, V[][] domains, V[] assignment)
 Returns an iterator.
Public Member Functions inherited from frodo2.solutionSpaces.SolutionSpace< V >
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.
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.
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.
boolean equals (Object o)
 Checks for equality.
SolutionSpace< V > clone ()
SolutionSpace< V > resolve ()
SparseIterator< V > sparseIter ()
Iterator< V > iterator ()

Detailed Description

This interface defines common functionalities in all utility solution spaces.

A utility solution space is a solution space in which each solution has an associated value, called "utility".

Author
Radoslaw Szymanek, Thomas Leaute
Parameters
<V>the type used for variable values
<U>the type used for utility values

Member Function Documentation

◆ augment()

void frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.augment ( V[] variables_values,
U utility_value )

Augments this BasicUtilitySolutionSpace with a new combination of variables values associated with a given utility.

Note
If the corresponding assignment already exists in BasicUtilitySolutionSpace, this method will only modify the corresponding utility value.
Parameters
variables_valuesassignments to the variables
utility_valuecorresponding utility value

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ changeVariablesOrder()

BasicUtilitySolutionSpace< V, U > frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.changeVariablesOrder ( String[] variables_order)

Returns a new BasicUtilitySolutionSpace by changing the order of the variables of this BasicUtilitySolutionSpace.

Parameters
variables_orderthe new order of the variables
Returns
BasicUtilitySolutionSpace object obtained by changing the order of the variables
Warning
The input variable order must contain only and all the variables that belong to this BasicUtilitySolutionSpace.

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >, and frodo2.solutionSpaces.JaCoP.JaCoPoptAssignments.

Referenced by frodo2.algorithms.dpop.stochastic.test.ExpectedUTILtest.Listener.checkOutput(), and frodo2.solutionSpaces.hypercube.tests.HypercubeTest.testCompose().

◆ clone()

◆ compose()

BasicUtilitySolutionSpace< V, U > frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.compose ( String[] vars,
BasicUtilitySolutionSpace< V, ArrayList< V > > substitution )

Substitutes some of the variables in this utility space with functions.

This operation is indeed a composition of spaces: if f is this utility space, and g is the input space, then this operation computes f o g.

Parameters
varsthe variables to be substituted
substitutionthe new values for the substituted variables, as a function of some other variables
Returns
a new utility space corresponding to this space, but with the variables in vars substituted according to substitution

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

Referenced by frodo2.algorithms.dpop.param.ParamVALUE< Val extends Addable< Val > >.computeOptValAndSendVALUEmsgs().

◆ equivalent()

boolean frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.equivalent ( BasicUtilitySolutionSpace< V, U > space)

Returns whether the input BasicUtilitySolutionSpace represents the same space as this BasicUtilitySolutionSpace.

Note
This method uses == for testing the equality of utilities.
Parameters
spacethe BasicUtilitySolutionSpace to be tested for equivalence
Returns
whether the input BasicUtilitySolutionSpace is equivalent to this one
Todo
Move this to UtilitySolutionSpace? Utilities in a BasicUtilitySolutionSpace are not expected to be comparable.

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ getClassOfU()

Class< U > frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.getClassOfU ( )

◆ getDefaultUtility()

◆ getUtility() [1/4]

U frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.getUtility ( long index)

Returns the utility value corresponding to the solution at the provided index.

It uses the internal order of the solutions in the solution space.

Parameters
indexindex of the solution in the internal representation of solutions
Returns
utility value of the solution at the provided index, or null if this solution does not exist

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >, and frodo2.solutionSpaces.JaCoP.JaCoPoptAssignments.

◆ getUtility() [2/4]

U frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.getUtility ( Map< String, V > assignments)

Returns the utility corresponding to the input assignments.

Parameters
assignmentsan association of values to variables
Returns
the utility
Warning
The output is undefined if the input does not specify a value for each variable in the space.

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ getUtility() [3/4]

U frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.getUtility ( String[] variables_names,
V[] variables_values )

Returns an object representing the utility value corresponding to the provided variables values representing a solution.

Parameters
variables_namesthe names of the variables
variables_valuesthe values of the variables
Returns
the utility value corresponding the provided variables values
Warning
The output is undefined if the inputs do not specify a value for each variable in the space.

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ getUtility() [4/4]

U frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.getUtility ( V[] variables_values)

◆ isIncludedIn()

boolean frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.isIncludedIn ( BasicUtilitySolutionSpace< V, U > space)

Checks if this BasicUtilitySolutionSpace is included in the provided BasicUtilitySolutionSpace.

"Inclusion" means that both spaces contain the same variables, and all assignments in this BasicUtilitySolutionSpace appear with the same utility values in the input BasicUtilitySolutionSpace.

Note
This function uses == for testing the equality of utilities.
Parameters
spaceBasicUtilitySolutionSpace object
Returns
true if this BasicUtilitySolutionSpace is included in the provided BasicUtilitySolutionSpace object, and false otherwise

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ iterator() [1/4]

◆ iterator() [2/4]

◆ iterator() [3/4]

Iterator< V, U > frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.iterator ( String[] variables,
V domains[][] )

Returns an iterator.

Parameters
variablesThe variables to iterate over, which may contain variables not in the space, but must contain all variables in the space
domainsThe domains of the variables over which to iterate
Returns
an iterator which allows to iterate over the given variables and their utilities

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ iterator() [4/4]

Iterator< V, U > frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.iterator ( String[] variables,
V domains[][],
V[] assignment )

Returns an iterator.

Parameters
variablesThe variables to iterate over
domainsThe domains of the variables over which to iterate
assignmentAn array that will be used as the output of nextSolution()
Returns
an iterator which allows to iterate over the given variables and their utilities

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ prettyPrint()

String frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.prettyPrint ( U ignoredUtil)

A human-friendly version of toString().

Parameters
ignoredUtildo not display solutions with this utility
Returns
a human-friendly representation of the space

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ resolve() [1/2]

BasicUtilitySolutionSpace< V, U > frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.resolve ( )
Returns
an explicit representation of this space if it is currently implicit, else returns itself

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >, and frodo2.solutionSpaces.JaCoP.JaCoPoptAssignments.

◆ resolve() [2/2]

◆ setDefaultUtility()

void frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.setDefaultUtility ( U utility)

Sets the default utility value.

The default utility value is the one that is used when augmenting the BasicUtilitySolutionSpace with a new solution without specifying the utility of this solution.

Parameters
utilitythe new default utility

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ setInfeasibleUtility()

void frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.setInfeasibleUtility ( U utility)

Sets the utility associated with infeasible solutions.

Parameters
utilitythe infeasible utility

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ setUtility() [1/2]

void frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.setUtility ( long index,
U utility )

Sets the utility value for the solution at the provided index.

Parameters
indexindex of the solution
utilitynew utility

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ setUtility() [2/2]

boolean frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.setUtility ( V[] variables_values,
U utility )

Sets the utility value corresponding to a given assignment to variables.

Parameters
variables_valuesvalues for the variables, in the same order as in the BasicUtilitySolutionSpace
utilitythe new utility value
Returns
specifies if setting the utility value was possible. false is returned if the BasicUtilitySolutionSpace does not allow the given assignments to the variables.

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

Referenced by frodo2.algorithms.dpop.param.ParamVALUE< Val extends Addable< Val > >.sendVALUEmessage().

◆ slice() [1/5]

BasicUtilitySolutionSpace< V, U > frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.slice ( String var,
V val )

Slices this BasicUtilitySolutionSpace over a single variable-value assignment.

Returns
the BasicUtilitySolutionSpace resulting from this slice
See also
SolutionSpace.slice(java.lang.String, Addable)

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ slice() [2/5]

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

Slices this SolutionSpace over a single variable.

Returns
the BasicUtilitySolutionSpace resulting from this slice
See also
SolutionSpace.slice(java.lang.String, Addable[])

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ slice() [3/5]

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

◆ slice() [4/5]

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

◆ slice() [5/5]

BasicUtilitySolutionSpace< V, U > frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.slice ( V[] variables_values)

Returns a slice of this solution space.

See also
SolutionSpace#slice(Addable[])

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ sparseIter() [1/4]

◆ sparseIter() [2/4]

◆ sparseIter() [3/4]

SparseIterator< V, U > frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.sparseIter ( String[] variables,
V domains[][] )

Returns a sparse iterator.

Parameters
variablesThe variables to iterate over, which may contain variables not in the space, but must contain all variables in the space
domainsThe domains of the variables over which to iterate
Returns
an iterator which allows to iterate over the given variables and their utilities

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.

◆ sparseIter() [4/4]

SparseIterator< V, U > frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.sparseIter ( String[] variables,
V domains[][],
V[] assignment )

Returns a sparse iterator.

Parameters
variablesThe variables to iterate over
domainsThe domains of the variables over which to iterate
assignmentAn array that will be used as the output of nextSolution()
Returns
an iterator which allows to iterate over the given variables and their utilities

Implemented in frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.


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