How can I write Cplex model.prod() function in Gurobi Java?
Answeredpublic GRBQuadExpr funcName(SegmentName segment, GRBModel model, GRBVar decVar)
throws GRBException { // IloNumExpr IloCplex IloNumVar IloException
// Gurobi does not except this one. How will I change this function
return model.prod(0.5 * segment.getPriceDifference() * segment.getQuantityDifference(), decVar, decVar);
}
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi Fulya,
It's not clear to me what problem you are facing. Could you please explain in some more detail what you want to do?
Please also consult our documentation on adding quadratic constraints in Java.
Thanks,
Matthias0 -
Hi Matthias,
Actually, this is not a quadratic constraint. It is a method to construct an QuadExpr then another place we call this function to form objective function. My problem is that how can I write a QuadExpr as a method since the same QuadExpr will be used in several classes. Hence, I need some thing like in Cplex. In Cplex, we define IloCplex model and prod() built-in function belonging to the model. In Gurobi, I define GRBModel model but I need some built-in function or something else.
Thank you in advance
Fulya
0 -
Okey I solved this problem thank you.
0
Post is closed for comments.
Comments
4 comments