Cream version 1.06 Core API Specification

jp.ac.kobe_u.cs.cream
Class Code

java.lang.Object
  extended by jp.ac.kobe_u.cs.cream.Code
All Implemented Interfaces:
Cloneable

public class Code
extends Object
implements Cloneable

Code is a list of conditions extracted from a currently solved network. A code represents additional conditions for the current solution. You can generate neighbor conditions, and use the conditions to find neighbor solutions as follows. Only useful for the problems containing Serialized constraints in the current implementation.

 // Get a code from a solution
 Code code = solution.getCode();
 // Get applicable operations for the code
 List<Operation> operations = code.operations();
 // Choose an operation to generate a neighbor condition
 Operation op = operations.get(0);
 // Set the code to the network
 code.setTo(network);
 // Apply the operation to set a neighbor condition
 op.applyTo(network);
 // Find a neighbor solution which satisfies the neighbor condition
 Solution sol = solver.findBest();
 

Since:
1.0
See Also:
Solution, Condition, Operation, Serialized, LocalSearch

Field Summary
 Condition[] conditions
           
 
Constructor Summary
Code(Network network)
          Constructs a code from the given network.
 
Method Summary
 Object clone()
          Returns a copy of this code.
 List<Operation> operations()
          Returns possible operations applicable to the code.
 void setTo(Network network)
          Sets the conditions of this code to the network.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conditions

public Condition[] conditions
Constructor Detail

Code

public Code(Network network)
Constructs a code from the given network.

Parameters:
network - the constraint network
Method Detail

clone

public Object clone()
Returns a copy of this code.

Overrides:
clone in class Object
Returns:
a copy of this code

setTo

public void setTo(Network network)
Sets the conditions of this code to the network.

Parameters:
network - the network

operations

public List<Operation> operations()
Returns possible operations applicable to the code.

Returns:
possible operations

Cream version 1.06 Core API Specification

Cream: Constraint Programming Class Library for Java