Topic
  • 3 replies
  • Latest Post - ‏2013-06-07T13:51:57Z by HWFN_Hossein_Hojabri
HWFN_Hossein_Hojabri
25 Posts

Pinned topic Constraint on Objective

‏2013-06-06T21:19:31Z |

Hi everybody,

I want to impose a condition on my objective function to force it to be smaller than a double value, instead of optimizing it.

Would you let me know how I can do this, please? Here are a couple of ideas I tried, but they didn't work:

 

First, I removed the IloMinimize, and I introduced this constraint:

model.add(obj<PrevObjFunction);

where obj is IloNumExpr, and PrevObjFunction is double; However, it didn't work. Then I tried this:

 

 

IloNumExpr obj(env);
IloRange  rng(env, obj < PrevObjFunction);

 

Thanks,

Hossein

 
  • Philippe_Refalo
    Philippe_Refalo
    50 Posts

    Re: Constraint on Objective

    ‏2013-06-07T07:01:55Z  

    Hi Hossein,

    You first constraint is the right way to implement your idea : replace IloMinimize(env, obj) by obj < prevObjFunction. When you mention that it dis not work I suppose you mean that CP Optimizer taks a long time to find a solution. 

    That's not really surprising since this transformation of an optimization problem into a decision problem can make the problem harder to solve even if theoreticaly it is not. This is because the way we do optimization use information about the shape and the propagation of the objective function. This is a knowledge that we no longer have when the objective is transformed into a constraint.

    The solution might be to give CP Optimizer a good advanced solution, if you have one, by the way of a starting point or to set a weaker bound.

    Regards 

    Philippe

  • HWFN_Hossein_Hojabri
    25 Posts

    Re: Constraint on Objective

    ‏2013-06-07T13:18:19Z  

    Hi, Thanks for the reply.

     

    No, it returns the solution much faster than before, when I had IloMinimize(). However, the problem is that it ignores this new constraint on the objective very often. So, sometimes the objective value remains the same, and sometimes it even increases!!!

     

    At every iteration of my ALNS algorithm, only some of variables are optimized. So, by this new constraint, what I expect is that either it returns a new solution with smaller objective value, or returns infeasible.

     

    Best,

    Hossein

  • HWFN_Hossein_Hojabri
    25 Posts

    Re: Constraint on Objective

    ‏2013-06-07T13:51:57Z  

    Hi, Thanks for the reply.

     

    No, it returns the solution much faster than before, when I had IloMinimize(). However, the problem is that it ignores this new constraint on the objective very often. So, sometimes the objective value remains the same, and sometimes it even increases!!!

     

    At every iteration of my ALNS algorithm, only some of variables are optimized. So, by this new constraint, what I expect is that either it returns a new solution with smaller objective value, or returns infeasible.

     

    Best,

    Hossein

    Oops, sorry, in the first case it returns this error:

     

    terminate called after throwing an instance of 'IloInvalidInequalityException'
     

    What I explained above happens in the second case.

     

    Hossein