Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

CP Optimizer - Solution Issue?

  • 1.  CP Optimizer - Solution Issue?

    Posted Thu November 06, 2025 01:47 AM

    I have a model written in IBM Ilog Script, invoking and using CP optimizer [first line is using CP;]. IBM Optimization Studio reports 1 solution, but when reviewing the variables and constraints, the values don't compute.

    For example, a decision variable (dec3) equals -10, but the two decision variables (dec1 and dec2) don't add to -10 (call this constraint1). This occurs multiple times over other constraints involving other decision variables.

    ct 1: dec1 + dec2 == dec3;

    Yet, this is the solution I'm being provided with. There is nothing displayed in the relaxation tab. I don't get any errors that might suggest the programming language used is problematic, or any other issues.

    Is this supposed to be how it works?



    ------------------------------
    Stevie Turkington
    ------------------------------


  • 2.  RE: CP Optimizer - Solution Issue?

    Posted Thu November 06, 2025 01:55 AM
    Edited by ALEX FLEISCHER Thu November 06, 2025 02:44 AM

    Hi,

    can you share a small model so that other users could try ?

    And just to be sure , do you get the same issue if you turn

    ct 1: dec1 + dec2 == dec3;

    into

     dec1 + dec2 == dec3;

    ?

    regards



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 3.  RE: CP Optimizer - Solution Issue?

    Posted 27 days ago

    Thanks, I'll give that a go.

    I am also trying to define particular values three variables can take on. These variables are also mentioned in the subject to area, and I'm getting plenty of 'not a range type' through to 'Operator not available for dexpr int - {string}.' messages trying the various ways to get this done (I have no clue what to do, and suggestions from ChatGPT and other posts in this forum haven't resulted in no errors appearing).

    How do I go about doing this in ILOG Ilog scripting language? If there are multiple parts, where does each go (eg define parameters section, define decision variables section, subject to (constraints) section.



    ------------------------------
    Stevie Turkington
    ------------------------------



  • 4.  RE: CP Optimizer - Solution Issue?

    Posted 27 days ago

    Hi,

    let me share a tiny example that works fine:

    using CP;
    
    range r=1..3;
    {int} s={1,3};
    
    dvar int x;
    dvar int y in r;
    dvar int z in 1..3;
    dvar int t;
    
    subject to
    {
      x in {1,2,3};
      y==z;
      t in s;
    }

    and I shared a few OPL scripting examples at here



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 5.  RE: CP Optimizer - Solution Issue?

    Posted 20 days ago

    Thanks for your help, Alex.

    I am encountering "Opl process is not responding, you must relaunch the run configuration" an awful lot. In cmd using oplrun.exe, I think the engine is stuck at node 0 - nothing further gets displayed. I don't believe any process stops responding in the cmd instance. I give up after a while, though.

    Are there equivalent settings for CP Optimizer I can set in IDE that refer to the following suggestions: here and here #2



    ------------------------------
    Stevie Turkington
    ------------------------------



  • 6.  RE: CP Optimizer - Solution Issue?

    Posted 20 days ago

    Hi,

    if you get this issue after a while you could try

    execute {
      		cp.param.FailLimit = 5000;
    }
    

    in order not to let CPOptimizer explore for too long.

    You could also set a time limit.

    You can also first try with a smaller instance.

    regards

     



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 7.  RE: CP Optimizer - Solution Issue?

    Posted 15 days ago

    I am running the model on watsonx Machine Learning. Using the same code (but now with the data in the model), I get an optimal solution but I can't find out which values got assigned to the decision variables (DV). Note, I am using 'using CP;' at the top.

    What is required to obtain this data from the solution process? It displays 3 solutions were found but all I see is what the optimal value is. I'm more interested in the values assigned to the DVs.

    Note, there is no data in the prepare data section of the scenario. That is contained in the model itself. Uploading the .dat file, associated with the model, in the prepare data section doesn't upload cleanly.

    eg: int startnum4 = ...;

    becomes

    int startnum4 = 97;



    ------------------------------
    Stevie Turkington
    ------------------------------



  • 8.  RE: CP Optimizer - Solution Issue?

    Posted 14 days ago

    Hi

    in the OPL documentation you can see

    have you done that ?

    regards

    regards



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 9.  RE: CP Optimizer - Solution Issue?

    Posted 19 days ago

    thank for you help



    ------------------------------
    Nicole Silvera
    ------------------------------



  • 10.  RE: CP Optimizer - Solution Issue?

    Posted 9 days ago

    Thanks for all your help so far, Alex. Really appreciated!

    I'm using dexpr int for calculating various decision variables.

    For example:

    dexpr int c = r + 135 + (2*num1) + number12;
    dexpr int d = o + 180 + number14 + number13;
    dexpr int p = c - d;

    From this, I've used the following both as (1) dexpr int, (2) a constraint within the subject to section and (3) sometimes both:

    finalDIF = p - minusDIF

    and get mixed results. finalDIF is constrained, set as a finalDIF == (value) constraint.

    Sometimes the "Opl process is not responding, you must relaunch the run configuration" appears.

    Sometimes I get told it equals the value, but when checking it myself it does not. I've even placed p == c - d as a constraint, removing it as a dexpr int.

    At times, I'm getting strange values for p, eg 500, and minusDIF 'optimized' to be 800000. This somehow equals a positive two digit number.

    What is the best way to impose constraints on variables calculated through dexpr int (eg c, d and p), the results of equations made up of decision variables?

    When is it appropriate to use dexpr int vs a constraint?



    ------------------------------
    Stevie Turkington
    ------------------------------



  • 11.  RE: CP Optimizer - Solution Issue?

    Posted 4 days ago

    Hi,

    can you post the entire model you got errors with so that other users could try ?

    Regards



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 12.  RE: CP Optimizer - Solution Issue?

    Posted 18 days ago

    It looks like the solver is giving you a technically feasible solution but not one that matches your expected constraint logic. This can happen if a constraint is being relaxed internally or if variable bounds allow unexpected values. It's worth checking whether any constraints are optional, if domains are set correctly, and testing the equation in a smaller isolated model to confirm consistency.

    I've seen similar logic-checking issues while working on workflow projects and even when editing multi-layer sequences in KineMaster, where isolating each layer helps spot the mismatch. You can also review more structured notes here: https://kinemasterzone.com/



    ------------------------------
    Jackson Alban
    ------------------------------