| 1 | package felix.main; |
| 2 | |
| 3 | import java.sql.ResultSet; |
| 4 | import java.sql.SQLWarning; |
| 5 | import java.sql.Statement; |
| 6 | import java.util.HashMap; |
| 7 | |
| 8 | import tuffy.db.RDB; |
| 9 | import tuffy.util.Config; |
| 10 | import tuffy.util.UIMan; |
| 11 | import felix.dstruct.FelixPredicate; |
| 12 | import felix.parser.FelixCommandOptions; |
| 13 | //import felix.util.ActiveLearner; |
| 14 | //import felix.util.CostCalculator; |
| 15 | import felix.util.ActiveLearner; |
| 16 | import felix.util.CostCalculator; |
| 17 | import felix.util.FelixConfig; |
| 18 | import felix.util.FelixUIMan; |
| 19 | import felix.util.TimeOut; |
| 20 | |
| 21 | /** |
| 22 | * Main class of Felix. |
| 23 | * @author Ce Zhang |
| 24 | * |
| 25 | */ |
| 26 | public class Main { |
| 27 | |
| 28 | public static void main(String[] args) throws Exception { |
| 29 | |
| 30 | |
| 31 | FelixConfig.overrideID(); |
| 32 | FelixCommandOptions options = FelixUIMan.parseCommand(args); |
| 33 | FelixConfig.evidDBSchema = options.evidDBSchema; |
| 34 | FelixConfig.gp = options.isGreenPlum; |
| 35 | |
| 36 | |
| 37 | |
| 38 | FelixUIMan.println("*** Welcome to " + FelixConfig.product_name + ""); |
| 39 | if(options == null){ |
| 40 | return; |
| 41 | } |
| 42 | |
| 43 | TimeOut to = null; |
| 44 | if(options.timeout < Integer.MAX_VALUE){ |
| 45 | to = new TimeOut(options.timeout); |
| 46 | to.start(); |
| 47 | } |
| 48 | |
| 49 | |
| 50 | if(options.utilModel != null){ |
| 51 | |
| 52 | |
| 53 | if(options.utilModel.equals("incremental")){ |
| 54 | |
| 55 | ActiveLearner al = new ActiveLearner(options); |
| 56 | |
| 57 | al.DjangoSetup(); |
| 58 | |
| 59 | } |
| 60 | |
| 61 | if(options.utilModel.equals("cost")){ |
| 62 | CostCalculator cc = new CostCalculator(options); |
| 63 | cc.calc(); |
| 64 | } |
| 65 | |
| 66 | }else{ |
| 67 | if(!options.isDLearningMode){ |
| 68 | |
| 69 | new Felix().run(options); |
| 70 | |
| 71 | |
| 72 | }else{ |
| 73 | UIMan.println("Please use Tuffy for MLN learning."); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | if(options.timeout < Integer.MAX_VALUE){ |
| 78 | to.stop(); |
| 79 | } |
| 80 | |
| 81 | } |
| 82 | |
| 83 | } |
| 84 | |
| 85 | |
| 86 | |
| 87 | |