Optimization does not work with GRB.Minimize/Maximize
AnsweredDear Gurobi Team,
I have an issue regarding an optimization problem. I have three optimization goals in my system model including resource usage, end-to-end latency, and response time. For example, I try to minimize the number of assigned applications to each core of a multi-core processor. When I am using first option of the following code (GRB. Minimize) I don't get a correct solution, basically it doesn't minimize the number of mappings on each core. But, when I am trying to limit the number of mappings as a constraint (second option), it works. The same issue happens when I'm trying to apply end-to-end latency and response time minimization. I would really appreciate it if you could mention the reason or If I'm doing something wrong !
Best regards,
Hadi
for(int i=0; i<listOfMappingCore1.size(); i++) {
expr021.addTerm(1, listOfMappingCore1.get(i).getM_gurobi());
}
//First option:
this.model.setObjective(expr021, GRB.Minimize, "Resource usage minimization");
//Second Option: try to write a constraint and restrict the number of mappings
this.model.addConstr(expr021, GRB.LESS_EQUAL, 7, "Resource usage minimization");
-
Hi Hadi,
Could you try
this.model.setObjective(expr021, GRB.MINIMIZE)
cf. setObjective documentation.
Best regards,
Jaromił0 -
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 -
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 -
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 -
Dear Jaromil,
Thanks for your reply!
I'll try it out and will get back to you.
Best regards,
Hadi
0 -
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.
Comments
7 comments