Class MispProblem
Problem.
The problem is defined on a weighted undirected graph. Each node can either be included in the independent set or not, and selected nodes cannot be adjacent.
The state of the problem is represented by a BitSet indicating which nodes
can still be selected. The solver explores decisions for each node to build an
independent set of maximum weight.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMispProblem(String fname) Loads a MISP problem from a DOT file.MispProblem(BitSet remainingNodes, BitSet[] neighbors, int[] weight) Constructs a MISP problem with a given state, adjacency lists, and weights.MispProblem(BitSet remainingNodes, BitSet[] neighbors, int[] weight, double optimal) Constructs a MISP problem with a given state, adjacency lists, weights, and known optimal value. -
Method Summary
Modifier and TypeMethodDescriptionReturns the domain of possible values for a given variable when applied to a specific state.doubleevaluate(int[] solution) Given a solution such thatsolution[i]is the value of the variablex_i, returns the value of this solution and checks if the solution respects the problem's constraints.Returns the initial state of the problem.doubleReturns the initial objective value associated with the initial state.intnbVars()Returns the known optimal value of the problem, if available.toString()transition(BitSet state, Decision decision) Applies a decision to a state, computing the next state according to the problem's transition function.doubletransitionCost(BitSet state, Decision decision) Computes the change in objective value resulting from applying a decision to a given state.
-
Field Details
-
remainingNodes
The remaining nodes that can be selected in the current independent set. Considered as the state of the decision diagram. -
neighbors
For each nodei,neighbors[i]contains the adjacency list ofi. -
weight
public final int[] weightFor each nodei,weight[i]contains the weight associated withi.
-
-
Constructor Details
-
MispProblem
Constructs a MISP problem with a given state, adjacency lists, weights, and known optimal value.- Parameters:
remainingNodes- the initial set of selectable nodesneighbors- adjacency lists for each nodeweight- weights of each nodeoptimal- known optimal solution value
-
MispProblem
Constructs a MISP problem with a given state, adjacency lists, and weights. The optimal solution is unknown.- Parameters:
remainingNodes- the initial set of selectable nodesneighbors- adjacency lists for each nodeweight- weights of each node
-
MispProblem
Loads a MISP problem from a DOT file.The file must contain the list of nodes and edges. Node weights can be specified with
[weight=w](default weight is 1). If known, the optimal solution should be specified in the second line asoptimal=x.- Parameters:
fname- path to the DOT file describing the graph- Throws:
IOException- if an error occurs while reading the file
-
-
Method Details
-
toString
-
nbVars
public int nbVars() -
initialState
Description copied from interface:ProblemReturns the initial state of the problem.- Specified by:
initialStatein interfaceProblem<BitSet>- Returns:
- the state representing the starting point of the optimization
-
initialValue
public double initialValue()Description copied from interface:ProblemReturns the initial objective value associated with the initial state.- Specified by:
initialValuein interfaceProblem<BitSet>- Returns:
- the starting value of the objective function
-
domain
Description copied from interface:ProblemReturns the domain of possible values for a given variable when applied to a specific state. -
transition
Description copied from interface:ProblemApplies a decision to a state, computing the next state according to the problem's transition function.- Specified by:
transitionin interfaceProblem<BitSet>- Parameters:
state- the state from which the transition originatesdecision- the decision to apply- Returns:
- the resulting state after applying the decision
-
transitionCost
Description copied from interface:ProblemComputes the change in objective value resulting from applying a decision to a given state.- Specified by:
transitionCostin interfaceProblem<BitSet>- Parameters:
state- the state from which the transition originatesdecision- the decision to apply- Returns:
- the incremental objective cost/value associated with this decision
-
optimalValue
Description copied from interface:ProblemReturns the known optimal value of the problem, if available.Note: This value should correspond to the expected output of the solver. For maximization problems, be careful with negative values.
- Specified by:
optimalValuein interfaceProblem<BitSet>- Returns:
- an
Optionalcontaining the known optimal value, or empty if unknown
-
evaluate
Description copied from interface:ProblemGiven a solution such thatsolution[i]is the value of the variablex_i, returns the value of this solution and checks if the solution respects the problem's constraints.Note: For maximization problems, the returned value is minus the computed value.
- Specified by:
evaluatein interfaceProblem<BitSet>- Parameters:
solution- A solution of the problem.- Returns:
- The value of the input solution
- Throws:
InvalidSolutionException- If the solution does not respect problem's constraints.
-