Class Ibex


  • public class Ibex
    extends Object
    • 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