- java.lang.Object
-
- org.chocosolver.solver.constraints.real.Ibex
-
public class Ibex extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
BAD_DOMAIN
static int
BAD_POINT
static int
CONTRACT
static int
DISCRETE_NOT_INSTANCIATED
static int
ENTAILED
static int
FAIL
static int
FALSE
static int
FALSE_OR_TRUE
static int
FULL_INFLATE
static int
INFLATE
static int
NOT_BUILT
static int
NOT_SIGNIFICANT
static int
NOT_STARTED
static int
NOTHING
static double
RATIO
static int
SEARCH_OVER
static int
SOLUTION
static int
STARTED
static int
TRUE
static int
UNKNOWN
static int
UNKNOWN_POINT
-
Constructor Summary
Constructors Constructor Description Ibex(double[] prec)
Create a new Ibex object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add_ctr(String syntax)
Add a new constraint.boolean
build()
Build the object (with all constraints added via add_ctr(...))int
contract(int i, double[] bounds)
Same as contract(int, double bounds[], int reif) with reif=TRUE.int
contract(int i, double[] bounds, int reif)
Call the contractor associated to a constraint or its negation.int
inflate(int i, double[] p, double[] bounds, boolean in)
Inflate a point to a box with respect to a constraint or its negation.int
next_solution(double[] sol)
Look up for the next solution.void
release()
Free IBEX structures from memoryint
start_solve(double[] bounds)
Let IBEX terminates the solving process for the CSP, once all the integer variables have been instanciated.
-
-
-
Field Detail
-
RATIO
public static final double RATIO
- See Also:
- Constant Field Values
-
FAIL
public static final int FAIL
- See Also:
- Constant Field Values
-
ENTAILED
public static final int ENTAILED
- See Also:
- Constant Field Values
-
CONTRACT
public static final int CONTRACT
- See Also:
- Constant Field Values
-
NOTHING
public static final int NOTHING
- See Also:
- Constant Field Values
-
NOT_SIGNIFICANT
public static final int NOT_SIGNIFICANT
- See Also:
- Constant Field Values
-
INFLATE
public static final int INFLATE
- See Also:
- Constant Field Values
-
FULL_INFLATE
public static final int FULL_INFLATE
- See Also:
- Constant Field Values
-
BAD_POINT
public static final int BAD_POINT
- See Also:
- Constant Field Values
-
UNKNOWN_POINT
public static final int UNKNOWN_POINT
- See Also:
- Constant Field Values
-
STARTED
public static final int STARTED
- See Also:
- Constant Field Values
-
DISCRETE_NOT_INSTANCIATED
public static final int DISCRETE_NOT_INSTANCIATED
- See Also:
- Constant Field Values
-
UNKNOWN
public static final int UNKNOWN
- See Also:
- Constant Field Values
-
SOLUTION
public static final int SOLUTION
- See Also:
- Constant Field Values
-
SEARCH_OVER
public static final int SEARCH_OVER
- See Also:
- Constant Field Values
-
NOT_STARTED
public static final int NOT_STARTED
- See Also:
- Constant Field Values
-
FALSE
public static final int FALSE
- See Also:
- Constant Field Values
-
TRUE
public static final int TRUE
- See Also:
- Constant Field Values
-
FALSE_OR_TRUE
public static final int FALSE_OR_TRUE
- See Also:
- Constant Field Values
-
BAD_DOMAIN
public static final int BAD_DOMAIN
- See Also:
- Constant Field Values
-
NOT_BUILT
public static final int NOT_BUILT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Ibex
public Ibex(double[] prec)
Create a new Ibex object. An IBEX (and only one) object has to be created for each different CSP. The IBEX object gathers all the constraints.- Parameters:
prec
- - An array of n double (where n is the total number of variables of the CSP). Each double indicates whether a variable is integral or not, and in the case of a real variable, the precision required. More precisely: prec[i]==-1 => the ith variable is integral. prec[i]>=0 => the ith variable is real and the precision is prec[i].
-
-
Method Detail
-
add_ctr
public boolean add_ctr(String syntax)
Add a new constraint. Important: The "build()" method has to be called once all constraints are added. Example: add_ctr({0}={1}) will add the constraint x=y.- Parameters:
syntax
- - The constraint- Returns:
- true - OK (success) false - error: build() has already been called.
-
build
public boolean build()
Build the object (with all constraints added via add_ctr(...))- Returns:
- true - OK (success) false - error: one constraint has not been parsed successfully.
-
contract
public int contract(int i, double[] bounds, int reif)
Call the contractor associated to a constraint or its negation. We consider here the reified constraint R(b,c) : b<=>c(x_1,...,x_n).- Parameters:
i
- - Number of the constraint (in the order of creation)bounds
- - The bounds of domains under the following form: (x1-,x1+,x2-,x2+,...,xn-,xn+), where xi- (resp. xi+) is the lower (resp. upper) bound of the domain of x_i.reif
- - Domain of the reification variable b with the following accepted values: FALSE, TRUE, FALSE_OR_TRUE.- Returns:
- The status of contraction or fail/entailment test. Note that the name of the constant in return refers to the constraint c, not R. Hence "FAIL" means that no tuple satisfies c (should R be satisfiable or not). FAIL - No tuple satisfies c. If reif==FALSE, the bounds of x may have been impacted (the part of the domain inside c has been removed and the remaining part has been proven to be outside c). If reif==TRUE, the bounds have not been impacted but we have to consider that the domain has been reduced to the empty set. If reif==FALSE_OR_TRUE, bounds have not been impacted. ENTAILED - All the tuples satisfy the constraint. If reif==FALSE, the bounds have not been impacted but we have to consider that the domain has been reduced to the empty set. If reif==TRUE, the bounds of x may have been impacted (the part of the domain outside c has been removed and the remaining part has been proven to be inside c). If reif==FALSE_OR_TRUE, bounds have not been impacted. CONTRACT - This value can only be returned if reif==FALSE or reif==TRUE. At least one bound of x has been reduced by more than RATIO. If reif==FALSE, the removed part of the domain is inside c. If reif==TRUE, the removed part is outside. NOTHING - No bound has been reduced and nothing could be proven. BAD_DOMAIN - The domain has not the expected number of dimensions. NOT_BUILT - Object not built (build() must be called before)
-
inflate
public int inflate(int i, double[] p, double[] bounds, boolean in)
Inflate a point to a box with respect to a constraint or its negation. Given a constraint "c", we say that a point is "inside" (resp. "outside") if it satisfies (resp. does not satisfy) c. A box is said to be "inside"/"outside" if all its points are inside/outside c. This method takes an initial point "p" and an enclosing box "x". It tries to inflate p inside x with respect to a constraint "c" or its negation. That is, it builds a box "y", containing p and contained in "x":
p ∈ y ⊆ x
If in==TRUE, y must be inside c. Otherwise, it must be outside.- Parameters:
i
- - Number of the constraint c (in the order of creation)p
- - The coordinates of the point to inflate: (p1,...pn)bounds
- - The bounds of the enclosing box x under the following form: (x1-,x1+,x2-,x2+,...,xn-,xn+), where xi- (resp. xi+) is the lower (resp. upper) bound of the domain of x_i.in
- - TRUE if the box has to be inflated inside c (-> inner region), FALSE if it has to be inflated outside c (-> forbidden region).- Returns:
- The status of inflation. If in==TRUE (resp. FALSE): NOT_SIGNIFICANT - The point p has been proven to be inside (resp. outside). However, it could not be inflated to a "significant" box y. A box y is considered to be significant if, on each of its dimension, the width of the interval y_i is at least RATIO times the width of x_i. INFLATE - The point p has been inflated to a significant box y that is inside (reps. outside) the constraint. FULL_INFLATE - The whole box x has been proven to be inside (resp. outside). BAD_POINT - No inflation was possible because p has been proven to be outside (resp. inside). UNKWOWN_POINT - No inflation at all could be done and it could even not be decided whether p is inside or outside the constraint. BAD_DOMAIN - The domain has not the expected number of dimensions. NOT_BUILT - Object not built (build() must be called before)
-
contract
public int contract(int i, double[] bounds)
Same as contract(int, double bounds[], int reif) with reif=TRUE.
-
start_solve
public int start_solve(double[] bounds)
Let IBEX terminates the solving process for the CSP, once all the integer variables have been instanciated. This function initializes the solving process. Each solution is then retrieved in turn via a call to next_solution(...).- Parameters:
bounds
- - the domain in which all solutions will be searched (include all variables, real and integer ones).- Returns:
- SUCCESS _ - OK DISCRETE_NOT_INSTANCIATED - One discrete variable is not instanciated BAD_DOMAIN - The domain has not the expected number of dimensions. NOT_BUILT - Object not built (build() must be called before))
-
next_solution
public int next_solution(double[] sol)
Look up for the next solution. The first call to solution(...) in a given solving process must be preceded by a call to start_solve(...). domains - (output argument): array in which the solution will be stored (if any)- Returns:
- SOLUTION - A certified solution has been found UNKNOWN - An uncertified solution has been found SEARCH_OVER - No more solution BAD_DOMAIN - The domain has not the expected number of dimensions. NOT_BUILT - Object not built (build() must be called before))
-
release
public void release()
Free IBEX structures from memory
-
-