Skip to main content

Optimization does not work with GRB.Minimize/Maximize

Answered

Comments

7 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Hadi,

    Could you try

    this.model.setObjective(expr021, GRB.MINIMIZE)

    cf. setObjective documentation.

    Best regards, 
    Jaromił

    0
  • Hadi Askaripoor
    Gurobi-versary
    Conversationalist
    First Question

    Dear Jaromil,

    Thanks for your reply!

    I already tried it using the following line.

    this.model.setObjective(expr021, GRB.MINIMIZE);

    Actually, I made a mistake in writing the code in my last post! As mentioned, it doesn't optimize properly. I would appreciate your guidance!

    Best regards,

    Hadi



    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Hadi,

    As mentioned, it doesn't optimize properly. I would appreciate your guidance!

    What exactly do you mean by does not optimize properly. Do you mean that the optimal solution value/point is not correct? How do you know which solution point/value is the correct one? Could you provide a minimal working example to reproduce the issue? Note that uploading files in the Community Forum is not possible but we discuss an alternative in Posting to the Community Forum.

    Best regards, 
    Jaromił

     

    0
  • Hadi Askaripoor
    Gurobi-versary
    Conversationalist
    First Question

    Dear Jaromil,

    The values are not wrong but they are not minimized enough. For example, when try to limit the response time to be less than a specific value as a constraint I get the minimum values as mentioned above! Since the code is quite long, I try to find a way how I can proceed  with it.

    Best regards,

    Hadi

     

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Hadi,

    Did you try reducing the MIPGap value to 0? Maybe the optimal solution point within the default MIPGap value is not good enough for your application. Please note that reducing the MIPGap can drastically hurt performance.

    Best regards, 
    Jaromił

    0
  • Hadi Askaripoor
    Gurobi-versary
    Conversationalist
    First Question

    Dear Jaromil,

    Thanks for your reply!

    I'll try it out and will get back to you.

    Best regards,

    Hadi

    0
  • Hadi Askaripoor
    Gurobi-versary
    Conversationalist
    First Question

    Hello Jaromil,

    I tried the MIPGap but it didn't affect at all. The interesting thing is when I use the same objective with hierarchical multiobjective approach command it works and the result is correct!

    for(Process process: rs.getProcess()){
    expr25.addTerm(1, process.getStartingTime());
    this.model.setObjectiveN(expr021, 1, 1, 0,0,0, "responsetime");
    }

    Thanks!

    Best regards,

    Hadi

     

    0

Please sign in to leave a comment.