ThermostatAgent
Java counterpart of it.unibo.tuprolog.examples.solve.ThermostatAgentKt: a reactive agent whose control loop is a Prolog program, while its get_temp/1 sensor and push/1 actuator primitives are plain Java objects, showing how the :solve public API reads from Java (e.g. going through request.getUnificator().mgu(...) rather than the mgu extension available in Kotlin).
The agent runs as a Thread: its control logic is loaded from the bundled thermostat.pl resource (templated with the cold/hot thresholds passed to the constructor) and solved once via it.unibo.tuprolog.solve.Solver, printing whether the target temperature range was reached, the logic program failed, or an exception was raised.
Properties
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Entry point spawning a ThermostatAgent with a cold threshold of 20, a hot threshold of 24, and a starting temperature of 30, then waiting for it to reach a stable temperature before the JVM exits.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Parses the templated
thermostat.pl program, builds a solver registering get_temp/1 and push/1 under the libs.agency.thermostat library alias (with variable tracking enabled so bound variables remain visible), and solves the start/0 goal once, printing the outcome to standard output.Link copied to clipboard
Link copied to clipboard