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

A basic hypercube that stores one utility per combination of assigments to variables. More...

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

Public Member Functions

 BasicHypercube (String[] variables_order, V[][] variables_domains, U[] utility_values, U infeasibleUtil)
 Construct a new BasicHypercube with provided variables names, the domains of these variables and the utility values.
 BasicHypercube (String name, String[] variables_order, V[][] variables_domains, U[] utility_values, U infeasibleUtil)
 Construct a new BasicHypercube with provided variables names, the domains of these variables and the utility values.
 BasicHypercube (String[] variables_order, V[][] variables_domains, U[] utility_values, U infeasibleUtil, ProblemInterface< V, ?> problem)
 Construct a new BasicHypercube with provided variables names, the domains of these variables and the utility values.
 BasicHypercube ()
 Empty constructor that does nothing.
void writeExternal (ObjectOutput out) throws IOException
void readExternal (ObjectInput in) throws IOException, ClassNotFoundException
void setProblem (ProblemInterface< V, ?> problem)
boolean countsCCs ()
long getNumberOfSolutions ()
 Returns the number of utility values in the hypercube.
getUtility (V[] variables_values)
getUtility (String[] variables_names, V[] variables_values)
getUtility (Map< String, V > assignments)
getUtilityValueSameOrder (String[] variables_names, V[] variables_values)
 Returns an object representing the utility value corresponding to the provided variables values.
getUtility (long 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)
String[] getVariables ()
 Returns the names of the variables of the hypercube.
int getNumberOfVariables ()
 Returns the number of variables in the hypercube.
String getVariable (int index)
 Returns the variable corresponding to the provided index.
void renameVariable (String oldName, String newName)
BasicHypercube< V, U > renameAllVars (String[] newVarNames)
int getIndex (String variable)
 Return the index of the input variable in this hypercube.
V[][] getDomains ()
 Returns the array containing the domains of the variables.
V[] getDomain (String variable)
 Returns an array all the possible values that the variable provided as a parameter can take in this hypercube.
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 variables index in the array of variables order.
void setDomain (String var, V[] dom)
String toString ()
String prettyPrint (U ignoredUtil)
boolean isNull ()
 Check if this hypercube is the NULL hypercube.
void augment (V[] variables_values, U utility_value)
BasicHypercube< V, U > changeVariablesOrder (String[] variables_order)
 Return a new BasicHypercube by changing the order of the variables of the hypercube.
void applyChangeVariablesOrder (String[] variables_order)
 Changes the variable order of the hypercube by reordering the current utility array.
BasicHypercube< V, U > applyAugment (String[] new_variables, V[][] new_domains)
 Augments the hypercube by adding new variables at the beginning of its variables list.
boolean equivalent (final BasicUtilitySolutionSpace< V, U > space)
boolean isIncludedIn (BasicUtilitySolutionSpace< V, U > space)
Iterator< V, U > iterator ()
SparseIterator< V, U > sparseIter ()
Iterator< V, U > iterator (String[] order)
SparseIterator< V, U > sparseIter (String[] order)
Iterator< V, U > iterator (String[] variables, V[][] domains)
SparseIterator< V, U > sparseIter (String[] variables, V[][] domains)
Iterator< V, U > iterator (String[] variables, V[][] domains, V[] assignment)
SparseIterator< V, U > sparseIter (String[] variables, V[][] domains, V[] assignment)
void augment (V[] variables_values)
SolutionSpace< V > join (SolutionSpace< V > space, String[] total_variables)
SolutionSpace< V > join (SolutionSpace< V > space)
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)
BasicHypercube< V, U > slice (String[] variables_names, V[][] sub_domains)
 Return a slice of this hypercube.
BasicHypercube< V, U > applySlice (String[] variables_names, V[][] sub_domains)
 Return a slice of this hypercube this version of slice does not create a new hypercube but directly modifies the current utility array.
boolean equals (Object o)
int hashCode ()
BasicHypercube< V, U > clone ()
BasicHypercube< V, U > resolve ()
BasicHypercube< V, U > resolve (boolean unused)
BasicUtilitySolutionSpace< V, U > slice (String[] variables_names, V[] values)
BasicUtilitySolutionSpace< V, U > slice (String var, V[] subDomain)
BasicUtilitySolutionSpace< V, U > slice (String var, V val)
 Slices this hypercube over a single variable-value assignment.
BasicUtilitySolutionSpace< V, U > slice (V[] variables_values)
 Return a slice of this hypercube.
BasicUtilitySolutionSpace< V, U > compose (final String[] varsOut, final BasicUtilitySolutionSpace< V, ArrayList< V > > subst)
 The composition operation.
boolean orderedDomains ()
 checks that the domains of the hypercube are ordered
getDefaultUtility ()
void setDefaultUtility (U utility)
void setInfeasibleUtility (U utility)
boolean knows (Class<?> spaceClass)
String getName ()
void setName (String name)
String getRelationName ()
void setRelationName (String name)
String getOwner ()
void setOwner (String owner)
 Sets the owner.
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 ()

Static Public Member Functions

static< T > T[] sub (T[] array1, T[] array2)
 Computes the subtraction of two arrays.
static< V extends Addable< V > V[] intersection (V[] array1, V[] array2)
 Computes the intersection between two arrays.

Protected Member Functions

void writeUtilities (ObjectOutput out) throws IOException
 Serializes the utilities.
void readUtilities (ObjectInput in) throws ClassNotFoundException, IOException, InvocationTargetException, NoSuchMethodException
 Deserializes the utilities.
void setNumberOfSolutions (int new_number_of_utilities)
 Modifies the number of utility values in the hypercube (in case the utility array is bigger then the actual number of elements).
void incrNCCCs (long incr)
 Increments the number of constraint checks.
int getIndexOfUtilityValue (V[] variables_values)
 Returns the index of the utility value corresponding to the provided variables values.
SparseIterator< V, U > sparseIter (U inf)
 Creates a sparse iterator that skips a specific utility.
Iterator< V, U > newIter (String[] variables, V[][] domains, V[] assignment, final U skippedUtil)
 Creates a new iterator for this space.
BasicHypercube< V, U > slice (String[] remainingVars, V[][] remainingDoms, V[][] iterDoms, long nbrRemainingUtils, Class<?> domClass)
 Slice method used internally.
BasicHypercube< V, U > newInstance (String name, String[] new_variables, V[][] new_domains, U[] new_values, U infeasibleUtil)
 Creates a new instance of a BasicHypercube.
BasicHypercube< V, U > scalarHypercube (U utility)
 Creates a new instance of a ScalarBasicHypercube.
boolean contains (String[] variables_names)
 Checks if this hypercube contains the provided variables.
boolean contains (String[] variables_names, V[][] variables_domains)
 If any of the input variables is in this hypercube, check that the corresponding input domain is a subset of this variable's domain.
boolean notEmptyDomains (V[][] domains)
 Checks that there is no empty domain in an array of domains.
boolean consistentOrder (BasicHypercube< V, U >[] hypercubes)
 Checks that the variables order is consistent in all hypercubes.
boolean consistentOrder (String[] variables1)
 Checks that input variable order is consistent with the order in this hypercube.

Protected Attributes

String[] variables
 The names of the variables of the hypercube ordered according to their order in the hypercube.
V[][] domains
 The domains of the variables of the hypercube.
transient Class< V > classOfV
 The class of V.
transient V[] assignment
 An array of size variables.length that can be reused, instead of creating a new array each time we need one.
U[] values
 The utility values.
ProblemInterface< V, ?> problem
 The problem that should be notified of constraint checks.
int number_of_utility_values
 The actual number of utilities values in the array.
transient HashMap< V, Integer >[] steps_hashmaps
 For each variable, a hashmap that maps every value in the domain of this variable to a step in the utility values array.
String name = ""
 The name of this space, if any.
infeasibleUtil
 -INF if we are maximizing, +INF if we are minimizing

Package Functions

void setStepsHashmaps ()
 Based on the hypercube parameters this method fills the steps Hashmap that maps each variable of the hypercube to another Hashmaps that maps each possible value of this variable to a step in the utility values array.
void setStepsHashmaps (String[] variables2, V[][] domains2, int number_of_utility_values2)
 Fills the step hashMap of the hypercube.

Static Package Functions

 [static initializer]

Private Member Functions

getUtilityNoNCCCs (V[] variables_values)
 Returns the utility of the input assignment, without incrementing the NCCC counter.
void fillVariablesValues (V[] variables_values, int index, int[] steps)
 Computes the variable assignments corresponding to a given utility value.
Iterator< V, U > iterator (String[] variables, V[][] domains, V[] assignment, final U skippedUtil)
 Returns an iterator.

Private Attributes

String relationName = ""
 The name of the underlying relation.
String owner = null
 The owner of this space.

Static Private Attributes

static int lastID = -1
 The last ID used to instantiate a BasicHypercube.
static HashSet< Class<?> > knownSpaces
 The types of spaces that we know how to handle.

Detailed Description

A basic hypercube that stores one utility per combination of assigments to variables.

Author
Nacereddine Ouaret, Thomas Leaute, Radoslaw Szymanek, Stephane Rabie

The difference with its subclass Hypercube is that a BasicHypercube can contain utilities that are not Addable. The consequence is that BasicHypercube does not provide any method that requires adding or comparing utilities.

Parameters
<V>the type used for variable values
<U>the type used for utility values

Constructor & Destructor Documentation

◆ BasicHypercube() [1/4]

frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.BasicHypercube ( String[] variables_order,
V variables_domains[][],
U[] utility_values,
U infeasibleUtil )

Construct a new BasicHypercube with provided variables names, the domains of these variables and the utility values.

Parameters
variables_orderthe array containing the variables names ordered according to their order in the hypercube
variables_domainsthe domains of the variables contained in the variables_order array and ordered in the same order.
utility_valuesthe utility values contained in a one-dimensional array. there should be a utility value for each possible combination of values that the variables may take.
infeasibleUtil-INF if we are maximizing, +INF if we are minimizing
Warning
variables_domains parameter needs to be sorted in ascending order.
utility_values needs to be properly ordered, the first utility corresponds to the assignment in which each variable is assigned its smallest value.

References infeasibleUtil.

Referenced by [static initializer](), applyAugment(), applySlice(), BasicHypercube(), changeVariablesOrder(), clone(), consistentOrder(), newInstance(), renameAllVars(), resolve(), resolve(), scalarHypercube(), slice(), and slice().

◆ BasicHypercube() [2/4]

frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.BasicHypercube ( String name,
String[] variables_order,
V variables_domains[][],
U[] utility_values,
U infeasibleUtil )

Construct a new BasicHypercube with provided variables names, the domains of these variables and the utility values.

Parameters
namethe name of the BasicHypercube
variables_orderthe array containing the variables names ordered according to their order in the hypercube
variables_domainsthe domains of the variables contained in the variables_order array and ordered in the same order.
utility_valuesthe utility values contained in a one-dimensional array. there should be a utility value for each possible combination of values that the variables may take.
infeasibleUtil-INF if we are maximizing, +INF if we are minimizing
Warning
variables_domains parameter needs to be sorted in ascending order.
utility_values needs to be properly ordered, the first utility corresponds to the assignment in which each variable is assigned its smallest value.

References infeasibleUtil, and name.

◆ BasicHypercube() [3/4]

frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.BasicHypercube ( String[] variables_order,
V variables_domains[][],
U[] utility_values,
U infeasibleUtil,
ProblemInterface< V, ?> problem )

Construct a new BasicHypercube with provided variables names, the domains of these variables and the utility values.

Parameters
variables_orderthe array containing the variables names ordered according to their order in the hypercube
variables_domainsthe domains of the variables contained in the variables_order array and ordered in the same order.
utility_valuesthe utility values contained in a one-dimensional array. there should be a utility value for each possible combination of values that the variables may take.
infeasibleUtil-INF if we are maximizing, +INF if we are minimizing
problemthe problem to be notified of constraint checks
Warning
variables_domains parameter needs to be sorted in ascending order.
utility_values needs to be properly ordered, the first utility corresponds to the assignment in which each variable is assigned its smallest value.

References BasicHypercube(), infeasibleUtil, lastID, problem, setStepsHashmaps(), and values.

Here is the call graph for this function:

◆ BasicHypercube() [4/4]

frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.BasicHypercube ( )

Empty constructor that does nothing.

Member Function Documentation

◆ [static initializer]()

frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.[static initializer]
staticpackage

References BasicHypercube(), and knownSpaces.

Here is the call graph for this function:

◆ applyAugment()

BasicHypercube< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.applyAugment ( String[] new_variables,
V new_domains[][] )

Augments the hypercube by adding new variables at the beginning of its variables list.

Parameters
new_variablesnew variables to augment the hypercube
new_domainsdomains of the new variables
Returns
the augmented hypercube
Todo
check none of the new variables already belong to this hypercube

References applyAugment(), BasicHypercube(), domains, number_of_utility_values, values, and variables.

Referenced by applyAugment().

Here is the call graph for this function:

◆ applyChangeVariablesOrder()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.applyChangeVariablesOrder ( String[] variables_order)

Changes the variable order of the hypercube by reordering the current utility array.

Parameters
variables_orderthe new variables order

already_reordered.remove(i)

References applyChangeVariablesOrder(), domains, fillVariablesValues(), getIndexOfUtilityValue(), number_of_utility_values, setStepsHashmaps(), steps_hashmaps, sub(), values, and variables.

Referenced by applyChangeVariablesOrder().

Here is the call graph for this function:

◆ applySlice()

BasicHypercube< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.applySlice ( String[] variables_names,
V sub_domains[][] )

Return a slice of this hypercube this version of slice does not create a new hypercube but directly modifies the current utility array.

Parameters
variables_namesthe variables to slice
sub_domainsthe domains of the slice
Returns
the new hypercube

References applySlice(), BasicHypercube(), consistentOrder(), contains(), domains, equals(), getIndexOfUtilityValue(), getUtility(), notEmptyDomains(), scalarHypercube(), setNumberOfSolutions(), setStepsHashmaps(), values, and variables.

Referenced by applySlice().

Here is the call graph for this function:

◆ augment() [1/2]

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.augment ( V[] variables_values)
See also
SolutionSpace#augment(Addable[])
Todo
Auto-generated method stub

◆ augment() [2/2]

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

◆ changeVariablesOrder()

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

Return a new BasicHypercube by changing the order of the variables of the hypercube.

Parameters
variables_orderthe new order of the variables
Returns
BasicHypercube object obtained by changing the order of the variables
Warning
The input variable order must contain only and all the variables that belong to the hypercube.
See also
BasicUtilitySolutionSpace.changeVariablesOrder(java.lang.String[])

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References BasicHypercube(), changeVariablesOrder(), domains, getUtilityNoNCCCs(), newInstance(), number_of_utility_values, sub(), and variables.

Referenced by changeVariablesOrder(), and frodo2.solutionSpaces.hypercube.tests.HypercubeTest.testCompose().

Here is the call graph for this function:

◆ clone()

BasicHypercube< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.clone ( )
Returns
a shallow clone of this BasicHypercube
See also
SolutionSpace.clone()

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References BasicHypercube(), clone(), domains, newInstance(), values, and variables.

Referenced by clone(), and resolve().

Here is the call graph for this function:

◆ compose()

BasicUtilitySolutionSpace< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.compose ( final String[] varsOut,
final BasicUtilitySolutionSpace< V, ArrayList< V > > subst )

◆ consistentOrder() [1/2]

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.consistentOrder ( BasicHypercube< V, U >[] hypercubes)
protected

Checks that the variables order is consistent in all hypercubes.

Parameters
hypercubesspace whose variables order is checked
Returns
true is variables order in all hypercubes is consistent
Todo
Why do a break when you could just directly return false? (applies everywhere)

References BasicHypercube(), consistentOrder(), and variables.

Referenced by applySlice(), and consistentOrder().

Here is the call graph for this function:

◆ consistentOrder() [2/2]

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.consistentOrder ( String[] variables1)
protected

Checks that input variable order is consistent with the order in this hypercube.

Parameters
variables1variable order
Returns
true if variables order in both hypercubes is consistent

References variables.

◆ contains() [1/2]

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.contains ( String[] variables_names)
protected

Checks if this hypercube contains the provided variables.

Parameters
variables_namesarray of variables
Returns
true, if this hypercube contains the provided variables. false, if else
Note
This method is only called from within an assert, therefore it is OK if it is not very efficient.

References variables.

Referenced by applySlice(), and slice().

◆ contains() [2/2]

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.contains ( String[] variables_names,
V variables_domains[][] )
protected

If any of the input variables is in this hypercube, check that the corresponding input domain is a subset of this variable's domain.

Parameters
variables_namesarray of variables
variables_domainsarray of variables domains
Returns
true iff any input variable that is contained in the hypercube has a slicing domain that is a subset of its original domain
Note
This method is currently only called from within an assert statement.

References getDomain(), and variables.

Here is the call graph for this function:

◆ countsCCs()

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.countsCCs ( )
See also
UtilitySolutionSpace#countsCCs()

◆ equals()

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.equals ( Object o)
See also
java.lang.Object#equals(java.lang.Object)

References equivalent(), and frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.getVariables().

Referenced by applySlice(), getDomain(), and getIndex().

Here is the call graph for this function:

◆ equivalent()

◆ fillVariablesValues()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.fillVariablesValues ( V[] variables_values,
int index,
int[] steps )
private

Computes the variable assignments corresponding to a given utility value.

Parameters
variables_valuesthe array to be filled
indexindex of the value in the utility array
stepsarray storing the step for each variable

References domains, and variables.

Referenced by applyChangeVariablesOrder().

◆ getClassOfU()

Class< U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getClassOfU ( )
Returns
the class used for utility values

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References getClassOfU().

Referenced by compose(), and getClassOfU().

Here is the call graph for this function:

◆ getDefaultUtility()

◆ getDomain() [1/3]

V[] frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.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 variable

References domains, and variables.

◆ getDomain() [2/3]

V[] frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getDomain ( String variable)

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

Parameters
variablethe name of the variable
Returns
the variable domain

References domains, and variables.

Referenced by compose(), contains(), iterator(), and frodo2.solutionSpaces.hypercube.tests.HypercubeTest.testCompose().

◆ getDomain() [3/3]

V[] frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getDomain ( String variable,
int index )

Returns the variable's domain if index is the variables 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 hypercube at the provided index

References domains, equals(), and variables.

Here is the call graph for this function:

◆ getDomains()

V[][] frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getDomains ( )

Returns the array containing the domains of the variables.

Returns
two-dimensional array containing the domains of the variables

References domains.

Referenced by sparseIter().

◆ getIndex()

int frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getIndex ( String variable)

Return the index of the input variable in this hypercube.

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

References equals(), and variables.

Referenced by renameVariable(), and setDomain().

Here is the call graph for this function:

◆ getIndexOfUtilityValue()

int frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getIndexOfUtilityValue ( V[] variables_values)
protected

Returns the index of the utility value corresponding to the provided variables values.

Parameters
variables_valuesthe variables values
Returns
Integer representing the index of the utility value corresponding to the provided variables values. If given assignment is not present then index of utility value for that assignment is equal to -1.

References steps_hashmaps, and variables.

Referenced by applyChangeVariablesOrder(), applySlice(), getUtility(), getUtilityNoNCCCs(), and setUtility().

◆ getName()

String frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getName ( )
See also
SolutionSpace.getName()

References name.

◆ getNumberOfSolutions()

long frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getNumberOfSolutions ( )

Returns the number of utility values in the hypercube.

Returns
integer representing the number of utility values in the hypercube

References number_of_utility_values.

Referenced by resolve(), and slice().

◆ getNumberOfVariables()

◆ getOwner()

String frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getOwner ( )
See also
SolutionSpace.getOwner()

References owner.

◆ getRelationName()

String frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getRelationName ( )

◆ getUtility() [1/4]

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

◆ getUtility() [2/4]

U frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getUtility ( Map< String, V > assignments)
See also
BasicUtilitySolutionSpace.getUtility(java.util.Map)
Warning
returns null if not all variables in the space are assigned values

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References getUtility().

Here is the call graph for this function:

◆ getUtility() [3/4]

U frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getUtility ( String[] variables_names,
V[] variables_values )
See also
BasicUtilitySolutionSpace.getUtility(java.lang.String[], Addable[])
Warning
returns null if not all variables in the space are assigned values

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References getUtility(), and variables.

Here is the call graph for this function:

◆ getUtility() [4/4]

U frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getUtility ( V[] variables_values)
See also
frodo2.solutionSpaces.BasicUtilitySolutionSpace#getUtility(Addable[])
Warning
returns null if the input does not specify a value for each variable in the space

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References getIndexOfUtilityValue(), incrNCCCs(), and values.

Referenced by applySlice(), compose(), getUtility(), getUtility(), getUtilityValueSameOrder(), slice(), frodo2.solutionSpaces.hypercube.tests.HypercubeTest.testCompose(), and frodo2.solutionSpaces.hypercube.tests.HypercubeTest.verifyProjection().

Here is the call graph for this function:

◆ getUtilityNoNCCCs()

U frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getUtilityNoNCCCs ( V[] variables_values)
private

Returns the utility of the input assignment, without incrementing the NCCC counter.

Parameters
variables_valuesassignment
Returns
corresponding utility

References getIndexOfUtilityValue(), and values.

Referenced by changeVariablesOrder().

Here is the call graph for this function:

◆ getUtilityValueSameOrder()

U frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getUtilityValueSameOrder ( String[] variables_names,
V[] variables_values )

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

This method assumes that the order of the variables in the input array of variables is consistent with the order used in the hypercube.

Parameters
variables_namesthe names of the variables
variables_valuesthe values of the variables
Returns
the utility value corresponding the provided variables values. It returns null if no utility variable was found.

References getUtility(), and variables.

Here is the call graph for this function:

◆ getVariable()

String frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getVariable ( int index)

Returns the variable corresponding to the provided index.

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

References variables.

◆ getVariables()

String[] frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.getVariables ( )

Returns the names of the variables of the hypercube.

Returns
String array containing the names of the variables of the hypercube

References variables.

Referenced by compose(), sparseIter(), and frodo2.solutionSpaces.hypercube.tests.HypercubeTest.testCompose().

◆ hashCode()

int frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.hashCode ( )
See also
java.lang.Object#hashCode()

References hashCode(), and name.

Referenced by hashCode().

Here is the call graph for this function:

◆ incrNCCCs()

◆ intersection()

static< V extends Addable< V > V[] frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.intersection ( V[] array1,
V[] array2 )
static

Computes the intersection between two arrays.

Parameters
<V>the type of the entries in the arrays
array1the first array
array2the second array
Returns
Array containing the intersection of array1 and array2; null (NOT an empty array) if the intersection is empty
Warning
This assumes that the two arrays are ordered.

References intersection().

Referenced by intersection(), iterator(), and frodo2.solutionSpaces.JaCoP.JaCoPutilSpace< V extends Addable< V > >.iterator().

Here is the call graph for this function:

◆ isIncludedIn()

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.isIncludedIn ( BasicUtilitySolutionSpace< V, U > space)
See also
BasicUtilitySolutionSpace#isIncludedIn(BasicUtilitySolutionSpace)
Todo
Auto-generated method stub

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

◆ isNull()

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.isNull ( )

Check if this hypercube is the NULL hypercube.

Returns
true if the hypercube is the NULL hypercube and false if else

References frodo2.solutionSpaces.hypercube.Hypercube< V extends Addable< V >, U extends Addable< U > >.NullHypercube< V extends Addable< V >, U extends Addable< U > >.NULL.

◆ iterator() [1/5]

◆ iterator() [2/5]

Iterator< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.iterator ( String[] order)
See also
SolutionSpace.iterator(java.lang.String[])

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References newIter().

Here is the call graph for this function:

◆ iterator() [3/5]

Iterator< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.iterator ( String[] variables,
V domains[][] )
See also
BasicUtilitySolutionSpace.iterator(java.lang.String[], Addable[][])

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References domains, iterator(), and variables.

Here is the call graph for this function:

◆ iterator() [4/5]

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

◆ iterator() [5/5]

Iterator< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.iterator ( String[] variables,
V domains[][],
V[] assignment,
final U skippedUtil )
private

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()
skippedUtilThe utility value that the sparse iterator should skip (if any)
Returns
an iterator which allows to iterate over the given variables and their utilities

References assignment, domains, getDomain(), intersection(), iterator(), newIter(), and variables.

Here is the call graph for this function:

◆ join() [1/4]

SolutionSpace< V > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.join ( SolutionSpace< V > space)
See also
SolutionSpace#join(SolutionSpace)

◆ join() [2/4]

SolutionSpace< V > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.join ( SolutionSpace< V > space,
String[] total_variables )
See also
SolutionSpace.join(SolutionSpace, java.lang.String[])
Todo
Auto-generated method stub

◆ join() [3/4]

SolutionSpace< V > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.join ( SolutionSpace< V >[] spaces)
See also
SolutionSpace#join(SolutionSpace[])
Todo
Auto-generated method stub

◆ join() [4/4]

SolutionSpace< V > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.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 the solutionSpaces to be added to this solutionSpace
total_variables_orderthe order of the variables in all solutionSpaces
Returns
SolutionSpace object obtained by joining this SolutionSpace with all the SolutionSpaces in the array of SolutionSpaces Originally this function in the hypercubes assumes that order is not conflicting.

◆ knows()

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.knows ( Class<?> spaceClass)
See also
SolutionSpace#knows(Class)

References knownSpaces.

◆ newInstance()

BasicHypercube< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.newInstance ( String name,
String[] new_variables,
V new_domains[][],
U[] new_values,
U infeasibleUtil )
protected

Creates a new instance of a BasicHypercube.

Parameters
namethe name of the new BasicHypercube
new_variableslist of variables
new_domainslist of domains
new_valuesarray of utility values
infeasibleUtil-INF if we are maximizing, +INF if we are minimizing
Returns
a new BasicHypercube

References BasicHypercube(), infeasibleUtil, and name.

Referenced by changeVariablesOrder(), clone(), compose(), renameAllVars(), and slice().

Here is the call graph for this function:

◆ newIter()

Iterator< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.newIter ( String[] variables,
V domains[][],
V[] assignment,
final U skippedUtil )
protected

Creates a new iterator for this space.

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()
skippedUtilA utility value that should be skipped (if null, nothing is skipped)
Returns
a new iterator

References assignment, domains, and variables.

Referenced by iterator(), iterator(), iterator(), sparseIter(), and sparseIter().

◆ notEmptyDomains()

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.notEmptyDomains ( V domains[][])
protected

Checks that there is no empty domain in an array of domains.

Parameters
domainsarray containing domains
Returns
true if provided array of domains contains no empty domain

References domains.

Referenced by applySlice(), and slice().

◆ orderedDomains()

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.orderedDomains ( )

checks that the domains of the hypercube are ordered

Returns
true if the values of the variables in the domains of the hypercube are ordered

References domains, and variables.

◆ prettyPrint()

◆ readExternal()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.readExternal ( ObjectInput in) throws IOException, ClassNotFoundException
See also
java.io.Externalizable#readExternal(java.io.ObjectInput)

References readExternal(), readUtilities(), and setStepsHashmaps().

Referenced by readExternal().

Here is the call graph for this function:

◆ readUtilities()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.readUtilities ( ObjectInput in) throws ClassNotFoundException, IOException, InvocationTargetException, NoSuchMethodException
protected

Deserializes the utilities.

Parameters
inthe input stream
Exceptions
ClassNotFoundExceptionshould never happen
IOExceptionif an I/O error occurs
InvocationTargetExceptionwhen failing to instantiate instances of the utility class
NoSuchMethodExceptionwhen failing to instantiate instances of the utility class

References readUtilities().

Referenced by readExternal(), and readUtilities().

Here is the call graph for this function:

◆ renameAllVars()

BasicHypercube< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.renameAllVars ( String[] newVarNames)
See also
SolutionSpace.renameAllVars(java.lang.String[])

References BasicHypercube(), domains, infeasibleUtil, newInstance(), setProblem(), and values.

Here is the call graph for this function:

◆ renameVariable()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.renameVariable ( String oldName,
String newName )
See also
SolutionSpace.renameVariable(String, String)

References getIndex().

Here is the call graph for this function:

◆ resolve() [1/2]

BasicHypercube< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.resolve ( )

◆ resolve() [2/2]

◆ scalarHypercube()

BasicHypercube< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.scalarHypercube ( U utility)
protected

Creates a new instance of a ScalarBasicHypercube.

Parameters
utilitythe utility of the scalar hypercube
Returns
a new instance of a ScalarBasicHypercube

References BasicHypercube().

Referenced by applySlice(), compose(), and slice().

Here is the call graph for this function:

◆ setDefaultUtility()

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

◆ setDomain()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.setDomain ( String var,
V[] dom )
See also
SolutionSpace#setDomain(String, Addable[])

References getIndex().

Here is the call graph for this function:

◆ setInfeasibleUtility()

◆ setName()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.setName ( String name)
See also
SolutionSpace.setName(String)

References name.

◆ setNumberOfSolutions()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.setNumberOfSolutions ( int new_number_of_utilities)
protected

Modifies the number of utility values in the hypercube (in case the utility array is bigger then the actual number of elements).

Parameters
new_number_of_utilitiesnew number of utilities of the hypercube

References number_of_utility_values.

Referenced by applySlice().

◆ setOwner()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.setOwner ( String owner)

Sets the owner.

Parameters
ownerthe owner

References owner.

◆ setProblem()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.setProblem ( ProblemInterface< V, ?> problem)
See also
SolutionSpace#setProblem(ProblemInterface)

References problem.

Referenced by renameAllVars().

◆ setRelationName()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.setRelationName ( String name)

◆ setStepsHashmaps() [1/2]

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.setStepsHashmaps ( )
package

Based on the hypercube parameters this method fills the steps Hashmap that maps each variable of the hypercube to another Hashmaps that maps each possible value of this variable to a step in the utility values array.

References setStepsHashmaps().

Referenced by applyChangeVariablesOrder(), applySlice(), BasicHypercube(), readExternal(), setStepsHashmaps(), and setStepsHashmaps().

Here is the call graph for this function:

◆ setStepsHashmaps() [2/2]

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.setStepsHashmaps ( String[] variables2,
V domains2[][],
int number_of_utility_values2 )
package

Fills the step hashMap of the hypercube.

Parameters
variables2list of variables
domains2list of domains
number_of_utility_values2number of utility values

References setStepsHashmaps(), and steps_hashmaps.

Here is the call graph for this function:

◆ setUtility() [1/2]

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

◆ setUtility() [2/2]

boolean frodo2.solutionSpaces.hypercube.BasicHypercube< 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 hypercube
utilitythe new utility value
See also
BasicUtilitySolutionSpace.setUtility(Addable[], java.io.Serializable)

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References getIndexOfUtilityValue(), and values.

Referenced by frodo2.solutionSpaces.vehiclerouting.VehicleRoutingSpace< U extends Addable< U > >.project().

Here is the call graph for this function:

◆ slice() [1/6]

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

Slices this hypercube over a single variable-value assignment.

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

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References slice().

Here is the call graph for this function:

◆ slice() [2/6]

BasicUtilitySolutionSpace< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.slice ( String var,
V[] subDomain )
See also
BasicUtilitySolutionSpace.slice(java.lang.String, Addable[])

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References slice().

Here is the call graph for this function:

◆ slice() [3/6]

BasicHypercube< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.slice ( String[] remainingVars,
V remainingDoms[][],
V iterDoms[][],
long nbrRemainingUtils,
Class<?> domClass )
protected

Slice method used internally.

Parameters
remainingVarsthe remaining variables
remainingDomsthe domains of the remaining variables
iterDomsthe domain slices for this space's variables
nbrRemainingUtilsthe number of remaining utilities
domClassthe class of V[]
Returns
the corresponding sliced space
Bug
Don't count NCCCs

References BasicHypercube(), iterator(), newInstance(), frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.SparseIterator< V, U >.nextUtility(), and slice().

Here is the call graph for this function:

◆ slice() [4/6]

BasicUtilitySolutionSpace< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.slice ( String[] variables_names,
V[] values )
See also
BasicUtilitySolutionSpace.slice(java.lang.String[], Addable[])

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References slice(), and values.

Here is the call graph for this function:

◆ slice() [5/6]

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

Return a slice of this hypercube.

Parameters
variables_namesthe variables to slice
sub_domainsthe domains of the slice
Returns
Hypercube representing a slice of this hypercube
Warning
Returns itself if the slice has no effect
Author
Thomas Leaute

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References BasicHypercube(), contains(), getNumberOfSolutions(), getUtility(), notEmptyDomains(), scalarHypercube(), and slice().

Referenced by slice(), slice(), slice(), slice(), slice(), and slice().

Here is the call graph for this function:

◆ slice() [6/6]

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

Return a slice of this hypercube.

Parameters
variables_valuesarray containing values of the last variables of the hypercube
Returns
Hypercube object obtained by associating fixed values to the last variables of the hypercube. the number of this variables depends on the length of the provided array of variables values

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References domains, number_of_utility_values, slice(), steps_hashmaps, and variables.

Here is the call graph for this function:

◆ sparseIter() [1/5]

SparseIterator< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.sparseIter ( )

◆ sparseIter() [2/5]

SparseIterator< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.sparseIter ( String[] order)
See also
SolutionSpace.sparseIter(java.lang.String[])

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References newIter().

Here is the call graph for this function:

◆ sparseIter() [3/5]

SparseIterator< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.sparseIter ( String[] variables,
V domains[][] )
See also
BasicUtilitySolutionSpace.sparseIter(java.lang.String[], Addable[][])

Implements frodo2.solutionSpaces.BasicUtilitySolutionSpace< V extends Addable< V >, U extends Serializable >.

References domains, iterator(), and variables.

Here is the call graph for this function:

◆ sparseIter() [4/5]

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

◆ sparseIter() [5/5]

SparseIterator< V, U > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.sparseIter ( U inf)
protected

Creates a sparse iterator that skips a specific utility.

Parameters
infthe utility to skip
Returns
a sparse iterator

References getDomains(), getVariables(), and newIter().

Here is the call graph for this function:

◆ sub()

static< T > T[] frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.sub ( T[] array1,
T[] array2 )
static

Computes the subtraction of two arrays.

Parameters
<T>the arrays' component type
array1the first array
array2the second array
Returns
substraction

References sub().

Referenced by applyChangeVariablesOrder(), changeVariablesOrder(), compose(), and sub().

Here is the call graph for this function:

◆ toString()

String frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.toString ( )
See also
java.lang.Object#toString()

References domains, values, and variables.

◆ writeExternal()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.writeExternal ( ObjectOutput out) throws IOException
See also
java.io.Externalizable#writeExternal(java.io.ObjectOutput)

References writeUtilities().

Here is the call graph for this function:

◆ writeUtilities()

void frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.writeUtilities ( ObjectOutput out) throws IOException
protected

Serializes the utilities.

Parameters
outthe output stream
Exceptions
IOExceptionif an I/O error occurs

References incrNCCCs().

Referenced by writeExternal().

Here is the call graph for this function:

Member Data Documentation

◆ assignment

transient V [] frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.assignment
protected

An array of size variables.length that can be reused, instead of creating a new array each time we need one.

Referenced by compose(), iterator(), iterator(), newIter(), and sparseIter().

◆ classOfV

transient Class<V> frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.classOfV
protected

The class of V.

Referenced by compose().

◆ domains

◆ infeasibleUtil

U frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.infeasibleUtil
protected

-INF if we are maximizing, +INF if we are minimizing

Referenced by BasicHypercube(), BasicHypercube(), BasicHypercube(), newInstance(), and renameAllVars().

◆ knownSpaces

HashSet< Class<?> > frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.knownSpaces
staticprivate

The types of spaces that we know how to handle.

Referenced by [static initializer](), and knows().

◆ lastID

int frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.lastID = -1
staticprivate

The last ID used to instantiate a BasicHypercube.

Referenced by BasicHypercube().

◆ name

String frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.name = ""
protected

The name of this space, if any.

Referenced by BasicHypercube(), getName(), hashCode(), newInstance(), setName(), and setRelationName().

◆ number_of_utility_values

◆ owner

String frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.owner = null
private

The owner of this space.

Referenced by getOwner(), and setOwner().

◆ problem

ProblemInterface<V, ?> frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.problem
protected

The problem that should be notified of constraint checks.

Referenced by BasicHypercube(), incrNCCCs(), and setProblem().

◆ relationName

String frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.relationName = ""
private

The name of the underlying relation.

Referenced by getRelationName().

◆ steps_hashmaps

transient HashMap< V, Integer > [] frodo2.solutionSpaces.hypercube.BasicHypercube< V extends Addable< V >, U extends Serializable >.steps_hashmaps
protected

For each variable, a hashmap that maps every value in the domain of this variable to a step in the utility values array.

This is used to speed up access to the utility value of a given combination of variable-value assignments, by avoiding to recompute the position of that utility value in the utility array from scratch every time.

Referenced by applyChangeVariablesOrder(), getIndexOfUtilityValue(), setStepsHashmaps(), and slice().

◆ values

◆ variables


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