mirror of
				https://github.com/Brandon-Rozek/matmod.git
				synced 2025-11-03 03:11:12 +00:00 
			
		
		
		
	Implemented feature #31
This commit is contained in:
		
							parent
							
								
									54dc6e503c
								
							
						
					
					
						commit
						cad3e85cd0
					
				
					 1 changed files with 11 additions and 2 deletions
				
			
		
							
								
								
									
										13
									
								
								vspursuer.py
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								vspursuer.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -12,6 +12,7 @@ if __name__ == "__main__":
 | 
			
		|||
    parser.add_argument("--verbose", action='store_true', help="Print out all parsed matrices")
 | 
			
		||||
    parser.add_argument("-i", type=str, help="Path to MaGIC ugly data file")
 | 
			
		||||
    parser.add_argument("-c", type=int, help="Number of CPUs to use. Default: MAX - 2.")
 | 
			
		||||
    parser.add_argument("--skip-to", type=str, help="Skip until a model name is found and process from then onwards.")
 | 
			
		||||
    args = vars(parser.parse_args())
 | 
			
		||||
 | 
			
		||||
    data_file_path = args.get("i")
 | 
			
		||||
| 
						 | 
				
			
			@ -23,11 +24,19 @@ if __name__ == "__main__":
 | 
			
		|||
        solutions = parse_matrices(SourceFile(data_file))
 | 
			
		||||
    print(f"Parsed {len(solutions)} matrices")
 | 
			
		||||
 | 
			
		||||
    start_processing = args.get("skip_to") is None
 | 
			
		||||
 | 
			
		||||
    # NOTE: When subprocess gets spawned, the logical operations will
 | 
			
		||||
    # have a different memory address than what's expected in interpretation.
 | 
			
		||||
    # This will make it so that we can pass the model functions directly instead.
 | 
			
		||||
    solutions_expanded = []
 | 
			
		||||
    for model, interpretation in solutions:
 | 
			
		||||
        # If skip_to is defined, then don't process models
 | 
			
		||||
        # until then.
 | 
			
		||||
        if not start_processing and model.name == args.get("skip_to"):
 | 
			
		||||
            start_processing = True
 | 
			
		||||
        if not start_processing:
 | 
			
		||||
            continue
 | 
			
		||||
        impfunction = interpretation[Implication]
 | 
			
		||||
        mconjunction = interpretation.get(Conjunction)
 | 
			
		||||
        mdisjunction = interpretation.get(Disjunction)
 | 
			
		||||
| 
						 | 
				
			
			@ -46,10 +55,10 @@ if __name__ == "__main__":
 | 
			
		|||
            print(vsp_result)
 | 
			
		||||
 | 
			
		||||
            if args['verbose'] or vsp_result.has_vsp:
 | 
			
		||||
                model = solutions[i][0]
 | 
			
		||||
                model = solutions_expanded[i][0]
 | 
			
		||||
                print(model)
 | 
			
		||||
 | 
			
		||||
            if vsp_result.has_vsp:
 | 
			
		||||
                num_has_vsp += 1
 | 
			
		||||
 | 
			
		||||
    print(f"Tested {len(solutions)} models, {num_has_vsp} of which satisfy VSP")
 | 
			
		||||
    print(f"Tested {len(solutions_expanded)} models, {num_has_vsp} of which satisfy VSP")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue