Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  removing the contsraint

    Posted 12/26/17 08:32 AM

    Originally posted by: felycite28


    Hello everyone,

    I am a bit confused about the expression "removing the constraint" which I read on a paper. I will be very happy if you share your ideas with me :)

    Here  is the MIP model:

    objective function:

    min sum (production related costs)+(maintanance related costs)

    s.t

    Production cons

    Production cons

    ...

     

    maintanance const

    maintanance const

     

    maintenance constraints include integer and binary variables. It says that , "to relax the subproblem of   the model, the maintance constraints are removed ". What should I understand from these expression ? Does it mean that "the binary variables in the maintenance costraints are changed to continuous? or any other meaning ?

     

    Thank you so much in advance


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: removing the contsraint

    Posted 12/27/17 12:56 AM

    You should understand from that exactly what it says: the respective constraints are completely removed from the model.

    The resulting model may be easier/faster to solve but it is only a relaxation since solutions feasible to the modified problem are not necessarily feasible to the original model.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: removing the contsraint

    Posted 12/27/17 03:47 AM

    Originally posted by: felycite28


    Thank you Daniel,

    Now , I have one more question. I need to relax  the model partially. I will apply time decomposition; I have five time periods , for the first two periods the model shoud be original one for the remaining three periods I should take the relaxed version and solve the model. Here, the question I will need both versions of the model. Technically speaking , how can I do that ? by adding a constraint which will deactivate or activate the respective constraints ?

    2)if yes, adding an extra  constraint might get longer CPU of the model ?

    3) when I remove the maintenance const, what should I do maintenance cost in the objective function ?

    Million thanks


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: removing the contsraint

    Posted 12/27/17 09:56 AM

    I am not sure what the problem is with removing the constraints for the later time periods. Actually, I would not remove them but create the model without them in the first place. If you create the model with a programming API then just do not emit those constraints for the later periods. If you use OPL then you may use the if-statement to only emit the constraints for the first periods. Something like

    forall (p in periods) {
      if ( p == 1 || p == 2 ) {
        // your maintenance constraint for first two periods here
      }
    }

    What to do about the maintenance cost in case you remove the maintenance constraints: I have no idea. Isn't that described in your paper? In any case, this depends completely on your model and/or the real-world problem you are trying to solve. If relaxing the maintenance constraints is meaningful for this then there should also be a meaningful way to handle the cost associated with that (maybe just ignore that as well?).


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: removing the contsraint

    Posted 01/02/18 09:49 AM

    Originally posted by: felycite28


    Thank you Daniel,

    I have two questions then, I will be very happy if you can give me ideas. I am coding the model on Python API.

    1) For removing the related constraints and the objective function the paper says :

    Original version:

     

    Constraint 9:

     

    It says that:

     

    So , it as not that much clear for me.

    2) As I said , I am coding on Python API , I tried to remove some of the constraints, for 5 time periods , I am relaxing the model for last 3 periods:

    for i in range (0,2):

            call objective function of original model

            call constraints of original model

    for k in range(3,5):

            call objetive function of original model // Shall I define new objective function for the previous question ? def newobjective ?

            call constraints of original model

            model.linear_constraints.delete("c702",70) //I am removing the constraints for these time inrervals ?

    Here , the question

    1) Is there something wrong with the general structure , calling the functions etc ? calling the constraints and variables for both for loop?

    2) I am getting 1219. Name exists.

         I have got the contsraint name "c702" by writing the model on .lp file and go the bame of it ?

    I would be very happy if you can correct my ideas ? or if you can give new ones?

    Thank you so much


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: removing the contsraint

    Posted 01/03/18 01:00 AM

    I am not clear what you mean by "call objective for original model" and "call constraints of original model".

    The way you delete the constraints looks wrong. It seems you do not assign any names to constraints. Then, when you export your model to LP then CPLEX will automatically assign names "c1" through "cn" but these names do not exist in the model in Python. Function Cplex.linear_constraints.add() returns the indices of the constraints that were added. You can pass these indices to Cplex.linear_constraints.delete() to delete the constraints later on.

    For the objective, after creating the original objective you can delete the coefficients for the dropped variables via Cplex.objective.set_linear() (set the coefficients to 0).

    From what you quoted from your paper, it seems that the relaxation just drops some variables? If that is correct then you don't have to modify objective and constraints. You can just delete those variables via Cplex.variables.delete(). To delete variables reference them either by their name or by the index returned by Cplex.variables.add().


    #CPLEXOptimizers
    #DecisionOptimization