idp_server.State

Management of the State of problem solving with the Interactive Consultant.

class State(idp)[source]

Contains a state of problem solving

classmethod make(idp, previous_active, active, ignore=None)[source]

Manage the cache of State

Parameters
  • idp (IDP) – idp source code

  • previous_active (str) – assignments due to previous full propagation

  • active (str) – assignment choices from client

  • ignore (str) – user-disabled laws to ignore

Returns

a State

Return type

State

__init__(idp)[source]

Creates an instance of Theory for the list of theories, e.g., Theory(T,S).

Parameters
  • theories (Union[TheoryBlock, Structure, Theory]) – 1 or more (data) theories.

  • extended (bool, optional) – use True when the truth value of inequalities and quantified formula is of interest (e.g. for the Interactive Consultant). Defaults to False.

  • idp (idp_engine.Parse.IDP) –

add_given(jsonstr, previous, keep_defaults=False)[source]

Add the assignments that the user gave through the interface. These are in the form of a json string.

Parameters
  • jsonstr (str) – the user’s assignment in json

  • previous (str) – the assignments from the last propagation

  • keep_default – whether default assignments should not be reset

  • jsonstr

  • previous

  • keep_defaults (bool) –

Post

the state has the jsonstr and previous added