Menu

Defining an objective function

HowTo
2012-05-18
2012-05-18
  • Christophe Ponsard

    Most of the available examples are driven by the conflit reduction
    how can we define a more general objective functions (with small snippet) ?

     
  • Renaud De Landtsheer

    The basic answer is that you can define an objective function as an IntVar, using the invariant library to express its formula. If you want to be able to evaluate the objective function on neightbors using the partial propagation feature of Asteroid, you can use the Objective class of package objective.core as follows:

    val myobjective = Objective(Some_IntVar_defined_by_invariants)
    

    so that during the ssearch, you can call for instance

    myobjective.getAssignVal(Some_IntVar_of_the_problem
                             ,A_value_you_want_to_explore_for_it)
    

    More partial propagation queries are available, check the documentation of the Objective class. https://sourceforge.net/p/asteroid/code/28/tree/trunk/Asteroid/src/objective/core/Objective.scala#l32

    Of course, the search strategy is up to you, as usual in local search systems.

     

    Last edit: Renaud De Landtsheer 2012-05-22

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.