CadetCareerProblem โ Generated Data Corrections Methods¶
fix_generated_data(printing=None)
¶
Fix Generated Data Instance.
This method prepares a synthetic cadetโAFSC instance by populating missing data, generating preferences, updating qualification matrices, and ensuring valid preference and utility structures. It is intended only for generated (synthetic) data instances and should not be used on real-world datasets.
Parameters¶
printing : bool, optional
If True, print progress updates at each step. Defaults to the instance's self.printing
.
Notes¶
This function assumes that no valid AFSC preference or utility data currently exists. It will:
- Convert utility values to preference ranks
- Generate fake AFSC preference lists
- Create separate rated datasets for each SOC
- Update the qualification matrix based on preferences
- Remove ineligible cadets from all matrices
- Normalize preference matrices to eliminate ranking gaps
- Force first-choice utilities to 100%
- Convert AFSC preferences to percentile scores
- Update cadet preference columns
- Create new utility matrices from cadet columns
- Rebuild rated eligibility lists
- Generate random value parameters
- Perform a final parameter sanity check
Source code in afccp/main.py
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 |
|
convert_utilities_to_preferences(cadets_as_well=False)
¶
Converts utility matrices to ordinal preference matrices.
This method transforms the continuous utility values stored in the model's parameters
into discrete ordinal preferences used in assignment algorithms. By default, it converts
only the AFSC utility matrix (afsc_utility
) into the a_pref_matrix
. If specified, it
also converts the cadet utility matrix (cadet_utility
) into the c_pref_matrix
.
Parameters¶
cadets_as_well : bool, optional
If True
, both cadet and AFSC utility matrices are converted to preference matrices.
If False
(default), only AFSC utilities are converted.
Returns¶
None
This method updates the instanceโs parameters
attribute in-place.
Note
- The resulting
a_pref_matrix
ranks cadets for each AFSC from most to least preferred. - The optional
c_pref_matrix
ranks AFSCs for each cadet, using 1-based indexing.
Examples¶
# Convert only AFSC utility matrix
instance.convert_utilities_to_preferences()
# Convert both AFSC and cadet utility matrices
instance.convert_utilities_to_preferences(cadets_as_well=True)
See Also¶
convert_utility_matrices_preferences
: Underlying function that performs the actual matrix transformation.parameter_sets_additions
: Updates parameter subsets after modifying the preference matrices.
Source code in afccp/main.py
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 |
|
generate_fake_afsc_preferences(fix_cadet_eligibility=False)
¶
Generate Simulated AFSC Preferences using certain known parameters.
This method simulates AFSC (Air Force Specialty Code) preferences for cadets using weighted scores derived from merit, tier objectives, and other cadet/AFSC attributes. It supports scenarios where cadet eligibility should be strictly enforced before generating preferences.
Parameters¶
fix_cadet_eligibility : bool, optional If True, cadet preferences are regenerated to strictly respect eligibility constraints. If False (default), original eligibility is used as-is when computing preferences.
Returns¶
None
Updates the parameters
attribute of the current CadetCareerProblem
instance with:
afsc_utility
: N x M utility matrixa_pref_matrix
: AFSCs' ranked preferences over cadetsc_pref_matrix
: Cadets' ranked preferences over AFSCsafsc_preferences
,cadet_preferences
: Index-based ranking dictionaries
See Also¶
generate_fake_afsc_preferences
: Underlying utility simulation and preference generation function.parameter_sets_additions
: Updates parameter subsets and mappings based on the new preference structure.
Source code in afccp/main.py
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 |
|
generate_rated_data()
¶
Generate Simulated Rated Board Data for USAFA and ROTC Cadets.
This method generates Order of Merit (OM) data and interest levels for cadets eligible for Rated AFSCs (e.g., Pilot, CSO, RPA, ABM) for each commissioning source. It only generates data if it does not already exist.
Rated OM and interest data (legacy ROTC Rated Board Data) is essential (not the interest matrix, though) for modeling the Air Forceโs Rated board process, allowing simulation and evaluation of Rated cadet assignments.
Returns¶
None
The method updates the internal self.parameters
dictionary in-place by adding:
- ROTC-rated interest matrix (
rr_interest_matrix
) - OM matrices for each Source of Commission (SOC), e.g.,
ur_om_matrix
,rr_om_matrix
Examples¶
instance = CadetCareerProblem("Random", N=30, M=6, P=6)
instance.generate_rated_data() # Adds Rated OM and interest matrices
See Also¶
generate_rated_data
: Underlying function that constructs the rated OM and interest matrices.parameter_sets_additions
: Updates relevant parameter sets derived from new OM data.
Source code in afccp/main.py
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 |
|
generate_random_value_parameters(num_breakpoints=24, vp_weight=100, printing=None)
¶
Generate Random Value Parameters for Assignment Problem.
This method initializes a new set of randomly generated value-focused thinking (VFT) parameters for a cadet-AFSC matching problem instance. The generated value parameters include random weights, value functions, and AFSC/cadet preferences, making this method ideal for testing and experimentation.
Parameters:¶
num_breakpoints (int, optional): Number of breakpoints to use for linearizing value functions. Defaults to 24. vp_weight (int, optional): Scalar weight applied to the overall value parameter set. Defaults to 100. printing (bool, optional): Whether to print progress information. Defaults to the instance attribute.
Returns:¶
dict: A complete dictionary of randomly generated value parameters for the instance.
Example:¶
# Generate and assign a new set of value parameters using 30 breakpoints
vp = instance.generate_random_value_parameters(num_breakpoints=30, vp_weight=80)
See Also:¶
generate_random_value_parameters
: Initializes a value parameter dictionary from scratch with random objective weights and targets.condense_value_functions
: Cleans and optimizes value function definitions by removing unused entries.value_parameters_sets_additions
: Adds structured sets and subsets to the value parameter dictionary for optimization logic.
Source code in afccp/main.py
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 |
|
generate_example_castle_value_curves(num_breakpoints: int = 10)
¶
Generate and Store Example CASTLE Value Curves.
This method creates example concave value curves for each CASTLE-level AFSC and stores the breakpoint
information in the instance's parameters
dictionary under the key 'castle_q'
.
These curves represent marginal utility of inventory over a range of potential quantities for use in CASTLE sustainment simulations.
Parameters:¶
num_breakpoints (int, optional): Number of breakpoints to use for the concave curve. Defaults to 10.
Returns:¶
None
Example:¶
instance.generate_example_castle_value_curves(num_breakpoints=15)
q = instance.parameters['castle_q']
See Also:¶
generate_realistic_castle_value_curves
: Generates concave breakpoint utility functions for CASTLE AFSCs.
Source code in afccp/main.py
881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 |
|