
/*******************************************
****             C example              ****
**** (c) 2017-2019, Alessandro Pedretti ****
*******************************************/


#include <stdio.h>
#include "random_forest_dll.h"


/**** Main code ****/

int main(int Argc, char *Argv[])
{
  T2C_RANDOM_FOREST_INPUT   Input;


  /**** Prediction example 1 ****/

  Input.Angles       = 108.0f;
  Input.Atoms        = 60.0f;
  Input.Bonds        = 63.0f;
  Input.Charge       = 0.0f;
  Input.ChiralAtms   = 0.0f;
  Input.Dipole       = 2.54652f;
  Input.EzBnds       = 2.0f;
  Input.FlexTorsions = 10.0f;
  Input.Gyrrad       = 7.528516f;
  Input.HbAcc        = 4.0f;
  Input.HbDon        = 2.0f;
  Input.HeavyAtoms   = 32.0f;
  Input.Impropers    = 21.0f;
  Input.Lipole       = 2.13308f;
  Input.Mass         = 448.5804f;
  Input.Ovality      = 1.894926f;
  Input.Psa          = 92.87458f;
  Input.Rings        = 4.0f;
  Input.Sas          = 809.6651f;
  Input.Sav          = 1316.951f;
  Input.Sdiam        = 12.73983f;
  Input.Surface      = 509.8912f;
  Input.Torsions     = 32.0f;
  Input.Vdiam        = 9.254815f;
  Input.VirtualLogP  = 4.190687f;
  Input.Volume       = 415.0514f;

  printf("\n* Example #1\n");
  printf("  Domain violations: %d (must be 0)\n", T2C_RANDOM_FOREST_DomCheck(&Input));
  printf("  Predicted class:   %d (real 0)\n", T2C_RANDOM_FOREST_Classify(&Input));


  /**** Prediction example 2 ****/

  Input.Angles       = 27.0f;
  Input.Atoms        = 18.0f;
  Input.Bonds        = 18.0f;
  Input.Charge       = 0.0f;
  Input.ChiralAtms   = 0.0f;
  Input.Dipole       = 0.245056f;
  Input.EzBnds       = 1.0f;
  Input.FlexTorsions = 2.0f;
  Input.Gyrrad       = 2.415841f;
  Input.HbAcc        = 2.0f;
  Input.HbDon        = 4.0f;
  Input.HeavyAtoms   = 10.0f;
  Input.Impropers    = 9.0f;
  Input.Lipole       = 4.472592f;
  Input.Mass         = 156.2088f;
  Input.Ovality      = 1.382357f;
  Input.Psa          = 96.54134f;
  Input.Rings        = 1.0f;
  Input.Sas          = 330.8518f;
  Input.Sav          = 474.6761f;
  Input.Sdiam        = 7.461171f;
  Input.Surface      = 174.8896f;
  Input.Torsions     = 9.0f;
  Input.Vdiam        = 6.345953f;
  Input.VirtualLogP  = 0.500129f;
  Input.Volume       = 133.8102f;

  printf("\n* Example #2\n");
  printf("  Domain violations: %d (must be 0)\n", T2C_RANDOM_FOREST_DomCheck(&Input));
  printf("  Predicted class:   %d (real 1)\n", T2C_RANDOM_FOREST_Classify(&Input));

  return 0;
}