clingo#

clingo#

gunfolds.utils.clingo.clingo(command, exact=True, convert=<function drasl_jclingo2g>, timeout=0, capsize=1, configuration='crafty', optim='optN', pnum=4.0)[source]#

Runs run_clingo and returns parsed equivalent class

Parameters:
  • command (string) – Completed clingo code

  • exact (boolean) – If true, run clingo in exact mode. If false, run clingo in optimization mode

  • convert (function) – result parsing protocol

  • timeout (integer) – timeout in seconds after which to interrupt computation (0 - no limit)

  • capsize (integer) – maximum number of candidates to return

  • configuration (string) –

    Select configuration based on problem type

    • frumpy : Use conservative defaults

    • jumpy : Use aggressive defaults

    • tweety : Use defaults geared towards asp problems

    • handy : Use defaults geared towards large problems

    • crafty : Use defaults geared towards crafted problems

    • trendy : Use defaults geared towards industrial problems

  • optim (string) –

    a comma separated string containing configuration for optimization algorithm and optionally a bound [<arg>[, <bound>]]

    • <arg><mode {opt|enum|optN|ignore}>
      • opt : Find optimal model

      • enum : Find models with costs <= <bound>

      • optN : Find optimum, then enumerate optimal models

      • ignore : Ignore optimize statements

    • <bound> : Set initial bound for objective function(s)

  • pnum (integer) – number of parallel threads to run clingo on

Returns:

results of parsed equivalent class

Return type:

dictionary

run_clingo#

gunfolds.utils.clingo.run_clingo(command, exact=True, timeout=0, capsize=1, configuration='tweety', pnum=4.0, optim='optN')[source]#

Open sub-process and run clingo

Parameters:
  • command (string) – Completed clingo code

  • exact (boolean) – If true, run clingo in exact mode. If false, run clingo in optimization mode

  • timeout (integer) – timeout in seconds after which to interrupt computation (0 - no limit)

  • capsize (integer) – maximum number of candidates to return

  • configuration (string) –

    Select configuration based on problem type

    • frumpy : Use conservative defaults

    • jumpy : Use aggressive defaults

    • tweety : Use defaults geared towards asp problems

    • handy : Use defaults geared towards large problems

    • crafty : Use defaults geared towards crafted problems

    • trendy : Use defaults geared towards industrial problems

  • pnum (integer) – number of parallel threads to run clingo on

  • optim (string) –

    a comma separated string containing configuration for optimization algorithm and optionally a bound [<arg>[, <bound>]]

    • <arg><mode {opt|enum|optN|ignore}>
      • opt : Find optimal model

      • enum : Find models with costs <= <bound>

      • optN : Find optimum, then enumerate optimal models

      • ignore : Ignore optimize statements

    • <bound> : Set initial bound for objective function(s)

Returns:

results of equivalent class

Return type:

dictionary