Code Monkey home page Code Monkey logo

diversescore's Introduction

DiverseScore

This Python package computes several diversity models using different distance metrics for plan sets in SAS+ format. Also it wraps IBM's diversescore.

Available Diversity Models

  • MaxSum: The sum of pairwise distance between plans in a provided set of plans.
  • MaxMean: Average sum of the pairwise distance between plans in a provided set of plans.
  • MaxMin: The minimum distance between a plans in a provided set of plans.

Available Distance Functions

  • Stability: Jaccard measure between two plan's actions.
  • States: Average jaccard measure between two plan's states.
  • Uniqueness: Set difference between two plan's actions.
  • Causal-links: Jaccard measure between two plan's casual links.

How to use

Installation

python -m pip install git+

CLI

DiverseScore has a cli, which can be invoked as follows:

diversescorecli [-h] [-domain DOMAIN] [-problem problem.pddl] [-diversity-model {MaxSum,MaxMin,MaxMean}] [-metric {States,Stability,Uniqueness}] [-plansdir PLANSDIR]

Python Import

DiverseScore can be integrated into any Python project, here is a simple code to compute the MaxSum score using Stability Metric.

import os

from unified_planning.shortcuts import *
from diversescore.shortcuts import *

domain=<Path-to-domain-PDDL-file>
problem=<Path-to-problem-PDDL-file>
plansdir=<Path-to-plans-dir>
# Read the domain and problem PDDL files
task = PDDLReader().parse_problem(domain, problem)
# Ground the problem
with Compiler(problem_kind=task.kind, compilation_kind=CompilationKind.GROUNDING) as grounder:
    groudned_task = grounder.compile(task, compilation_kind=CompilationKind.GROUNDING)
# Load the plans from directory
plans = loadPlansDir(plansdir)
maxsum_stability_score = MaxSum(Stability(groudned_task))

Citations

This package implements the distance fucntions proposed by:

@article{nguyen2012generating,
  title={Generating diverse plans to handle unknown and partially known user preferences},
  author={Nguyen, Tuan Anh and Do, Minh and Gerevini, Alfonso Emilio and Serina, Ivan and Srivastava, Biplav and Kambhampati, Subbarao},
  journal={Artificial Intelligence},
  volume={190},
  pages={1--31},
  year={2012},
  publisher={Elsevier}
}

As for the diversity models are based on:

@article{parreno2021measuring,
  title={Measuring diversity. A review and an empirical analysis},
  author={Parre{\~n}o, Francisco and {\'A}lvarez-Vald{\'e}s, Ram{\'o}n and Mart{\'\i}, Rafael},
  journal={European Journal of Operational Research},
  volume={289},
  number={2},
  pages={515--532},
  year={2021},
  publisher={Elsevier}
}

@inproceedings{Sandoya2018DiversityAE,
  title={Diversity and Equity Models},
  author={Fernando Sandoya and Anna Mart{\'i}nez-Gavara and Ricardo Aceves and Abraham Duarte and Rafael Mart{\'i}},
  booktitle={Handbook of Heuristics},
  year={2018}
}

If you are using IBM's score computation you should cite:

@InProceedings{katz-sohrabi-aaai2020,
  title =        "Reshaping diverse planning",
  author =       "Michael Katz and Shirin Sohrabi",
  booktitle =    "Proceedings of the Thirty-Fourth {AAAI} Conference on
                  Artificial Intelligence ({AAAI} 2020)",
  publisher =    "{AAAI} Press",
  pages =        "9892--9899",
  year =         "2020"
}

@InProceedings{katz-et-al-aaai2022,
  title =        "Bounding Quality in Diverse Planning",
  author =       "Michael Katz and Shirin Sohrabi and Octavian Udrea",
  booktitle =    "Proceedings of the Thirty-Sixth {AAAI} Conference on
                  Artificial Intelligence ({AAAI} 2022)",
  publisher =    "{AAAI} Press",
  year =         "2022"
}

diversescore's People

Contributors

mfaisalzaki avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

bwry

diversescore's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.