Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  fixing variable values

    Posted 06/20/15 10:34 AM

    Originally posted by: Suryahatmaja


    Dear all,

     

    I have question about fixing variable values.

    For example, I have a model with 20 variables x.
    I do the step like this:

    1. Solve the model and stop in the first feasible solution.
    2. with that result, I add new constraint that set some (i.e. 10) variables x (random selection) to the existing result.
    3. Solve again and search the first feasible improve solution.

    Is this method is correct or is there any method in cplex to do this? I'm using Concert C++.


    In the selection of variable x, for example, I want to select 10 variables to be fixed, and the remaining will be searched. In the variable to be searched, I have criteria to select: 5 from the worst (from the existing) and 5 from the best value.

    So I need to sort the previous result, then take the 5 best and worst value each. How to sort the previous value of the cplex array? Or is there any other method to do the selection (without sorting it)?

     

    thank you for the help...

     

    regards,


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: fixing variable values

    Posted 06/20/15 04:33 PM

    If this is a MIP (you did not specify the problem type), if by "feasible" you mean "integer feasible" (again, not specified), and if you do not mind having certain features disabled (I believe dynamic search is among them), you can attach a lazy constraint callback. Its main() method will be called each time a new incumbent is found. In the main method, you can fix the variables you want to fix. Note that this will generate a sequence of improving integer feasible solutions; integer feasible solutions with the same or worse objective value will never be encountered.

    As far as sorting goes, you going to use getValues() to get the current variable values in a double[] vector. Sort that vector the same way you would sort a vector in any C++ program.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: fixing variable values

    Posted 06/21/15 10:55 AM

    Originally posted by: Suryahatmaja


    Great!! Thanks Prof. Rubin.

    yes, the problem is MIP and the feasible is integer feasible.

    I tried this and it's works:

    ILOLAZYCONSTRAINTCALLBACK1(MyLazyCallback, IloNumVarArray, vars)
    {
       IloInt i;
       IloEnv masterEnv = getEnv();
       IloInt numNodes = vars.getSize();
    
       IloNumArray xSol(masterEnv, numNodes);
       getValues(xSol, vars);
        
       for (i = 10; i < 14; i++)
       {
          add(vars[i] == xSol[i]).end();
       }
    
       return;
    }
    

     

    for this line "if you do not mind having certain features disabled", can you give some hints about it? if I want to compare my method result with cplex, is that will be good?
     

    Thanks..


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: fixing variable values

    Posted 06/21/15 03:48 PM

    You'll see a message near the top of the CPLEX output about the presence of a control callback resulting in certain features being disabled. I believe dynamic search is one, and I believe that variable fixing using dual price information is another ... but don't quote me on that.

    The fair comparison is your method to CPLEX without control callbacks: if your method is faster than plain CPLEX, it means whatever you did more than compensated for the loss of the disabled features.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: fixing variable values

    Posted 06/22/15 09:47 AM

    Originally posted by: Suryahatmaja


    Yes, I saw the message, and I disabled some parameter mentioned.

     

    For your explanation about the comparison, I'm little bit confused.

    it means that I cannot used that control callbacks if I want to compare with CPLEX?

    or I have to compare my method (that used control callback) with CPLEX that used the same parameter setting?

     

    Thanks..


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: fixing variable values

    Posted 06/22/15 06:46 PM

    You do not have to change any parameter settings as a result of the control callback warning message. CPLEX is tell you that it disabled certain features (automatically) when it saw the callback.

    For the comparison, I'm suggesting you compare your code with callback (and with some features automatically disabled) with CPLEX with no callback and default parameter settings (except where you have a particular reason to change them). In other words, do not attempt to disable in the basic CPLEX run the things that are disabled when you use the callback.


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: fixing variable values

    Posted 06/22/15 10:47 PM

    Originally posted by: Suryahatmaja


    Great! it's clear now.

    Thank you Prof. Rubin.

     

    Regarding the lazy constraint callback, can I change/remove the fixed variable from the previous step?I mean, i want to update which variable to be fixed once I get the first integer solution.

     

    thanks..


    #CPLEXOptimizers
    #DecisionOptimization