Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  OR and IfThen constraints + ClassCastException while adding cut

    Posted 11/06/08 04:26 PM

    Originally posted by: SystemAdmin


    [Strider said:]

    Hello,

    I have a MIP model (no-wait job shop problem) for which I can infer new constraints that must be valid if certain other constraints in my model are satisfied. They do not change the final solution of the model at all. (i.e. constraint propagation).

    I can model these conditional constraints using IloCplex.or, and then add them to the model in front using IloCplex.ifThen. The idea is to try to use these extra constraints to speed up cplex's solution time; but until now without any luck; I think this is mainly because the constraints introduce new boolean variables....

    I can also make these constraints in my own way with boolean variables, but this too slows down solution time, even if I only add them inside a  BranchCallBack when I am certain that they are applicable in all subnodes, there is no speed increase. (I have added the extra boolean variables for the extra constraints up front; but without adding the constraints yet). Adding the constraints as cuts doesn't seem to speed the time up either.

    So now I was trying to add the constraints as cuts (either with addCut or addUserCut), but by using cplex's ifThen and or. I also tried it again inside a BranchCallBack where I only needed IloCplex.Or. In both cases (in Java) I get a runtime Exception like this:


    java.lang.ClassCastException: ilog.cplex.CpxIfThen cannot be cast to ilog.cplex.CpxRange


    (with CpxOr if I try an or constraint).

    So I have 2 questions:
    1. Is this error because you cannot add cuts from constraints that implicitly add extra variables? How come the API does not explicitly forbid this; and doesn't pick it up at compile time?
    2. Should I give up on improving solution time when the inferred constraints need extra binary variables? Or is there a way?



    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: OR and IfThen constraints + ClassCastException while adding cut

    Posted 11/07/08 01:38 PM

    Originally posted by: SystemAdmin


    [Didier Vidal said:]

    Strider,

    You can use IloCplex.or and IloCplex.ifThen in java in CPLEX 10.0 or higher. I'm surprised you could create these constraints with CPLEX 9.0...

    Also, if your goal is to solve a variation of a jobshop problem with better performance, I suggest that you look at ILOG CP Optimizer. It is an optimization engine specialized for detailed scheduling problems that should perform well. The version 2.0, that supports detailed scheduling is available in OPL 6.0 or higher.

    Didier Vidal.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: OR and IfThen constraints + ClassCastException while adding cut

    Posted 11/07/08 01:43 PM

    Originally posted by: SystemAdmin


    [Didier Vidal said:]


    You can use IloCplex.or and IloCplex.ifThen in java in CPLEX 10.0 or higher. I'm surprised you could create these constraints with CPLEX 9.0...

    Sorry. I think I mixed two posts on the forum. Your question was not about CPLEX 9...



    Didier.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: OR and IfThen constraints + ClassCastException while adding cut

    Posted 11/07/08 04:37 PM

    Originally posted by: SystemAdmin


    [Strider said:]

    Ok no problem; I am using cplex 11.
    Seeing as how long cplex takes to solve it, you are probably right that the CP Optimizer will perform better. I am afraid we don't have ILOG CP Optimizer, but I will ask around to be sure.

    I have as an assignment for my final thesis to combine constraint programming and mathematical programming to try to solve this variant of job shop scheduling faster than is possible with only one of the methods alone.
    So first we tried as a basis a cplex MIP model, and now I have to expand this and try to make it faster by propagating knowledge and cleverly selecting what to branch on.

    But I am really starting to feel that it would be much faster to write my own constraint solver for this problem, and maybe call cplex for certain subproblems there (which I unfortunately haven't determined yet...).
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: OR and IfThen constraints + ClassCastException while adding cut

    Posted 11/07/08 07:31 PM

    Originally posted by: SystemAdmin


    [MaryFenelon said:]

    To answer the original question about what is allowed in a branch callback:  IloRange is the only subclass of IloConstraint which is allowed.  We should probably change the makeBranch method to reflect this so you would get a compile error, not a runtime error.




    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: OR and IfThen constraints + ClassCastException while adding cut

    Posted 11/11/08 04:05 PM

    Originally posted by: SystemAdmin


    [Strider said:]

    [quote author=MaryFenelon link=topic=671.msg2047#msg2047 date=1226075461]
    To answer the original question about what is allowed in a branch callback:  IloRange is the only subclass of IloConstraint which is allowed.  We should probably change the makeBranch method to reflect this so you would get a compile error, not a runtime error.


    Ah yes; it tried to cast to IloRange which explains my problem.

    I am going to investigate the use of constraint programming maybe with Ilog CP/Scheduler to solve my problem.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: OR and IfThen constraints + ClassCastException while adding cut

    Posted 11/13/08 06:42 PM

    Originally posted by: SystemAdmin


    [Didier Vidal said:]

    I am going to investigate the use of constraint programming maybe with Ilog CP/Scheduler to solve my problem.

    I would suggest ILOG CP Optimizer (It's a second generation of CP engine - CP/Scheduler is the first generation).

    ILOG CP Optimizer mixes CP and MP techniques to solve detailed scheduling problems so it might be an interesting input for your thesis.

    If you don't have CP Optimizer, you can try it from the OPL trial version (available on ILOG's web site) for problems of small size.

    Didier.
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: OR and IfThen constraints + ClassCastException while adding cut

    Posted 11/18/08 03:13 PM

    Originally posted by: SystemAdmin


    [Strider said:]

    Didier, I create my model and my problem instances using Java. The OPL trial version does not seem to support this, or is there also a trial license available?

    [quote author=Didier Vidal link=topic=671.msg2088#msg2088 date=1226590918]
    I am going to investigate the use of constraint programming maybe with Ilog CP/Scheduler to solve my problem.

    I would suggest ILOG CP Optimizer (It's a second generation of CP engine - CP/Scheduler is the first generation).

    ILOG CP Optimizer mixes CP and MP techniques to solve detailed scheduling problems so it might be an interesting input for your thesis.

    If you don't have CP Optimizer, you can try it from the OPL trial version (available on ILOG's web site) for problems of small size.

    Didier.

    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: OR and IfThen constraints + ClassCastException while adding cut

    Posted 11/18/08 03:48 PM

    Originally posted by: SystemAdmin


    [Didier Vidal said:]

    is there also a trial license available?

    Not to my knowledge. Only the OPL trial version can be downloaded freely from the web.

    If you are interested in the CP Optimizer performance for this problem, maybe you can give a description of the constraints and test data (on the CP Optimizer forum... we could leave this CPLEX thread) ? I could help you getting started with the trial version of CP Optimizer in OPL....

    Didier.
    #CPLEXOptimizers
    #DecisionOptimization