Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Inject a partially specified incumbent? (Java API)

    Posted 06/24/10 04:50 PM

    Originally posted by: SystemAdmin


    Does IloCplex.HeuristicCallback.setSolution work with a partially specified solution (not all variables included in the arguments), the way setVectors does? If, say, I just specify values for all integer variables, will CPLEX solve an LP to fill in the continuous variables and then accept the solution? Or do I have to specify values for every variable?

    Thanks,
    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Inject a partially specified incumbent? (Java API)

    Posted 06/24/10 04:58 PM

    Originally posted by: SystemAdmin


    You have to specify values for all variables.

    The preferred way to do what you want to do is
    1. Fix the variables for which you have values using HeuristicCallback.setBounds(). These bound settings are only local to the current callback invocation.
    2. Use HeuristicCallback.solve() to solve the problem (including the variable fixings).
    3. Use HeuristicCallback.getValues() and HeuristicCallback.setSolution() to inject the solution found in the previous step (if any).
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Inject a partially specified incumbent? (Java API)

    Posted 06/24/10 05:00 PM

    Originally posted by: SystemAdmin


    One more hint: Make sure that you don't invoke HeuristicCallback.setBounds() on variables that have been presolved out (this will throw an exception).
    To find which variables were removed by presolve use ControlCallback.getFeasibility(). Variables with feasibility "Implied" were removed by presolve.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Inject a partially specified incumbent? (Java API)

    Posted 06/24/10 05:51 PM

    Originally posted by: SystemAdmin


    Thanks, Daniel, for a clear and detailed answer. There's still a problem, though -- what you proposed results in CPLEX throwing error 1217 (no solution exists).

    I'm trying to use a heuristic callback to "polish" incumbents that are suboptimal. At the root node, CPLEX finds an incumbent (I'm pretty sure via a heuristic) and calls my incumbent callback. The incumbent callback records the solution information (including a value of 0.0 for a variable named "x_0_2") and sets a flag telling the heuristic callback to polish it. When the heuristic callback starts checking feasibilities, it finds the following:

    x_0_0 feasbility = ImpliedIntegerFeasible
    x_0_1 feasbility = IntegerFeasible
    x_0_2 CPLEX Error 1217: No solution exists.

    Does this mean that x_0_2 was presolved out? (And should I treat x_0_0 as not presolved out, since the feasibility is implied integer rather than implied?)

    Thanks,
    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Inject a partially specified incumbent? (Java API)

    Posted 06/25/10 12:12 AM

    Originally posted by: SystemAdmin


    I have seen that happen before any maybe I was not specific enough, sorry.
    Is it possible that you wrote something like this:
    for (int i = 0; i < nvars; ++i) {
        if (getFeasibility(vars[i]) != Implied)
            setBounds(vars[i], ...);
    }
    

    This is invalid as setBounds() invalidates the solution at the current node. You have to write it like this:
    IntegerFeasibilityStatus[] stats = getFeasibilities(vars);
    for (int i = 0; i < nvars; ++i) {
        if (stats[i] != Implied)
            setBounds(vars[i]);
    }
    

    Does that solve your problem?
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Inject a partially specified incumbent? (Java API)

    Posted 06/25/10 03:12 PM

    Originally posted by: SystemAdmin


    Thanks, Daniel, that fixed it.

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization