Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClingoSession"/> class with a given class of interaction flags,
 /// an original answer set program and the input to translate.
 /// </summary>
 /// <param name="interaction">A <see cref="IdpInteraction"/> instance that describes how the program should run.</param>
 /// <param name="aspContent">An asp-program that specifies how the new facts should be generated.</param>
 /// <param name="inp">The given input to transform.</param>
 public ClingoSession(IdpInteraction interaction, string aspContent, string inp)
     : base(interaction.ClingoExecutable, string.Format ("-n 1 --verbose=0"))
 {
     this.Stdin.Write (aspContent);
     this.Stdin.Write (inp);
     this.Stdin.Close ();
 }
Example #2
0
 public IdpInteractiveStream(string idpFile, string theory, string structure, string vocabulary, string aspContent, string hookContent) : base(null)
 {
     inter            = new IdpInteraction();
     this.ses         = inter.RunIdpfile(idpFile, theory, structure, vocabulary);
     this.aspContent  = aspContent;
     this.hookContent = hookContent;
     this.regenerateModel();
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IdpGie.Interaction.IdpSession"/> class.
 /// </summary>
 /// <param name="interaction">An <see cref="IdpInteraction"/> configuration class that describes which executable that should be called
 /// together with the settings of the idp session.</param>
 /// <param name="filename">The name of the <c>.idp</c>-file to execute.</param>
 /// <param name="theory">The name of the theory to be used.</param>
 /// <param name="structure">The name of the structure to be used.</param>
 /// <param name="vocabulary">The name of the vocabulary to be used.</param>
 public IdpSession(IdpInteraction interaction, string filename, string theory, string structure, string vocabulary) : base(interaction.IdpExecutable, string.Format("--nowarnings -i {0}", filename))
 {
     this.theory     = theory;
     this.structure  = structure;
     this.vocabulary = vocabulary;
     this.Stdin.WriteLine("stdoptions.xsb={0}", interaction.Xsb.ToString().ToLower());
     this.Stdin.WriteLine("stdoptions.groundwithbounds={0}", interaction.Groundwithbounds.ToString().ToLower());
     this.Stdin.WriteLine("stdoptions.liftedunitpropagation={0}", interaction.Liftedunitpropagation.ToString().ToLower());
     this.Stdin.WriteLine("stdoptions.nbmodels={0}", interaction.Nbmodels);
     this.Stdin.WriteLine("stdoptions.language=\"asp\"");
     this.Stdin.WriteLine("cs = calculatedefinitions({0},{1})", this.theory, this.structure);
     this.Stdin.WriteLine("ps, a, b, iv = initialise({0},cs)", this.theory);
     this.Stdin.Flush();
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IdpGie.Interaction.IdpSession"/> class.
 /// </summary>
 /// <param name="interaction">An <see cref="IdpInteraction"/> configuration class that describes which executable that should be called
 /// together with the settings of the idp session.</param>
 /// <param name="filename">The name of the <c>.idp</c>-file to execute.</param>
 /// <param name="theory">The name of the theory to be used.</param>
 /// <param name="structure">The name of the structure to be used.</param>
 /// <param name="vocabulary">The name of the vocabulary to be used.</param>
 public IdpSession(IdpInteraction interaction, string filename, string theory, string structure, string vocabulary)
     : base(interaction.IdpExecutable, string.Format ("--nowarnings -i {0}", filename))
 {
     this.theory = theory;
     this.structure = structure;
     this.vocabulary = vocabulary;
     this.Stdin.WriteLine ("stdoptions.xsb={0}", interaction.Xsb.ToString ().ToLower ());
     this.Stdin.WriteLine ("stdoptions.groundwithbounds={0}", interaction.Groundwithbounds.ToString ().ToLower ());
     this.Stdin.WriteLine ("stdoptions.liftedunitpropagation={0}", interaction.Liftedunitpropagation.ToString ().ToLower ());
     this.Stdin.WriteLine ("stdoptions.nbmodels={0}", interaction.Nbmodels);
     this.Stdin.WriteLine ("stdoptions.language=\"asp\"");
     this.Stdin.WriteLine ("cs = calculatedefinitions({0},{1})", this.theory, this.structure);
     this.Stdin.WriteLine ("ps, a, b, iv = initialise({0},cs)", this.theory);
     this.Stdin.Flush ();
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClingoSession"/> class with a given class of interaction flags,
 /// an original answer set program and the input to translate.
 /// </summary>
 /// <param name="interaction">A <see cref="IdpInteraction"/> instance that describes how the program should run.</param>
 /// <param name="aspContent">An asp-program that specifies how the new facts should be generated.</param>
 /// <param name="inp">The given input to transform.</param>
 public ClingoSession(IdpInteraction interaction, string aspContent, string inp) : base(interaction.ClingoExecutable, string.Format("-n 1 --verbose=0"))
 {
     this.Stdin.Write(aspContent);
     this.Stdin.Write(inp);
     this.Stdin.Close();
 }