Menu

How to get the utility of the solution

Help
Xie Yi
2015-08-24
2015-08-25
  • Xie Yi

    Xie Yi - 2015-08-24

    I want to get the value of the target function which is the sum of constraint function with the solution assgined to them. I found there are two member functions in Solution class. Could I get the sum from getReportedUtil or getUtility? Thx!

     
  • Thomas B. Léauté

    Dear Xie Yi,

    The difference between these two methods is the following:

    • getReportedUtil() returns the utility (or cost) of the solution produced by the algorithm, as computed by the agents themselves;
    • getUtility() returns the true utility (or cost) of the solution produced by the algorithm.

    In some cases and for some algorithms, these two utilities can differ. For instance, most local search algorithms do not provide the agents the visibility of the global utility/cost of the current solution with respect to all constraints in the problem, and therefore the reported utility will be an approximation of the true utility. For complete algorithms, however, both utilities should always be the same.

    If you are just interested in the actual utility/cost of the solution, taking all constraints into account, you can just call getUtility().

    Best,

    Thomas

     

    Last edit: Thomas B. Léauté 2015-08-24
  • Xie Yi

    Xie Yi - 2015-08-25

    thx that helps

     

Log in to post a comment.