From 8e0228e8d5624d6c1234c856bffcb44c4a78dbf6 Mon Sep 17 00:00:00 2001 From: PooriaNamyar Date: Tue, 2 Apr 2024 08:39:36 +0000 Subject: [PATCH 1/7] restructuring the code --- .../AnalysisDictionary.xml | 0 .../.stylecop => .stylecop}/StyleCop.props | 0 .../.stylecop => .stylecop}/stylecop.json | 0 .../.stylecop => .stylecop}/stylecop.ruleset | 0 .../CliOptions.cs | 0 .../MachineStat.cs | 0 .../MetaOptimize.Cli.csproj | 0 .../Parser.cs | 0 .../Program.cs | 0 .../cliUtils.cs | 0 .../hotnetsExperiments.cs | 0 .../nsdiExperiments.cs | 0 .../DemandPinningGurobiBinary.cs | 0 .../DemandPinningGurobiMin.cs | 0 .../DemandPinningTestZen.cs | 0 .../DemandPinningTests.cs | 0 .../DemandPinningTestsGurobi.cs | 0 .../DemandPinningTestsGurobiSoS.cs | 0 .../KKtOptimizationTestGurobiBinary.cs | 0 .../KKtOptimizationTestGurobiMin.cs | 0 .../KktOptimizationTests.cs | 0 .../KktOptimizationTestsGurobi.cs | 0 .../KktOptimizationTestsGurobiSOS.cs | 0 .../KktOptimizationTestsZen.cs | 1 + .../MetaOptimize.Test.csproj | 0 .../OptimalEncodingGurobiMin.cs | 0 .../OptimalEncodingTests.cs | 0 .../OptimalEncodingTestsBinary.cs | 0 .../OptimalEncodingTestsGurobi.cs | 0 .../OptimalEncodingTestsGurobiSOS.cs | 0 .../OptimalEncodingTestsZen.cs | 2 + .../OptimalityGapTestGurobiMin.cs | 0 .../OptimalityGapTests.cs | 0 .../OptimalityGapTestsGurobi.cs | 0 .../OptimalityGapTestsGurobiBinary.cs | 0 .../OptimalityGapTestsGurobiSOS.cs | 0 .../OptimalityGapTestsZen.cs | 1 + .../PopEncodingTests.cs | 0 .../PopEncodingTestsGurobi.cs | 0 .../PopEncodingTestsGurobiBinary.cs | 0 .../PopEncodingTestsGurobiMin.cs | 0 .../PopEncodingTestsGurobiSOS.cs | 0 .../PopEncodingTestsZen.cs | 1 + .../TopologyTests.cs | 0 .../MetaOptimize.sln => MetaOptimize.sln | 0 MetaOptimize/.gitignore | 354 ------------------ .../AdversarialGenMethod.cs | 0 .../{MetaOptimize => }/EncodingUtils.cs | 0 MetaOptimize/{MetaOptimize => }/Exceptions.cs | 0 .../{MetaOptimize => }/GenericDemandList.cs | 0 .../{MetaOptimize => }/GurobiBinary.cs | 0 .../{MetaOptimize => }/GurobiCallback.cs | 0 .../{MetaOptimize => }/GurobiEnvironment.cs | 0 MetaOptimize/{MetaOptimize => }/GurobiMin.cs | 0 MetaOptimize/{MetaOptimize => }/GurobiSOS.cs | 0 .../GurobiStoreProgressCallback.cs | 0 .../GurobiTerminationCallback.cs | 0 .../GurobiTimeoutCallback.cs | 0 .../{MetaOptimize => }/IDemandList.cs | 0 MetaOptimize/{MetaOptimize => }/IEncoder.cs | 0 .../{MetaOptimize => }/InnerEncodingMethod.cs | 0 .../KktOptimizationGenerator.cs | 0 .../{MetaOptimize => }/McCormickRelaxation.cs | 0 .../{MetaOptimize => }/MetaOptimize.csproj | 0 MetaOptimize/MetaOptimize/ISolver.cs | 258 ------------- .../OptimizationEncoding.cs | 0 .../OptimizationSolution.cs | 0 .../PIFO/AIFOAvgDelayEncoder.cs | 0 .../{MetaOptimize => }/PIFO/AIFOEncoder.cs | 0 .../PIFO/ModifiedSPPIFOAvgDelayEncoder.cs | 0 .../PIFO/ModifiedSPPIFOEncoder.cs | 0 .../PIFO/PIFOAdversarialInputGenerator.cs | 0 .../PIFO/PIFOAvgDelayOptimalEncoder.cs | 0 .../PIFO/PIFOOptimalEncoder.cs | 0 .../PIFO/PIFOOptimizationEncoding.cs | 0 .../PIFO/PIFOOptimizationSolution.cs | 0 .../{MetaOptimize => }/PIFO/PIFOUtils.cs | 0 .../PIFO/PIFOWithDropAvgDelayEncoder.cs | 0 .../PIFO/PIFOWithDropEncoder.cs | 0 .../PIFO/SPPIFOAvgDelayEncoder.cs | 0 .../{MetaOptimize => }/PIFO/SPPIFOEncoder.cs | 0 .../PIFO/SPPIFOWithDropAvgDelayEncoder.cs | 0 .../PIFO/SPPIFOWithDropEncoder.cs | 0 .../{MetaOptimize => }/PairwiseDemandList.cs | 0 .../{MetaOptimize => }/PathComparer.cs | 0 MetaOptimize/{MetaOptimize => }/Polynomial.cs | 0 .../PrimalDualOptimizationGenerator.cs | 0 MetaOptimize/README.md | 87 ----- .../{MetaOptimize => }/SolverGurobi.cs | 0 MetaOptimize/{MetaOptimize => }/SolverZen.cs | 0 MetaOptimize/{MetaOptimize => }/Term.cs | 0 .../AdversarialInputSimplifier.cs | 0 .../DemandPinningEncoder.cs | 0 .../DemandPinningLinkNegativeException.cs | 0 .../DemandPinningQuantizedEncoder.cs | 0 .../DirectDemandPinningEncoder.cs | 0 .../TrafficEngineering/ExpectedPopEncoder.cs | 0 .../ModifiedDemandPinningQuantizedEncoder.cs | 0 .../TrafficEngineering/PathType.cs | 0 .../TrafficEngineering/PopEncoder.cs | 0 .../TEAdversarialInputGenerator.cs | 0 .../TECombineHeuristicsEncoder.cs | 0 .../TEMaxFlowOptimalEncoder.cs | 0 .../TEMaxFlowOptimizationSolution.cs | 0 .../TEOptimizationEncoding.cs | 0 .../TEOptimizationSolution.cs | 0 .../TrafficEngineering/Topology.cs | 0 .../{MetaOptimize => }/VariableType.cs | 0 .../VectorBinPacking/Bins.cs | 0 .../VectorBinPacking/FFDItemCentricEncoder.cs | 0 .../FFDItemCentricEncoderV2.cs | 0 .../VectorBinPacking/FFDMethod.cs | 0 .../VBPAdversarialInputGenerator.cs | 0 .../VectorBinPacking/VBPOptimalEncoder.cs | 0 .../VBPOptimizationEncoding.cs | 0 .../VBPOptimizationSolution.cs | 0 .../new/FFDItemCentricEncoderNew.cs | 0 .../new/VBPAdversarialInputGeneratorNew.cs | 0 .../new/VBPOptimalEncoderNew.cs | 0 MetaOptimize/build.yml | 26 -- MetaOptimize/{MetaOptimize => }/utils.cs | 0 README.md | 94 ++++- .../Topologies => Topologies}/Cogentco.json | 0 .../Topologies => Topologies}/GtsCe.json | 0 .../Topologies => Topologies}/Kdl.json | 0 .../Topologies => Topologies}/Uninet2010.json | 0 .../Topologies => Topologies}/abilene.json | 0 .../Topologies => Topologies}/analyze_topo.py | 0 .../Topologies => Topologies}/b4-teavar.json | 0 .../bottleneck-dumbell.json | 0 .../Topologies => Topologies}/bottleneck.json | 0 .../dumbell-bottleneck.json | 0 .../ext/modularity/.gitignore | 0 .../FastCommunity_w_GPL_v1.0.1/.gitignore | 0 .../FastCommunity_w_GPL_v1.0.1/Makefile | 0 .../fastcommunity_w_mh.cc | 0 .../FastCommunity_w_GPL_v1.0.1/maxheap.h | 0 .../test1-fc_test1.wpairs | 0 .../FastCommunity_w_GPL_v1.0.1/test1.wpairs | 0 .../test2-fc_t2.wpairs | 0 .../FastCommunity_w_GPL_v1.0.1/test2.wpairs | 0 .../FastCommunity_w_GPL_v1.0.1/vektor.h | 0 .../Topologies => Topologies}/feasible1.json | 0 .../Topologies => Topologies}/networks.py | 0 .../outputs/paths/Cogentco_2sp.json | 0 .../outputs/paths/b4-teavar_2.json | 0 .../parse_and_convert_graphml.py | 0 .../partition_network.py | 0 .../abstract_partitioning_method.py | 0 .../partitioning/fm_partitioning.py | 0 .../partitioning/leader_election.py | 0 .../partitioning/leader_election_uniform.py | 0 .../partitioning/spectral_clustering.py | 0 .../partitioning/utils.py | 0 .../Topologies => Topologies}/ring_20.json | 0 .../Topologies => Topologies}/ring_200.json | 0 .../Topologies => Topologies}/ring_400.json | 0 .../Topologies => Topologies}/swan.json | 0 .../toy-network-2.json | 0 .../toy-network-3.json | 0 .../toy-network.json | 0 .../Topologies => Topologies}/two-srcs.json | 0 .../verify_demand.py | 0 .../metaopt_workflow.png | Bin .../demand_pinning_num_paths_sweep.ipynb | 0 .../demand_pinning_threshold_sweep.ipynb | 0 .../demand_pinning_topology_sweep.ipynb | 0 .../parsers => parsers}/expected_pop.ipynb | 0 .../parsers => parsers}/gap_vs_time.ipynb | 0 .../pop_varying_paths_partitions.ipynb | 0 .../problem_topo_latency.ipynb | 0 171 files changed, 91 insertions(+), 733 deletions(-) rename {MetaOptimize/.stylecop => .stylecop}/AnalysisDictionary.xml (100%) rename {MetaOptimize/.stylecop => .stylecop}/StyleCop.props (100%) rename {MetaOptimize/.stylecop => .stylecop}/stylecop.json (100%) rename {MetaOptimize/.stylecop => .stylecop}/stylecop.ruleset (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/CliOptions.cs (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/MachineStat.cs (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/MetaOptimize.Cli.csproj (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/Parser.cs (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/Program.cs (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/cliUtils.cs (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/hotnetsExperiments.cs (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/nsdiExperiments.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningGurobiBinary.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningGurobiMin.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningTestZen.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningTests.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningTestsGurobi.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningTestsGurobiSoS.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KKtOptimizationTestGurobiBinary.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KKtOptimizationTestGurobiMin.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KktOptimizationTests.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KktOptimizationTestsGurobi.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KktOptimizationTestsGurobiSOS.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KktOptimizationTestsZen.cs (98%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/MetaOptimize.Test.csproj (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingGurobiMin.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingTests.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingTestsBinary.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingTestsGurobi.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingTestsGurobiSOS.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingTestsZen.cs (95%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTestGurobiMin.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTests.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTestsGurobi.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTestsGurobiBinary.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTestsGurobiSOS.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTestsZen.cs (98%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTests.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTestsGurobi.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTestsGurobiBinary.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTestsGurobiMin.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTestsGurobiSOS.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTestsZen.cs (98%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/TopologyTests.cs (100%) rename MetaOptimize/MetaOptimize.sln => MetaOptimize.sln (100%) delete mode 100644 MetaOptimize/.gitignore rename MetaOptimize/{MetaOptimize => }/AdversarialGenMethod.cs (100%) rename MetaOptimize/{MetaOptimize => }/EncodingUtils.cs (100%) rename MetaOptimize/{MetaOptimize => }/Exceptions.cs (100%) rename MetaOptimize/{MetaOptimize => }/GenericDemandList.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiBinary.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiCallback.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiEnvironment.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiMin.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiSOS.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiStoreProgressCallback.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiTerminationCallback.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiTimeoutCallback.cs (100%) rename MetaOptimize/{MetaOptimize => }/IDemandList.cs (100%) rename MetaOptimize/{MetaOptimize => }/IEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/InnerEncodingMethod.cs (100%) rename MetaOptimize/{MetaOptimize => }/KktOptimizationGenerator.cs (100%) rename MetaOptimize/{MetaOptimize => }/McCormickRelaxation.cs (100%) rename MetaOptimize/{MetaOptimize => }/MetaOptimize.csproj (100%) delete mode 100644 MetaOptimize/MetaOptimize/ISolver.cs rename MetaOptimize/{MetaOptimize => }/OptimizationEncoding.cs (100%) rename MetaOptimize/{MetaOptimize => }/OptimizationSolution.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/AIFOAvgDelayEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/AIFOEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/ModifiedSPPIFOAvgDelayEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/ModifiedSPPIFOEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOAdversarialInputGenerator.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOAvgDelayOptimalEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOOptimalEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOOptimizationEncoding.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOOptimizationSolution.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOUtils.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOWithDropAvgDelayEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOWithDropEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/SPPIFOAvgDelayEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/SPPIFOEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/SPPIFOWithDropAvgDelayEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/SPPIFOWithDropEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PairwiseDemandList.cs (100%) rename MetaOptimize/{MetaOptimize => }/PathComparer.cs (100%) rename MetaOptimize/{MetaOptimize => }/Polynomial.cs (100%) rename MetaOptimize/{MetaOptimize => }/PrimalDualOptimizationGenerator.cs (100%) delete mode 100644 MetaOptimize/README.md rename MetaOptimize/{MetaOptimize => }/SolverGurobi.cs (100%) rename MetaOptimize/{MetaOptimize => }/SolverZen.cs (100%) rename MetaOptimize/{MetaOptimize => }/Term.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/AdversarialInputSimplifier.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/DemandPinningEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/DemandPinningLinkNegativeException.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/DemandPinningQuantizedEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/DirectDemandPinningEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/ExpectedPopEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/ModifiedDemandPinningQuantizedEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/PathType.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/PopEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TEAdversarialInputGenerator.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TECombineHeuristicsEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TEMaxFlowOptimalEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TEMaxFlowOptimizationSolution.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TEOptimizationEncoding.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TEOptimizationSolution.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/Topology.cs (100%) rename MetaOptimize/{MetaOptimize => }/VariableType.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/Bins.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/FFDItemCentricEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/FFDItemCentricEncoderV2.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/FFDMethod.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/VBPAdversarialInputGenerator.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/VBPOptimalEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/VBPOptimizationEncoding.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/VBPOptimizationSolution.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/new/FFDItemCentricEncoderNew.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/new/VBPAdversarialInputGeneratorNew.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/new/VBPOptimalEncoderNew.cs (100%) delete mode 100644 MetaOptimize/build.yml rename MetaOptimize/{MetaOptimize => }/utils.cs (100%) rename {MetaOptimize/Topologies => Topologies}/Cogentco.json (100%) rename {MetaOptimize/Topologies => Topologies}/GtsCe.json (100%) rename {MetaOptimize/Topologies => Topologies}/Kdl.json (100%) rename {MetaOptimize/Topologies => Topologies}/Uninet2010.json (100%) rename {MetaOptimize/Topologies => Topologies}/abilene.json (100%) rename {MetaOptimize/Topologies => Topologies}/analyze_topo.py (100%) rename {MetaOptimize/Topologies => Topologies}/b4-teavar.json (100%) rename {MetaOptimize/Topologies => Topologies}/bottleneck-dumbell.json (100%) rename {MetaOptimize/Topologies => Topologies}/bottleneck.json (100%) rename {MetaOptimize/Topologies => Topologies}/dumbell-bottleneck.json (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/.gitignore (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/.gitignore (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/Makefile (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/fastcommunity_w_mh.cc (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/maxheap.h (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1-fc_test1.wpairs (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1.wpairs (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2-fc_t2.wpairs (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2.wpairs (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/vektor.h (100%) rename {MetaOptimize/Topologies => Topologies}/feasible1.json (100%) rename {MetaOptimize/Topologies => Topologies}/networks.py (100%) rename {MetaOptimize/Topologies => Topologies}/outputs/paths/Cogentco_2sp.json (100%) rename {MetaOptimize/Topologies => Topologies}/outputs/paths/b4-teavar_2.json (100%) rename {MetaOptimize/Topologies => Topologies}/parse_and_convert_graphml.py (100%) rename {MetaOptimize/Topologies => Topologies}/partition_network.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/abstract_partitioning_method.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/fm_partitioning.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/leader_election.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/leader_election_uniform.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/spectral_clustering.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/utils.py (100%) rename {MetaOptimize/Topologies => Topologies}/ring_20.json (100%) rename {MetaOptimize/Topologies => Topologies}/ring_200.json (100%) rename {MetaOptimize/Topologies => Topologies}/ring_400.json (100%) rename {MetaOptimize/Topologies => Topologies}/swan.json (100%) rename {MetaOptimize/Topologies => Topologies}/toy-network-2.json (100%) rename {MetaOptimize/Topologies => Topologies}/toy-network-3.json (100%) rename {MetaOptimize/Topologies => Topologies}/toy-network.json (100%) rename {MetaOptimize/Topologies => Topologies}/two-srcs.json (100%) rename {MetaOptimize/Topologies => Topologies}/verify_demand.py (100%) rename {MetaOptimize => figures}/metaopt_workflow.png (100%) rename {MetaOptimize/parsers => parsers}/demand_pinning_num_paths_sweep.ipynb (100%) rename {MetaOptimize/parsers => parsers}/demand_pinning_threshold_sweep.ipynb (100%) rename {MetaOptimize/parsers => parsers}/demand_pinning_topology_sweep.ipynb (100%) rename {MetaOptimize/parsers => parsers}/expected_pop.ipynb (100%) rename {MetaOptimize/parsers => parsers}/gap_vs_time.ipynb (100%) rename {MetaOptimize/parsers => parsers}/pop_varying_paths_partitions.ipynb (100%) rename {MetaOptimize/parsers => parsers}/problem_topo_latency.ipynb (100%) diff --git a/MetaOptimize/.stylecop/AnalysisDictionary.xml b/.stylecop/AnalysisDictionary.xml similarity index 100% rename from MetaOptimize/.stylecop/AnalysisDictionary.xml rename to .stylecop/AnalysisDictionary.xml diff --git a/MetaOptimize/.stylecop/StyleCop.props b/.stylecop/StyleCop.props similarity index 100% rename from MetaOptimize/.stylecop/StyleCop.props rename to .stylecop/StyleCop.props diff --git a/MetaOptimize/.stylecop/stylecop.json b/.stylecop/stylecop.json similarity index 100% rename from MetaOptimize/.stylecop/stylecop.json rename to .stylecop/stylecop.json diff --git a/MetaOptimize/.stylecop/stylecop.ruleset b/.stylecop/stylecop.ruleset similarity index 100% rename from MetaOptimize/.stylecop/stylecop.ruleset rename to .stylecop/stylecop.ruleset diff --git a/MetaOptimize/MetaOptimize.Cli/CliOptions.cs b/MetaOptimize.Cli/CliOptions.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/CliOptions.cs rename to MetaOptimize.Cli/CliOptions.cs diff --git a/MetaOptimize/MetaOptimize.Cli/MachineStat.cs b/MetaOptimize.Cli/MachineStat.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/MachineStat.cs rename to MetaOptimize.Cli/MachineStat.cs diff --git a/MetaOptimize/MetaOptimize.Cli/MetaOptimize.Cli.csproj b/MetaOptimize.Cli/MetaOptimize.Cli.csproj similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/MetaOptimize.Cli.csproj rename to MetaOptimize.Cli/MetaOptimize.Cli.csproj diff --git a/MetaOptimize/MetaOptimize.Cli/Parser.cs b/MetaOptimize.Cli/Parser.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/Parser.cs rename to MetaOptimize.Cli/Parser.cs diff --git a/MetaOptimize/MetaOptimize.Cli/Program.cs b/MetaOptimize.Cli/Program.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/Program.cs rename to MetaOptimize.Cli/Program.cs diff --git a/MetaOptimize/MetaOptimize.Cli/cliUtils.cs b/MetaOptimize.Cli/cliUtils.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/cliUtils.cs rename to MetaOptimize.Cli/cliUtils.cs diff --git a/MetaOptimize/MetaOptimize.Cli/hotnetsExperiments.cs b/MetaOptimize.Cli/hotnetsExperiments.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/hotnetsExperiments.cs rename to MetaOptimize.Cli/hotnetsExperiments.cs diff --git a/MetaOptimize/MetaOptimize.Cli/nsdiExperiments.cs b/MetaOptimize.Cli/nsdiExperiments.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/nsdiExperiments.cs rename to MetaOptimize.Cli/nsdiExperiments.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningGurobiBinary.cs b/MetaOptimize.Test/DemandPinningGurobiBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningGurobiBinary.cs rename to MetaOptimize.Test/DemandPinningGurobiBinary.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningGurobiMin.cs b/MetaOptimize.Test/DemandPinningGurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningGurobiMin.cs rename to MetaOptimize.Test/DemandPinningGurobiMin.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningTestZen.cs b/MetaOptimize.Test/DemandPinningTestZen.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningTestZen.cs rename to MetaOptimize.Test/DemandPinningTestZen.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningTests.cs b/MetaOptimize.Test/DemandPinningTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningTests.cs rename to MetaOptimize.Test/DemandPinningTests.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningTestsGurobi.cs b/MetaOptimize.Test/DemandPinningTestsGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningTestsGurobi.cs rename to MetaOptimize.Test/DemandPinningTestsGurobi.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningTestsGurobiSoS.cs b/MetaOptimize.Test/DemandPinningTestsGurobiSoS.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningTestsGurobiSoS.cs rename to MetaOptimize.Test/DemandPinningTestsGurobiSoS.cs diff --git a/MetaOptimize/MetaOptimize.Test/KKtOptimizationTestGurobiBinary.cs b/MetaOptimize.Test/KKtOptimizationTestGurobiBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/KKtOptimizationTestGurobiBinary.cs rename to MetaOptimize.Test/KKtOptimizationTestGurobiBinary.cs diff --git a/MetaOptimize/MetaOptimize.Test/KKtOptimizationTestGurobiMin.cs b/MetaOptimize.Test/KKtOptimizationTestGurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/KKtOptimizationTestGurobiMin.cs rename to MetaOptimize.Test/KKtOptimizationTestGurobiMin.cs diff --git a/MetaOptimize/MetaOptimize.Test/KktOptimizationTests.cs b/MetaOptimize.Test/KktOptimizationTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/KktOptimizationTests.cs rename to MetaOptimize.Test/KktOptimizationTests.cs diff --git a/MetaOptimize/MetaOptimize.Test/KktOptimizationTestsGurobi.cs b/MetaOptimize.Test/KktOptimizationTestsGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/KktOptimizationTestsGurobi.cs rename to MetaOptimize.Test/KktOptimizationTestsGurobi.cs diff --git a/MetaOptimize/MetaOptimize.Test/KktOptimizationTestsGurobiSOS.cs b/MetaOptimize.Test/KktOptimizationTestsGurobiSOS.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/KktOptimizationTestsGurobiSOS.cs rename to MetaOptimize.Test/KktOptimizationTestsGurobiSOS.cs diff --git a/MetaOptimize/MetaOptimize.Test/KktOptimizationTestsZen.cs b/MetaOptimize.Test/KktOptimizationTestsZen.cs similarity index 98% rename from MetaOptimize/MetaOptimize.Test/KktOptimizationTestsZen.cs rename to MetaOptimize.Test/KktOptimizationTestsZen.cs index a17f2d11..a6f31caf 100644 --- a/MetaOptimize/MetaOptimize.Test/KktOptimizationTestsZen.cs +++ b/MetaOptimize.Test/KktOptimizationTestsZen.cs @@ -12,6 +12,7 @@ namespace MetaOptimize.Test /// Some basic optimization tests. /// [TestClass] + [Ignore] public class KktOptimizationTestsZen : KktOptimizationTests, ZenSolution> { /// diff --git a/MetaOptimize/MetaOptimize.Test/MetaOptimize.Test.csproj b/MetaOptimize.Test/MetaOptimize.Test.csproj similarity index 100% rename from MetaOptimize/MetaOptimize.Test/MetaOptimize.Test.csproj rename to MetaOptimize.Test/MetaOptimize.Test.csproj diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingGurobiMin.cs b/MetaOptimize.Test/OptimalEncodingGurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingGurobiMin.cs rename to MetaOptimize.Test/OptimalEncodingGurobiMin.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTests.cs b/MetaOptimize.Test/OptimalEncodingTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingTests.cs rename to MetaOptimize.Test/OptimalEncodingTests.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsBinary.cs b/MetaOptimize.Test/OptimalEncodingTestsBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsBinary.cs rename to MetaOptimize.Test/OptimalEncodingTestsBinary.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsGurobi.cs b/MetaOptimize.Test/OptimalEncodingTestsGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsGurobi.cs rename to MetaOptimize.Test/OptimalEncodingTestsGurobi.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsGurobiSOS.cs b/MetaOptimize.Test/OptimalEncodingTestsGurobiSOS.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsGurobiSOS.cs rename to MetaOptimize.Test/OptimalEncodingTestsGurobiSOS.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsZen.cs b/MetaOptimize.Test/OptimalEncodingTestsZen.cs similarity index 95% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsZen.cs rename to MetaOptimize.Test/OptimalEncodingTestsZen.cs index decd6b31..154b9919 100644 --- a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsZen.cs +++ b/MetaOptimize.Test/OptimalEncodingTestsZen.cs @@ -12,12 +12,14 @@ namespace MetaOptimize.Test /// Tests for the optimal encoder. /// [TestClass] + [Ignore] public class OptimalEncodingTestsZen : OptimalEncodingTests, ZenSolution> { /// /// Initialize the test class. /// [TestInitialize] + [Ignore] public void Initialize() { this.CreateSolver = () => new SolverZen(); diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestGurobiMin.cs b/MetaOptimize.Test/OptimalityGapTestGurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTestGurobiMin.cs rename to MetaOptimize.Test/OptimalityGapTestGurobiMin.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTests.cs b/MetaOptimize.Test/OptimalityGapTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTests.cs rename to MetaOptimize.Test/OptimalityGapTests.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobi.cs b/MetaOptimize.Test/OptimalityGapTestsGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobi.cs rename to MetaOptimize.Test/OptimalityGapTestsGurobi.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobiBinary.cs b/MetaOptimize.Test/OptimalityGapTestsGurobiBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobiBinary.cs rename to MetaOptimize.Test/OptimalityGapTestsGurobiBinary.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobiSOS.cs b/MetaOptimize.Test/OptimalityGapTestsGurobiSOS.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobiSOS.cs rename to MetaOptimize.Test/OptimalityGapTestsGurobiSOS.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestsZen.cs b/MetaOptimize.Test/OptimalityGapTestsZen.cs similarity index 98% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTestsZen.cs rename to MetaOptimize.Test/OptimalityGapTestsZen.cs index 621fca9a..910200fe 100644 --- a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestsZen.cs +++ b/MetaOptimize.Test/OptimalityGapTestsZen.cs @@ -12,6 +12,7 @@ namespace MetaOptimize.Test /// Tests for the optimality gap. /// [TestClass] + [Ignore] public class OptimalityGapTestsZen : OptimalityGapTests, ZenSolution> { /// diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTests.cs b/MetaOptimize.Test/PopEncodingTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTests.cs rename to MetaOptimize.Test/PopEncodingTests.cs diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobi.cs b/MetaOptimize.Test/PopEncodingTestsGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobi.cs rename to MetaOptimize.Test/PopEncodingTestsGurobi.cs diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiBinary.cs b/MetaOptimize.Test/PopEncodingTestsGurobiBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiBinary.cs rename to MetaOptimize.Test/PopEncodingTestsGurobiBinary.cs diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiMin.cs b/MetaOptimize.Test/PopEncodingTestsGurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiMin.cs rename to MetaOptimize.Test/PopEncodingTestsGurobiMin.cs diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiSOS.cs b/MetaOptimize.Test/PopEncodingTestsGurobiSOS.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiSOS.cs rename to MetaOptimize.Test/PopEncodingTestsGurobiSOS.cs diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsZen.cs b/MetaOptimize.Test/PopEncodingTestsZen.cs similarity index 98% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTestsZen.cs rename to MetaOptimize.Test/PopEncodingTestsZen.cs index 9b135fb5..bdc05128 100644 --- a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsZen.cs +++ b/MetaOptimize.Test/PopEncodingTestsZen.cs @@ -12,6 +12,7 @@ namespace MetaOptimize.Test /// Tests for the pop encoder. /// [TestClass] + [Ignore] public class PopEncodingTestsZen : PopEncodingTests, ZenSolution> { /// diff --git a/MetaOptimize/MetaOptimize.Test/TopologyTests.cs b/MetaOptimize.Test/TopologyTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/TopologyTests.cs rename to MetaOptimize.Test/TopologyTests.cs diff --git a/MetaOptimize/MetaOptimize.sln b/MetaOptimize.sln similarity index 100% rename from MetaOptimize/MetaOptimize.sln rename to MetaOptimize.sln diff --git a/MetaOptimize/.gitignore b/MetaOptimize/.gitignore deleted file mode 100644 index 1dfb48ac..00000000 --- a/MetaOptimize/.gitignore +++ /dev/null @@ -1,354 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -logs/* -figs/* -Topologies/partition_log/* \ No newline at end of file diff --git a/MetaOptimize/MetaOptimize/AdversarialGenMethod.cs b/MetaOptimize/AdversarialGenMethod.cs similarity index 100% rename from MetaOptimize/MetaOptimize/AdversarialGenMethod.cs rename to MetaOptimize/AdversarialGenMethod.cs diff --git a/MetaOptimize/MetaOptimize/EncodingUtils.cs b/MetaOptimize/EncodingUtils.cs similarity index 100% rename from MetaOptimize/MetaOptimize/EncodingUtils.cs rename to MetaOptimize/EncodingUtils.cs diff --git a/MetaOptimize/MetaOptimize/Exceptions.cs b/MetaOptimize/Exceptions.cs similarity index 100% rename from MetaOptimize/MetaOptimize/Exceptions.cs rename to MetaOptimize/Exceptions.cs diff --git a/MetaOptimize/MetaOptimize/GenericDemandList.cs b/MetaOptimize/GenericDemandList.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GenericDemandList.cs rename to MetaOptimize/GenericDemandList.cs diff --git a/MetaOptimize/MetaOptimize/GurobiBinary.cs b/MetaOptimize/GurobiBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiBinary.cs rename to MetaOptimize/GurobiBinary.cs diff --git a/MetaOptimize/MetaOptimize/GurobiCallback.cs b/MetaOptimize/GurobiCallback.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiCallback.cs rename to MetaOptimize/GurobiCallback.cs diff --git a/MetaOptimize/MetaOptimize/GurobiEnvironment.cs b/MetaOptimize/GurobiEnvironment.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiEnvironment.cs rename to MetaOptimize/GurobiEnvironment.cs diff --git a/MetaOptimize/MetaOptimize/GurobiMin.cs b/MetaOptimize/GurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiMin.cs rename to MetaOptimize/GurobiMin.cs diff --git a/MetaOptimize/MetaOptimize/GurobiSOS.cs b/MetaOptimize/GurobiSOS.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiSOS.cs rename to MetaOptimize/GurobiSOS.cs diff --git a/MetaOptimize/MetaOptimize/GurobiStoreProgressCallback.cs b/MetaOptimize/GurobiStoreProgressCallback.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiStoreProgressCallback.cs rename to MetaOptimize/GurobiStoreProgressCallback.cs diff --git a/MetaOptimize/MetaOptimize/GurobiTerminationCallback.cs b/MetaOptimize/GurobiTerminationCallback.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiTerminationCallback.cs rename to MetaOptimize/GurobiTerminationCallback.cs diff --git a/MetaOptimize/MetaOptimize/GurobiTimeoutCallback.cs b/MetaOptimize/GurobiTimeoutCallback.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiTimeoutCallback.cs rename to MetaOptimize/GurobiTimeoutCallback.cs diff --git a/MetaOptimize/MetaOptimize/IDemandList.cs b/MetaOptimize/IDemandList.cs similarity index 100% rename from MetaOptimize/MetaOptimize/IDemandList.cs rename to MetaOptimize/IDemandList.cs diff --git a/MetaOptimize/MetaOptimize/IEncoder.cs b/MetaOptimize/IEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/IEncoder.cs rename to MetaOptimize/IEncoder.cs diff --git a/MetaOptimize/MetaOptimize/InnerEncodingMethod.cs b/MetaOptimize/InnerEncodingMethod.cs similarity index 100% rename from MetaOptimize/MetaOptimize/InnerEncodingMethod.cs rename to MetaOptimize/InnerEncodingMethod.cs diff --git a/MetaOptimize/MetaOptimize/KktOptimizationGenerator.cs b/MetaOptimize/KktOptimizationGenerator.cs similarity index 100% rename from MetaOptimize/MetaOptimize/KktOptimizationGenerator.cs rename to MetaOptimize/KktOptimizationGenerator.cs diff --git a/MetaOptimize/MetaOptimize/McCormickRelaxation.cs b/MetaOptimize/McCormickRelaxation.cs similarity index 100% rename from MetaOptimize/MetaOptimize/McCormickRelaxation.cs rename to MetaOptimize/McCormickRelaxation.cs diff --git a/MetaOptimize/MetaOptimize/MetaOptimize.csproj b/MetaOptimize/MetaOptimize.csproj similarity index 100% rename from MetaOptimize/MetaOptimize/MetaOptimize.csproj rename to MetaOptimize/MetaOptimize.csproj diff --git a/MetaOptimize/MetaOptimize/ISolver.cs b/MetaOptimize/MetaOptimize/ISolver.cs deleted file mode 100644 index 7aa7ea68..00000000 --- a/MetaOptimize/MetaOptimize/ISolver.cs +++ /dev/null @@ -1,258 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// - -namespace MetaOptimize -{ - using System.Collections.Generic; - using Gurobi; - /// - /// An interface for an optimization solver. - /// - public interface ISolver - { - /// - /// Reset the solver by removing all the variables and constraints. - /// - public void CleanAll(double timeout = -1, bool disableStoreProgress = false); - - /// - /// Reset the solver by removing all the variables and constraints. - /// - public void CleanAll(bool focusBstBd, double timeout = -1); - - /// - /// Create a new variable with a given name. - /// - /// The variable name. - /// the type of variable. - /// The lb on the variable. - /// The ub on the variable. - /// The solver variable. - public TVar CreateVariable(string name, char type = GRB.CONTINUOUS, - double lb = double.NegativeInfinity, double ub = double.PositiveInfinity); - - /// - /// Get the resulting value assigned to a variable. - /// - /// The solver solution. - /// The variable. - /// which solution to return (if multiple solutions). - /// The value as a double. - public double GetVariable(TSolution solution, TVar variable, int solutionNumber = 0); - - /// - /// Get the resulting value assigned to a variable. - /// - public double GetDualVariable(TSolution solution, string constrName); - - /// - /// set the objective. - /// - /// The solver solution. - public void SetObjective(Polynomial objective); - - /// - /// set the objective. - /// - /// The solver solution. - public void SetObjective(TVar objective); - - /// - /// set the objective. - /// - /// value for timeout. - public void SetTimeout(double timeout); - - /// - /// set the FocusBstBd. - /// - public void SetFocusBstBd(bool focusBstBd); - - /// - /// get model. - /// - public TSolution GetModel(); - - /// - /// Add a less than or equal to zero constraint. - /// - /// The polynomial. - /// name of the constraint. - public string AddLeqZeroConstraint(Polynomial polynomial); - - /// - /// Add a less than or equal to zero constraint (Quadratic). - /// Following constraints; A * B + C \leq 0. - /// - /// The coefficent polynomial list (A). - /// The variable list (B). - /// The linear term (C). - /// type of variable in coeff polynomial list (C). - /// type of variable in variable list (E). - /// name of the constraint. - public string AddLeqZeroConstraint(IList> coeffPolyList, IList variableList, - Polynomial linearPoly, VariableType coeffVarType = VariableType.BINARY, - VariableType varType = VariableType.CONTINUOUS); - - /// - /// Add a equal to zero constraint. - /// - /// The polynomial. - /// name of the constraint. - public string AddEqZeroConstraint(Polynomial polynomial); - - /// - /// Add a equal to zero constraint (Quadratic). - /// Following constraints; A * B + C == 0. - /// - /// The coefficent polynomial list (A). - /// The variable list (B). - /// The linear term (C). - /// type of variable in coeff polynomial list (D). - /// type of variable in variable list (E). - /// name of the constraint. - public string AddEqZeroConstraint(IList> coeffPolyList, IList variableList, - Polynomial linearPoly, VariableType coeffVarType = VariableType.BINARY, - VariableType varType = VariableType.CONTINUOUS); - - /// - /// Add or equals zero. - /// - /// The first polynomial. - /// The second polynomial. - public void AddOrEqZeroConstraint(Polynomial polynomial1, Polynomial polynomial2); - - /// - /// Add a = max(b, c) constraint. - /// - public void AddMaxConstraint(TVar LHS, Polynomial maxItem1, Polynomial maxItem2); - - /// - /// Add a = max(b, constant) constraint. - /// - public void AddMaxConstraint(TVar LHS, Polynomial var1, double constant); - - /// - /// Add a = max(b, constant) constraint. - /// - public void AddMaxConstraint(TVar LHS, TVar var1, double constant); - - /// - /// Add a = max(b, c) constraint. - /// - public void AddMaxConstraint(TVar LHS, TVar var1, TVar var2); - - /// - /// Logistic constraint y = 1/(1 + exp(-x)). - /// - public void AddLogisticConstraint(TVar xVar, TVar yVar, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, - double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); - - /// - /// power constraint y = x^a. - /// - public void AddPowerConstraint(TVar xVar, TVar yVar, int a, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, - double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); - - /// - /// polynomial constraint y = p0 x^d + p1 x^{d-1} + ... + pd. - /// - public void AddPolynomialConstraint(TVar xVar, TVar yVar, double[] p, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, - double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); - - /// - /// polynomial constraint y = norm_d(x_1, ..., x_n). - /// - public void AddNormConstraint(TVar[] xVar, TVar yVar, double which, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, - double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); - - /// - /// Remove a constraint. - /// - /// name of the constraint in the string format. - public void RemoveConstraint(string constraintName); - - /// - /// Change constraint's RHS. - /// - /// name of the constraint in the string format. - /// new RHS of the constraint. - public void ChangeConstraintRHS(string constraintName, double newRHS); - - /// - /// Combine the constraints and variables of another solver into this one. - /// - /// The other solver. - public void CombineWith(ISolver otherSolver); - - /// - /// Maximize the objective. - /// - /// A solution. - public TSolution Maximize(); - - /// - /// Maximize the objective with objective as input. - /// - /// A solution. - public TSolution Maximize(Polynomial objective); - - /// - /// Maximize the objective with objective as input. - /// reset the callback timer. - /// - /// A solution. - public TSolution Maximize(Polynomial objective, bool reset); - - /// - /// find the top $k$ solutions. - /// - public TSolution Maximize(Polynomial objective, bool reset, int solutionCount); - - /// - /// Maximize a quadratic objective with objective as input. - /// reset the callback timer. - /// - /// A solution. - public TSolution MaximizeQuadPow2(IList> quadObjective, IList quadCoeff, Polynomial linObjective, bool reset = false); - - /// - /// Maximize the objective with objective as input. - /// - /// A solution. - public TSolution Maximize(TVar objective); - - /// - /// Check feasibility. - /// - /// A solution. - public TSolution CheckFeasibility(double objectiveValue); - - /// - /// Call the model update to apply new constraints and objectives. - /// - public void ModelUpdate(); - - /// - /// initialize some of the variables. - /// - public void InitializeVariables(TVar variable, double value); - - /// - /// adding some auxiliary term to be added to the global objective when maximized. - /// - public void AddGlobalTerm(Polynomial auxObjPoly); - - /// - /// append as the next line of the store progress file. - /// - public void AppendToStoreProgressFile(double time_ms, double gap, bool reset = false); - - /// - /// writes the model to a file. - /// - /// - public void WriteModel(string location); - } -} diff --git a/MetaOptimize/MetaOptimize/OptimizationEncoding.cs b/MetaOptimize/OptimizationEncoding.cs similarity index 100% rename from MetaOptimize/MetaOptimize/OptimizationEncoding.cs rename to MetaOptimize/OptimizationEncoding.cs diff --git a/MetaOptimize/MetaOptimize/OptimizationSolution.cs b/MetaOptimize/OptimizationSolution.cs similarity index 100% rename from MetaOptimize/MetaOptimize/OptimizationSolution.cs rename to MetaOptimize/OptimizationSolution.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/AIFOAvgDelayEncoder.cs b/MetaOptimize/PIFO/AIFOAvgDelayEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/AIFOAvgDelayEncoder.cs rename to MetaOptimize/PIFO/AIFOAvgDelayEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/AIFOEncoder.cs b/MetaOptimize/PIFO/AIFOEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/AIFOEncoder.cs rename to MetaOptimize/PIFO/AIFOEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/ModifiedSPPIFOAvgDelayEncoder.cs b/MetaOptimize/PIFO/ModifiedSPPIFOAvgDelayEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/ModifiedSPPIFOAvgDelayEncoder.cs rename to MetaOptimize/PIFO/ModifiedSPPIFOAvgDelayEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/ModifiedSPPIFOEncoder.cs b/MetaOptimize/PIFO/ModifiedSPPIFOEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/ModifiedSPPIFOEncoder.cs rename to MetaOptimize/PIFO/ModifiedSPPIFOEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOAdversarialInputGenerator.cs b/MetaOptimize/PIFO/PIFOAdversarialInputGenerator.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOAdversarialInputGenerator.cs rename to MetaOptimize/PIFO/PIFOAdversarialInputGenerator.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOAvgDelayOptimalEncoder.cs b/MetaOptimize/PIFO/PIFOAvgDelayOptimalEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOAvgDelayOptimalEncoder.cs rename to MetaOptimize/PIFO/PIFOAvgDelayOptimalEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOOptimalEncoder.cs b/MetaOptimize/PIFO/PIFOOptimalEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOOptimalEncoder.cs rename to MetaOptimize/PIFO/PIFOOptimalEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOOptimizationEncoding.cs b/MetaOptimize/PIFO/PIFOOptimizationEncoding.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOOptimizationEncoding.cs rename to MetaOptimize/PIFO/PIFOOptimizationEncoding.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOOptimizationSolution.cs b/MetaOptimize/PIFO/PIFOOptimizationSolution.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOOptimizationSolution.cs rename to MetaOptimize/PIFO/PIFOOptimizationSolution.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOUtils.cs b/MetaOptimize/PIFO/PIFOUtils.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOUtils.cs rename to MetaOptimize/PIFO/PIFOUtils.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOWithDropAvgDelayEncoder.cs b/MetaOptimize/PIFO/PIFOWithDropAvgDelayEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOWithDropAvgDelayEncoder.cs rename to MetaOptimize/PIFO/PIFOWithDropAvgDelayEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOWithDropEncoder.cs b/MetaOptimize/PIFO/PIFOWithDropEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOWithDropEncoder.cs rename to MetaOptimize/PIFO/PIFOWithDropEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/SPPIFOAvgDelayEncoder.cs b/MetaOptimize/PIFO/SPPIFOAvgDelayEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/SPPIFOAvgDelayEncoder.cs rename to MetaOptimize/PIFO/SPPIFOAvgDelayEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/SPPIFOEncoder.cs b/MetaOptimize/PIFO/SPPIFOEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/SPPIFOEncoder.cs rename to MetaOptimize/PIFO/SPPIFOEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/SPPIFOWithDropAvgDelayEncoder.cs b/MetaOptimize/PIFO/SPPIFOWithDropAvgDelayEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/SPPIFOWithDropAvgDelayEncoder.cs rename to MetaOptimize/PIFO/SPPIFOWithDropAvgDelayEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/SPPIFOWithDropEncoder.cs b/MetaOptimize/PIFO/SPPIFOWithDropEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/SPPIFOWithDropEncoder.cs rename to MetaOptimize/PIFO/SPPIFOWithDropEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PairwiseDemandList.cs b/MetaOptimize/PairwiseDemandList.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PairwiseDemandList.cs rename to MetaOptimize/PairwiseDemandList.cs diff --git a/MetaOptimize/MetaOptimize/PathComparer.cs b/MetaOptimize/PathComparer.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PathComparer.cs rename to MetaOptimize/PathComparer.cs diff --git a/MetaOptimize/MetaOptimize/Polynomial.cs b/MetaOptimize/Polynomial.cs similarity index 100% rename from MetaOptimize/MetaOptimize/Polynomial.cs rename to MetaOptimize/Polynomial.cs diff --git a/MetaOptimize/MetaOptimize/PrimalDualOptimizationGenerator.cs b/MetaOptimize/PrimalDualOptimizationGenerator.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PrimalDualOptimizationGenerator.cs rename to MetaOptimize/PrimalDualOptimizationGenerator.cs diff --git a/MetaOptimize/README.md b/MetaOptimize/README.md deleted file mode 100644 index c7084ea2..00000000 --- a/MetaOptimize/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# MetaOpt: Examining, explaining, and improving heuristic performance - -`MetaOpt` is the first general-purpose and scalable tool that enables users to analyze a broad class of heuristics through easy-to-use abstractions that apply to a broad range of practical heuristics. For more information, checkout [MetaOpt's project webpage](https://www.microsoft.com/en-us/research/project/finding-adversarial-inputs-for-heuristics/overview/) and our NSDI'24 paper ([Finding Adversarial Inputs for Heuristics using Multi-level Optimization](https://arxiv.org/abs/2311.12779)). - - -## Code Structure -``` -├── MetaOptimize # Implementation of all the main components of MetaOpt. -| | # (helper functions, solver APIs, rewrites, etc.) -| | -| ├── TrafficEngineering # implementation of TE encoders (OPT, DP, and POP) -| | # and TE adversarial generator. -| | -| ├── VectorBinPacking # implementation of VBP encoders (OPT and variants of FF) -| | # and VBP adversarial generator. -| | -| └── PIFO # implementation of PIFO, SP-PIFO, and AIFO encoders. -| -| -├── MetaOptimize.Cli # examples and scripts to reproduce the results in -| # our NSDI24 and HotNet22 papers. -| -└── MetaOptimize.Test # testcases for MetaOpt. -``` - -## Getting Started - -We provide multiple example Main functions that you can try in `MetaOptimize.Cli/Program.cs` for different heuristics in vector bin packing, packet scheduling, and traffic engineering. - -We also provide many unit-tests that can serve as a starting point in `MetaOptimize.Test`. - -You can use MetaOpt either with the [Gurobi optimization solver](https://www.gurobi.com/documentation/current/examples/cs_examples.html) -or with [Zen](https://dl.acm.org/doi/10.1145/3422604.3425930). -Make sure you install both solvers and configure the proper Gurobi license. If you are in academia, you can follow the instructions on Gurobi's website to obtain a license. - -## Analyzing heuristics using MetaOpt - -

- -

- - -If you would like to analyze a heuristic that we have not modeled as part of MetaOpt yet, here are the steps to follow: - -1- Model your heuristic as either a convex optimization problem or a feasibility problem which our solvers can support. -How you model the problem is important and can significantly influence MetaOpt's ability to scale (and also whether Gurobi can run into -numerical issues). If you run into trouble with this step, feel free to contact the MetaOpt authors at: namyar@usc.edu and bearzani@microsoft.com. - -2- You need to write an `Encoder` library for both the heuristic you want to analyze and the optimal form of the problem (or if you want to compare two heuristics, for the other heuristics). -We strongly recommend looking at the Traffic Engineering, VBP, and packet scheduling Encoders we have provided as part of the MetaOpt code-base for examples. -Encoders must meet the specifications in the `IEncoder.cs` library. -If your problem is a convex optimization problem (and NOT a feasibility problem), you also need to pick the type of re-write you want to use (`KKT` or `quantized primal dual`). -We recommend the quantized primal dual approach to achieve better scalability. - -To use the quantized primal dual approach, you also need to specify the quantization levels. - -3- Once you have both of the encoders in place, you have to write an adversarial input generator. See the `TE` and `VBP` folders for examples. -To solve the MetaOpt problem, you need to create the `input variables` in the adversarial input generator and pass the SAME input variables to the encoders -for the algorithms you want to analyze. -Also notice that the adversarial input generator and the two encoders need to use the same solver instance. - -To see examples of this workflow, we highly recommend looking at the test cases in `MetaOptimize.Test`. - -## Citations -```bibtex -@inproceedings{metaopt, - author = {Namyar, Pooria and Arzani, Behnaz and Beckett, Ryan and Segarra, Santiago and Raj, Himanshu and Krishnaswamy, Umesh and Govindan, Ramesh and Kandula, Srikanth}, - title = {{F}inding {A}dversarial {I}nputs for {H}euristics using - {M}ulti-level {O}ptimization}, - booktitle = {21st USENIX Symposium on Networked Systems Design and - Implementation (NSDI 24)}, - year = {2024}, -} -``` - -```bibtex -@inproceedings{10.1145/3563766.3564102, - author = {Namyar, Pooria and Arzani, Behnaz and Beckett, Ryan and Segarra, Santiago and Raj, Himanshu and Kandula, Srikanth}, - title = {Minding the gap between fast heuristics and their optimal counterparts}, - booktitle = {Proceedings of the 21st ACM Workshop on Hot Topics in Networks}, - year = {2022} -} -``` - -## Who do I contact if I have questions -- Behnaz Arzani (bearzani@microsoft.com) -- Pooria Namyar (namyar@usc.edu) \ No newline at end of file diff --git a/MetaOptimize/MetaOptimize/SolverGurobi.cs b/MetaOptimize/SolverGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize/SolverGurobi.cs rename to MetaOptimize/SolverGurobi.cs diff --git a/MetaOptimize/MetaOptimize/SolverZen.cs b/MetaOptimize/SolverZen.cs similarity index 100% rename from MetaOptimize/MetaOptimize/SolverZen.cs rename to MetaOptimize/SolverZen.cs diff --git a/MetaOptimize/MetaOptimize/Term.cs b/MetaOptimize/Term.cs similarity index 100% rename from MetaOptimize/MetaOptimize/Term.cs rename to MetaOptimize/Term.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/AdversarialInputSimplifier.cs b/MetaOptimize/TrafficEngineering/AdversarialInputSimplifier.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/AdversarialInputSimplifier.cs rename to MetaOptimize/TrafficEngineering/AdversarialInputSimplifier.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningEncoder.cs b/MetaOptimize/TrafficEngineering/DemandPinningEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningEncoder.cs rename to MetaOptimize/TrafficEngineering/DemandPinningEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningLinkNegativeException.cs b/MetaOptimize/TrafficEngineering/DemandPinningLinkNegativeException.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningLinkNegativeException.cs rename to MetaOptimize/TrafficEngineering/DemandPinningLinkNegativeException.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningQuantizedEncoder.cs b/MetaOptimize/TrafficEngineering/DemandPinningQuantizedEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningQuantizedEncoder.cs rename to MetaOptimize/TrafficEngineering/DemandPinningQuantizedEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/DirectDemandPinningEncoder.cs b/MetaOptimize/TrafficEngineering/DirectDemandPinningEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/DirectDemandPinningEncoder.cs rename to MetaOptimize/TrafficEngineering/DirectDemandPinningEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/ExpectedPopEncoder.cs b/MetaOptimize/TrafficEngineering/ExpectedPopEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/ExpectedPopEncoder.cs rename to MetaOptimize/TrafficEngineering/ExpectedPopEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/ModifiedDemandPinningQuantizedEncoder.cs b/MetaOptimize/TrafficEngineering/ModifiedDemandPinningQuantizedEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/ModifiedDemandPinningQuantizedEncoder.cs rename to MetaOptimize/TrafficEngineering/ModifiedDemandPinningQuantizedEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/PathType.cs b/MetaOptimize/TrafficEngineering/PathType.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/PathType.cs rename to MetaOptimize/TrafficEngineering/PathType.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/PopEncoder.cs b/MetaOptimize/TrafficEngineering/PopEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/PopEncoder.cs rename to MetaOptimize/TrafficEngineering/PopEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TEAdversarialInputGenerator.cs b/MetaOptimize/TrafficEngineering/TEAdversarialInputGenerator.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TEAdversarialInputGenerator.cs rename to MetaOptimize/TrafficEngineering/TEAdversarialInputGenerator.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TECombineHeuristicsEncoder.cs b/MetaOptimize/TrafficEngineering/TECombineHeuristicsEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TECombineHeuristicsEncoder.cs rename to MetaOptimize/TrafficEngineering/TECombineHeuristicsEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TEMaxFlowOptimalEncoder.cs b/MetaOptimize/TrafficEngineering/TEMaxFlowOptimalEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TEMaxFlowOptimalEncoder.cs rename to MetaOptimize/TrafficEngineering/TEMaxFlowOptimalEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TEMaxFlowOptimizationSolution.cs b/MetaOptimize/TrafficEngineering/TEMaxFlowOptimizationSolution.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TEMaxFlowOptimizationSolution.cs rename to MetaOptimize/TrafficEngineering/TEMaxFlowOptimizationSolution.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TEOptimizationEncoding.cs b/MetaOptimize/TrafficEngineering/TEOptimizationEncoding.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TEOptimizationEncoding.cs rename to MetaOptimize/TrafficEngineering/TEOptimizationEncoding.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TEOptimizationSolution.cs b/MetaOptimize/TrafficEngineering/TEOptimizationSolution.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TEOptimizationSolution.cs rename to MetaOptimize/TrafficEngineering/TEOptimizationSolution.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/Topology.cs b/MetaOptimize/TrafficEngineering/Topology.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/Topology.cs rename to MetaOptimize/TrafficEngineering/Topology.cs diff --git a/MetaOptimize/MetaOptimize/VariableType.cs b/MetaOptimize/VariableType.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VariableType.cs rename to MetaOptimize/VariableType.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/Bins.cs b/MetaOptimize/VectorBinPacking/Bins.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/Bins.cs rename to MetaOptimize/VectorBinPacking/Bins.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/FFDItemCentricEncoder.cs b/MetaOptimize/VectorBinPacking/FFDItemCentricEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/FFDItemCentricEncoder.cs rename to MetaOptimize/VectorBinPacking/FFDItemCentricEncoder.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/FFDItemCentricEncoderV2.cs b/MetaOptimize/VectorBinPacking/FFDItemCentricEncoderV2.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/FFDItemCentricEncoderV2.cs rename to MetaOptimize/VectorBinPacking/FFDItemCentricEncoderV2.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/FFDMethod.cs b/MetaOptimize/VectorBinPacking/FFDMethod.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/FFDMethod.cs rename to MetaOptimize/VectorBinPacking/FFDMethod.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/VBPAdversarialInputGenerator.cs b/MetaOptimize/VectorBinPacking/VBPAdversarialInputGenerator.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/VBPAdversarialInputGenerator.cs rename to MetaOptimize/VectorBinPacking/VBPAdversarialInputGenerator.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimalEncoder.cs b/MetaOptimize/VectorBinPacking/VBPOptimalEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimalEncoder.cs rename to MetaOptimize/VectorBinPacking/VBPOptimalEncoder.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimizationEncoding.cs b/MetaOptimize/VectorBinPacking/VBPOptimizationEncoding.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimizationEncoding.cs rename to MetaOptimize/VectorBinPacking/VBPOptimizationEncoding.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimizationSolution.cs b/MetaOptimize/VectorBinPacking/VBPOptimizationSolution.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimizationSolution.cs rename to MetaOptimize/VectorBinPacking/VBPOptimizationSolution.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/new/FFDItemCentricEncoderNew.cs b/MetaOptimize/VectorBinPacking/new/FFDItemCentricEncoderNew.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/new/FFDItemCentricEncoderNew.cs rename to MetaOptimize/VectorBinPacking/new/FFDItemCentricEncoderNew.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/new/VBPAdversarialInputGeneratorNew.cs b/MetaOptimize/VectorBinPacking/new/VBPAdversarialInputGeneratorNew.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/new/VBPAdversarialInputGeneratorNew.cs rename to MetaOptimize/VectorBinPacking/new/VBPAdversarialInputGeneratorNew.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/new/VBPOptimalEncoderNew.cs b/MetaOptimize/VectorBinPacking/new/VBPOptimalEncoderNew.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/new/VBPOptimalEncoderNew.cs rename to MetaOptimize/VectorBinPacking/new/VBPOptimalEncoderNew.cs diff --git a/MetaOptimize/build.yml b/MetaOptimize/build.yml deleted file mode 100644 index 64fe5897..00000000 --- a/MetaOptimize/build.yml +++ /dev/null @@ -1,26 +0,0 @@ -trigger: -- master -pool: - vmImage: 'windows-latest' - -steps: -- task: CredScan@2 - inputs: - toolMajorVersion: 'V3' - -- task: Semmle@1 - inputs: - sourceCodeDirectory: '$(Build.SourcesDirectory)//MetaOptimize' - language: 'csharp' - querySuite: 'Recommended' - timeout: '1800' - ram: '16384' - addProjectDirToScanningExclusionList: true - -schedules: -- cron: "0 0 * * 1" - displayName: Weekly build - branches: - include: - - master - always: true diff --git a/MetaOptimize/MetaOptimize/utils.cs b/MetaOptimize/utils.cs similarity index 100% rename from MetaOptimize/MetaOptimize/utils.cs rename to MetaOptimize/utils.cs diff --git a/README.md b/README.md index 5cd7cecf..9ec1c751 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,87 @@ -# Project +# MetaOpt: Examining, explaining, and improving heuristic performance -> This repo has been populated by an initial template to help get you started. Please -> make sure to update the content to build a great experience for community-building. +`MetaOpt` is the first general-purpose and scalable tool that enables users to analyze a broad class of heuristics through easy-to-use abstractions that apply to a broad range of practical heuristics. For more information, checkout [MetaOpt's project webpage](https://www.microsoft.com/en-us/research/project/finding-adversarial-inputs-for-heuristics/overview/) and our NSDI'24 paper ([Finding Adversarial Inputs for Heuristics using Multi-level Optimization](https://arxiv.org/abs/2311.12779)). -As the maintainer of this project, please make a few updates: -- Improving this README.MD file to provide a great experience -- Updating SUPPORT.MD with content about this project's support experience -- Understanding the security reporting process in SECURITY.MD -- Remove this section from the README +## Code Structure +``` +├── MetaOptimize # Implementation of all the main components of MetaOpt. +| | # (helper functions, solver APIs, rewrites, etc.) +| | +| ├── TrafficEngineering # implementation of TE encoders (OPT, DP, and POP) +| | # and TE adversarial generator. +| | +| ├── VectorBinPacking # implementation of VBP encoders (OPT and variants of FF) +| | # and VBP adversarial generator. +| | +| └── PIFO # implementation of PIFO, SP-PIFO, and AIFO encoders. +| +| +├── MetaOptimize.Cli # examples and scripts to reproduce the results in +| # our NSDI24 and HotNet22 papers. +| +└── MetaOptimize.Test # testcases for MetaOpt. +``` + +## Getting Started + +We provide multiple example Main functions that you can try in `MetaOptimize.Cli/Program.cs` for different heuristics in vector bin packing, packet scheduling, and traffic engineering. + +We also provide many unit-tests that can serve as a starting point in `MetaOptimize.Test`. + +You can use MetaOpt either with the [Gurobi optimization solver](https://www.gurobi.com/documentation/current/examples/cs_examples.html) +or with [Zen](https://dl.acm.org/doi/10.1145/3422604.3425930). +Make sure you install both solvers and configure the proper Gurobi license. If you are in academia, you can follow the instructions on Gurobi's website to obtain a license. + +## Analyzing heuristics using MetaOpt + +

+ +

+ + +If you would like to analyze a heuristic that we have not modeled as part of MetaOpt yet, here are the steps to follow: + +1- Model your heuristic as either a convex optimization problem or a feasibility problem which our solvers can support. +How you model the problem is important and can significantly influence MetaOpt's ability to scale (and also whether Gurobi can run into +numerical issues). If you run into trouble with this step, feel free to contact the MetaOpt authors at: namyar@usc.edu and bearzani@microsoft.com. + +2- You need to write an `Encoder` library for both the heuristic you want to analyze and the optimal form of the problem (or if you want to compare two heuristics, for the other heuristics). +We strongly recommend looking at the Traffic Engineering, VBP, and packet scheduling Encoders we have provided as part of the MetaOpt code-base for examples. +Encoders must meet the specifications in the `IEncoder.cs` library. +If your problem is a convex optimization problem (and NOT a feasibility problem), you also need to pick the type of re-write you want to use (`KKT` or `quantized primal dual`). +We recommend the quantized primal dual approach to achieve better scalability. + +To use the quantized primal dual approach, you also need to specify the quantization levels. + +3- Once you have both of the encoders in place, you have to write an adversarial input generator. See the `TE` and `VBP` folders for examples. +To solve the MetaOpt problem, you need to create the `input variables` in the adversarial input generator and pass the SAME input variables to the encoders +for the algorithms you want to analyze. +Also notice that the adversarial input generator and the two encoders need to use the same solver instance. + +To see examples of this workflow, we highly recommend looking at the test cases in `MetaOptimize.Test`. + +## Citations +Refer to the following two papers for more information: +```bibtex +@inproceedings{metaopt, + author = {Namyar, Pooria and Arzani, Behnaz and Beckett, Ryan and Segarra, Santiago and Raj, Himanshu and Krishnaswamy, Umesh and Govindan, Ramesh and Kandula, Srikanth}, + title = {{F}inding {A}dversarial {I}nputs for {H}euristics using + {M}ulti-level {O}ptimization}, + booktitle = {21st USENIX Symposium on Networked Systems Design and + Implementation (NSDI 24)}, + year = {2024}, +} +``` + +```bibtex +@inproceedings{10.1145/3563766.3564102, + author = {Namyar, Pooria and Arzani, Behnaz and Beckett, Ryan and Segarra, Santiago and Raj, Himanshu and Kandula, Srikanth}, + title = {Minding the gap between fast heuristics and their optimal counterparts}, + booktitle = {Proceedings of the 21st ACM Workshop on Hot Topics in Networks}, + year = {2022} +} +``` ## Contributing @@ -31,3 +104,8 @@ trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies. + +## Contacts +You can reach out to us with any questions: +- Behnaz Arzani (bearzani@microsoft.com) +- Pooria Namyar (namyar@usc.edu) diff --git a/MetaOptimize/Topologies/Cogentco.json b/Topologies/Cogentco.json similarity index 100% rename from MetaOptimize/Topologies/Cogentco.json rename to Topologies/Cogentco.json diff --git a/MetaOptimize/Topologies/GtsCe.json b/Topologies/GtsCe.json similarity index 100% rename from MetaOptimize/Topologies/GtsCe.json rename to Topologies/GtsCe.json diff --git a/MetaOptimize/Topologies/Kdl.json b/Topologies/Kdl.json similarity index 100% rename from MetaOptimize/Topologies/Kdl.json rename to Topologies/Kdl.json diff --git a/MetaOptimize/Topologies/Uninet2010.json b/Topologies/Uninet2010.json similarity index 100% rename from MetaOptimize/Topologies/Uninet2010.json rename to Topologies/Uninet2010.json diff --git a/MetaOptimize/Topologies/abilene.json b/Topologies/abilene.json similarity index 100% rename from MetaOptimize/Topologies/abilene.json rename to Topologies/abilene.json diff --git a/MetaOptimize/Topologies/analyze_topo.py b/Topologies/analyze_topo.py similarity index 100% rename from MetaOptimize/Topologies/analyze_topo.py rename to Topologies/analyze_topo.py diff --git a/MetaOptimize/Topologies/b4-teavar.json b/Topologies/b4-teavar.json similarity index 100% rename from MetaOptimize/Topologies/b4-teavar.json rename to Topologies/b4-teavar.json diff --git a/MetaOptimize/Topologies/bottleneck-dumbell.json b/Topologies/bottleneck-dumbell.json similarity index 100% rename from MetaOptimize/Topologies/bottleneck-dumbell.json rename to Topologies/bottleneck-dumbell.json diff --git a/MetaOptimize/Topologies/bottleneck.json b/Topologies/bottleneck.json similarity index 100% rename from MetaOptimize/Topologies/bottleneck.json rename to Topologies/bottleneck.json diff --git a/MetaOptimize/Topologies/dumbell-bottleneck.json b/Topologies/dumbell-bottleneck.json similarity index 100% rename from MetaOptimize/Topologies/dumbell-bottleneck.json rename to Topologies/dumbell-bottleneck.json diff --git a/MetaOptimize/Topologies/ext/modularity/.gitignore b/Topologies/ext/modularity/.gitignore similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/.gitignore rename to Topologies/ext/modularity/.gitignore diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/.gitignore b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/.gitignore similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/.gitignore rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/.gitignore diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/Makefile b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/Makefile similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/Makefile rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/Makefile diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/fastcommunity_w_mh.cc b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/fastcommunity_w_mh.cc similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/fastcommunity_w_mh.cc rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/fastcommunity_w_mh.cc diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/maxheap.h b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/maxheap.h similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/maxheap.h rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/maxheap.h diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1-fc_test1.wpairs b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1-fc_test1.wpairs similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1-fc_test1.wpairs rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1-fc_test1.wpairs diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1.wpairs b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1.wpairs similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1.wpairs rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1.wpairs diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2-fc_t2.wpairs b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2-fc_t2.wpairs similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2-fc_t2.wpairs rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2-fc_t2.wpairs diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2.wpairs b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2.wpairs similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2.wpairs rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2.wpairs diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/vektor.h b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/vektor.h similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/vektor.h rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/vektor.h diff --git a/MetaOptimize/Topologies/feasible1.json b/Topologies/feasible1.json similarity index 100% rename from MetaOptimize/Topologies/feasible1.json rename to Topologies/feasible1.json diff --git a/MetaOptimize/Topologies/networks.py b/Topologies/networks.py similarity index 100% rename from MetaOptimize/Topologies/networks.py rename to Topologies/networks.py diff --git a/MetaOptimize/Topologies/outputs/paths/Cogentco_2sp.json b/Topologies/outputs/paths/Cogentco_2sp.json similarity index 100% rename from MetaOptimize/Topologies/outputs/paths/Cogentco_2sp.json rename to Topologies/outputs/paths/Cogentco_2sp.json diff --git a/MetaOptimize/Topologies/outputs/paths/b4-teavar_2.json b/Topologies/outputs/paths/b4-teavar_2.json similarity index 100% rename from MetaOptimize/Topologies/outputs/paths/b4-teavar_2.json rename to Topologies/outputs/paths/b4-teavar_2.json diff --git a/MetaOptimize/Topologies/parse_and_convert_graphml.py b/Topologies/parse_and_convert_graphml.py similarity index 100% rename from MetaOptimize/Topologies/parse_and_convert_graphml.py rename to Topologies/parse_and_convert_graphml.py diff --git a/MetaOptimize/Topologies/partition_network.py b/Topologies/partition_network.py similarity index 100% rename from MetaOptimize/Topologies/partition_network.py rename to Topologies/partition_network.py diff --git a/MetaOptimize/Topologies/partitioning/abstract_partitioning_method.py b/Topologies/partitioning/abstract_partitioning_method.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/abstract_partitioning_method.py rename to Topologies/partitioning/abstract_partitioning_method.py diff --git a/MetaOptimize/Topologies/partitioning/fm_partitioning.py b/Topologies/partitioning/fm_partitioning.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/fm_partitioning.py rename to Topologies/partitioning/fm_partitioning.py diff --git a/MetaOptimize/Topologies/partitioning/leader_election.py b/Topologies/partitioning/leader_election.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/leader_election.py rename to Topologies/partitioning/leader_election.py diff --git a/MetaOptimize/Topologies/partitioning/leader_election_uniform.py b/Topologies/partitioning/leader_election_uniform.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/leader_election_uniform.py rename to Topologies/partitioning/leader_election_uniform.py diff --git a/MetaOptimize/Topologies/partitioning/spectral_clustering.py b/Topologies/partitioning/spectral_clustering.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/spectral_clustering.py rename to Topologies/partitioning/spectral_clustering.py diff --git a/MetaOptimize/Topologies/partitioning/utils.py b/Topologies/partitioning/utils.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/utils.py rename to Topologies/partitioning/utils.py diff --git a/MetaOptimize/Topologies/ring_20.json b/Topologies/ring_20.json similarity index 100% rename from MetaOptimize/Topologies/ring_20.json rename to Topologies/ring_20.json diff --git a/MetaOptimize/Topologies/ring_200.json b/Topologies/ring_200.json similarity index 100% rename from MetaOptimize/Topologies/ring_200.json rename to Topologies/ring_200.json diff --git a/MetaOptimize/Topologies/ring_400.json b/Topologies/ring_400.json similarity index 100% rename from MetaOptimize/Topologies/ring_400.json rename to Topologies/ring_400.json diff --git a/MetaOptimize/Topologies/swan.json b/Topologies/swan.json similarity index 100% rename from MetaOptimize/Topologies/swan.json rename to Topologies/swan.json diff --git a/MetaOptimize/Topologies/toy-network-2.json b/Topologies/toy-network-2.json similarity index 100% rename from MetaOptimize/Topologies/toy-network-2.json rename to Topologies/toy-network-2.json diff --git a/MetaOptimize/Topologies/toy-network-3.json b/Topologies/toy-network-3.json similarity index 100% rename from MetaOptimize/Topologies/toy-network-3.json rename to Topologies/toy-network-3.json diff --git a/MetaOptimize/Topologies/toy-network.json b/Topologies/toy-network.json similarity index 100% rename from MetaOptimize/Topologies/toy-network.json rename to Topologies/toy-network.json diff --git a/MetaOptimize/Topologies/two-srcs.json b/Topologies/two-srcs.json similarity index 100% rename from MetaOptimize/Topologies/two-srcs.json rename to Topologies/two-srcs.json diff --git a/MetaOptimize/Topologies/verify_demand.py b/Topologies/verify_demand.py similarity index 100% rename from MetaOptimize/Topologies/verify_demand.py rename to Topologies/verify_demand.py diff --git a/MetaOptimize/metaopt_workflow.png b/figures/metaopt_workflow.png similarity index 100% rename from MetaOptimize/metaopt_workflow.png rename to figures/metaopt_workflow.png diff --git a/MetaOptimize/parsers/demand_pinning_num_paths_sweep.ipynb b/parsers/demand_pinning_num_paths_sweep.ipynb similarity index 100% rename from MetaOptimize/parsers/demand_pinning_num_paths_sweep.ipynb rename to parsers/demand_pinning_num_paths_sweep.ipynb diff --git a/MetaOptimize/parsers/demand_pinning_threshold_sweep.ipynb b/parsers/demand_pinning_threshold_sweep.ipynb similarity index 100% rename from MetaOptimize/parsers/demand_pinning_threshold_sweep.ipynb rename to parsers/demand_pinning_threshold_sweep.ipynb diff --git a/MetaOptimize/parsers/demand_pinning_topology_sweep.ipynb b/parsers/demand_pinning_topology_sweep.ipynb similarity index 100% rename from MetaOptimize/parsers/demand_pinning_topology_sweep.ipynb rename to parsers/demand_pinning_topology_sweep.ipynb diff --git a/MetaOptimize/parsers/expected_pop.ipynb b/parsers/expected_pop.ipynb similarity index 100% rename from MetaOptimize/parsers/expected_pop.ipynb rename to parsers/expected_pop.ipynb diff --git a/MetaOptimize/parsers/gap_vs_time.ipynb b/parsers/gap_vs_time.ipynb similarity index 100% rename from MetaOptimize/parsers/gap_vs_time.ipynb rename to parsers/gap_vs_time.ipynb diff --git a/MetaOptimize/parsers/pop_varying_paths_partitions.ipynb b/parsers/pop_varying_paths_partitions.ipynb similarity index 100% rename from MetaOptimize/parsers/pop_varying_paths_partitions.ipynb rename to parsers/pop_varying_paths_partitions.ipynb diff --git a/MetaOptimize/parsers/problem_topo_latency.ipynb b/parsers/problem_topo_latency.ipynb similarity index 100% rename from MetaOptimize/parsers/problem_topo_latency.ipynb rename to parsers/problem_topo_latency.ipynb From eae2c0a98d456cde1d481f532bf57eaa4e523561 Mon Sep 17 00:00:00 2001 From: PooriaNamyar Date: Tue, 2 Apr 2024 08:39:36 +0000 Subject: [PATCH 2/7] restructuring the code --- .../AnalysisDictionary.xml | 0 .../.stylecop => .stylecop}/StyleCop.props | 0 .../.stylecop => .stylecop}/stylecop.json | 0 .../.stylecop => .stylecop}/stylecop.ruleset | 0 .../CliOptions.cs | 0 .../MachineStat.cs | 0 .../MetaOptimize.Cli.csproj | 0 .../Parser.cs | 0 .../cliUtils.cs | 0 .../hotnetsExperiments.cs | 0 .../nsdiExperiments.cs | 0 .../DemandPinningGurobiBinary.cs | 0 .../DemandPinningGurobiMin.cs | 0 .../DemandPinningTestZen.cs | 0 .../DemandPinningTests.cs | 0 .../DemandPinningTestsGurobi.cs | 0 .../DemandPinningTestsGurobiSoS.cs | 0 .../KKtOptimizationTestGurobiBinary.cs | 0 .../KKtOptimizationTestGurobiMin.cs | 0 .../KktOptimizationTests.cs | 0 .../KktOptimizationTestsGurobi.cs | 0 .../KktOptimizationTestsGurobiSOS.cs | 0 .../KktOptimizationTestsZen.cs | 1 + .../MetaOptimize.Test.csproj | 0 .../OptimalEncodingGurobiMin.cs | 0 .../OptimalEncodingTests.cs | 0 .../OptimalEncodingTestsBinary.cs | 0 .../OptimalEncodingTestsGurobi.cs | 0 .../OptimalEncodingTestsGurobiSOS.cs | 0 .../OptimalEncodingTestsZen.cs | 2 + .../OptimalityGapTestGurobiMin.cs | 0 .../OptimalityGapTests.cs | 0 .../OptimalityGapTestsGurobi.cs | 0 .../OptimalityGapTestsGurobiBinary.cs | 0 .../OptimalityGapTestsGurobiSOS.cs | 0 .../OptimalityGapTestsZen.cs | 1 + .../PopEncodingTests.cs | 0 .../PopEncodingTestsGurobi.cs | 0 .../PopEncodingTestsGurobiBinary.cs | 0 .../PopEncodingTestsGurobiMin.cs | 0 .../PopEncodingTestsGurobiSOS.cs | 0 .../PopEncodingTestsZen.cs | 1 + .../TopologyTests.cs | 0 .../MetaOptimize.sln => MetaOptimize.sln | 0 MetaOptimize/.gitignore | 354 ---------- .../AdversarialGenMethod.cs | 0 .../{MetaOptimize => }/EncodingUtils.cs | 0 MetaOptimize/{MetaOptimize => }/Exceptions.cs | 0 .../{MetaOptimize => }/GenericDemandList.cs | 0 .../{MetaOptimize => }/GurobiBinary.cs | 0 .../{MetaOptimize => }/GurobiCallback.cs | 0 .../{MetaOptimize => }/GurobiEnvironment.cs | 0 MetaOptimize/{MetaOptimize => }/GurobiMin.cs | 0 MetaOptimize/{MetaOptimize => }/GurobiSOS.cs | 0 .../GurobiStoreProgressCallback.cs | 0 .../GurobiTerminationCallback.cs | 0 .../GurobiTimeoutCallback.cs | 0 .../{MetaOptimize => }/IDemandList.cs | 0 MetaOptimize/{MetaOptimize => }/IEncoder.cs | 0 .../{MetaOptimize => }/InnerEncodingMethod.cs | 0 .../KktOptimizationGenerator.cs | 0 .../{MetaOptimize => }/McCormickRelaxation.cs | 0 MetaOptimize/MetaOptimize.Cli/Program.cs | 608 ------------------ .../{MetaOptimize => }/MetaOptimize.csproj | 0 MetaOptimize/MetaOptimize/ISolver.cs | 258 -------- .../OptimizationEncoding.cs | 0 .../OptimizationSolution.cs | 0 .../PIFO/AIFOAvgDelayEncoder.cs | 0 .../{MetaOptimize => }/PIFO/AIFOEncoder.cs | 0 .../PIFO/ModifiedSPPIFOAvgDelayEncoder.cs | 0 .../PIFO/ModifiedSPPIFOEncoder.cs | 0 .../PIFO/PIFOAdversarialInputGenerator.cs | 0 .../PIFO/PIFOAvgDelayOptimalEncoder.cs | 0 .../PIFO/PIFOOptimalEncoder.cs | 0 .../PIFO/PIFOOptimizationEncoding.cs | 0 .../PIFO/PIFOOptimizationSolution.cs | 0 .../{MetaOptimize => }/PIFO/PIFOUtils.cs | 0 .../PIFO/PIFOWithDropAvgDelayEncoder.cs | 0 .../PIFO/PIFOWithDropEncoder.cs | 0 .../PIFO/SPPIFOAvgDelayEncoder.cs | 0 .../{MetaOptimize => }/PIFO/SPPIFOEncoder.cs | 0 .../PIFO/SPPIFOWithDropAvgDelayEncoder.cs | 0 .../PIFO/SPPIFOWithDropEncoder.cs | 0 .../{MetaOptimize => }/PairwiseDemandList.cs | 0 .../{MetaOptimize => }/PathComparer.cs | 0 MetaOptimize/{MetaOptimize => }/Polynomial.cs | 0 .../PrimalDualOptimizationGenerator.cs | 0 MetaOptimize/README.md | 87 --- .../{MetaOptimize => }/SolverGurobi.cs | 0 MetaOptimize/{MetaOptimize => }/SolverZen.cs | 0 MetaOptimize/{MetaOptimize => }/Term.cs | 0 .../AdversarialInputSimplifier.cs | 0 .../DemandPinningEncoder.cs | 0 .../DemandPinningLinkNegativeException.cs | 0 .../DemandPinningQuantizedEncoder.cs | 0 .../DirectDemandPinningEncoder.cs | 0 .../TrafficEngineering/ExpectedPopEncoder.cs | 0 .../ModifiedDemandPinningQuantizedEncoder.cs | 0 .../TrafficEngineering/PathType.cs | 0 .../TrafficEngineering/PopEncoder.cs | 0 .../TEAdversarialInputGenerator.cs | 0 .../TECombineHeuristicsEncoder.cs | 0 .../TEMaxFlowOptimalEncoder.cs | 0 .../TEMaxFlowOptimizationSolution.cs | 0 .../TEOptimizationEncoding.cs | 0 .../TEOptimizationSolution.cs | 0 .../TrafficEngineering/Topology.cs | 0 .../{MetaOptimize => }/VariableType.cs | 0 .../VectorBinPacking/Bins.cs | 0 .../VectorBinPacking/FFDItemCentricEncoder.cs | 0 .../FFDItemCentricEncoderV2.cs | 0 .../VectorBinPacking/FFDMethod.cs | 0 .../VBPAdversarialInputGenerator.cs | 0 .../VectorBinPacking/VBPOptimalEncoder.cs | 0 .../VBPOptimizationEncoding.cs | 0 .../VBPOptimizationSolution.cs | 0 .../new/FFDItemCentricEncoderNew.cs | 0 .../new/VBPAdversarialInputGeneratorNew.cs | 0 .../new/VBPOptimalEncoderNew.cs | 0 MetaOptimize/build.yml | 26 - MetaOptimize/{MetaOptimize => }/utils.cs | 0 README.md | 94 ++- .../Topologies => Topologies}/Cogentco.json | 0 .../Topologies => Topologies}/GtsCe.json | 0 .../Topologies => Topologies}/Kdl.json | 0 .../Topologies => Topologies}/Uninet2010.json | 0 .../Topologies => Topologies}/abilene.json | 0 .../Topologies => Topologies}/analyze_topo.py | 0 .../Topologies => Topologies}/b4-teavar.json | 0 .../bottleneck-dumbell.json | 0 .../Topologies => Topologies}/bottleneck.json | 0 .../dumbell-bottleneck.json | 0 .../ext/modularity/.gitignore | 0 .../FastCommunity_w_GPL_v1.0.1/.gitignore | 0 .../FastCommunity_w_GPL_v1.0.1/Makefile | 0 .../fastcommunity_w_mh.cc | 0 .../FastCommunity_w_GPL_v1.0.1/maxheap.h | 0 .../test1-fc_test1.wpairs | 0 .../FastCommunity_w_GPL_v1.0.1/test1.wpairs | 0 .../test2-fc_t2.wpairs | 0 .../FastCommunity_w_GPL_v1.0.1/test2.wpairs | 0 .../FastCommunity_w_GPL_v1.0.1/vektor.h | 0 .../Topologies => Topologies}/feasible1.json | 0 .../Topologies => Topologies}/networks.py | 0 .../outputs/paths/Cogentco_2sp.json | 0 .../outputs/paths/b4-teavar_2.json | 0 .../parse_and_convert_graphml.py | 0 .../partition_network.py | 0 .../abstract_partitioning_method.py | 0 .../partitioning/fm_partitioning.py | 0 .../partitioning/leader_election.py | 0 .../partitioning/leader_election_uniform.py | 0 .../partitioning/spectral_clustering.py | 0 .../partitioning/utils.py | 0 .../Topologies => Topologies}/ring_20.json | 0 .../Topologies => Topologies}/ring_200.json | 0 .../Topologies => Topologies}/ring_400.json | 0 .../Topologies => Topologies}/swan.json | 0 .../toy-network-2.json | 0 .../toy-network-3.json | 0 .../toy-network.json | 0 .../Topologies => Topologies}/two-srcs.json | 0 .../verify_demand.py | 0 .../metaopt_workflow.png | Bin .../demand_pinning_num_paths_sweep.ipynb | 0 .../demand_pinning_threshold_sweep.ipynb | 0 .../demand_pinning_topology_sweep.ipynb | 0 .../parsers => parsers}/expected_pop.ipynb | 0 .../parsers => parsers}/gap_vs_time.ipynb | 0 .../pop_varying_paths_partitions.ipynb | 0 .../problem_topo_latency.ipynb | 0 171 files changed, 91 insertions(+), 1341 deletions(-) rename {MetaOptimize/.stylecop => .stylecop}/AnalysisDictionary.xml (100%) rename {MetaOptimize/.stylecop => .stylecop}/StyleCop.props (100%) rename {MetaOptimize/.stylecop => .stylecop}/stylecop.json (100%) rename {MetaOptimize/.stylecop => .stylecop}/stylecop.ruleset (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/CliOptions.cs (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/MachineStat.cs (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/MetaOptimize.Cli.csproj (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/Parser.cs (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/cliUtils.cs (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/hotnetsExperiments.cs (100%) rename {MetaOptimize/MetaOptimize.Cli => MetaOptimize.Cli}/nsdiExperiments.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningGurobiBinary.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningGurobiMin.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningTestZen.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningTests.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningTestsGurobi.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/DemandPinningTestsGurobiSoS.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KKtOptimizationTestGurobiBinary.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KKtOptimizationTestGurobiMin.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KktOptimizationTests.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KktOptimizationTestsGurobi.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KktOptimizationTestsGurobiSOS.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/KktOptimizationTestsZen.cs (98%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/MetaOptimize.Test.csproj (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingGurobiMin.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingTests.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingTestsBinary.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingTestsGurobi.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingTestsGurobiSOS.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalEncodingTestsZen.cs (95%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTestGurobiMin.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTests.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTestsGurobi.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTestsGurobiBinary.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTestsGurobiSOS.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/OptimalityGapTestsZen.cs (98%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTests.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTestsGurobi.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTestsGurobiBinary.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTestsGurobiMin.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTestsGurobiSOS.cs (100%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/PopEncodingTestsZen.cs (98%) rename {MetaOptimize/MetaOptimize.Test => MetaOptimize.Test}/TopologyTests.cs (100%) rename MetaOptimize/MetaOptimize.sln => MetaOptimize.sln (100%) delete mode 100644 MetaOptimize/.gitignore rename MetaOptimize/{MetaOptimize => }/AdversarialGenMethod.cs (100%) rename MetaOptimize/{MetaOptimize => }/EncodingUtils.cs (100%) rename MetaOptimize/{MetaOptimize => }/Exceptions.cs (100%) rename MetaOptimize/{MetaOptimize => }/GenericDemandList.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiBinary.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiCallback.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiEnvironment.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiMin.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiSOS.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiStoreProgressCallback.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiTerminationCallback.cs (100%) rename MetaOptimize/{MetaOptimize => }/GurobiTimeoutCallback.cs (100%) rename MetaOptimize/{MetaOptimize => }/IDemandList.cs (100%) rename MetaOptimize/{MetaOptimize => }/IEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/InnerEncodingMethod.cs (100%) rename MetaOptimize/{MetaOptimize => }/KktOptimizationGenerator.cs (100%) rename MetaOptimize/{MetaOptimize => }/McCormickRelaxation.cs (100%) delete mode 100644 MetaOptimize/MetaOptimize.Cli/Program.cs rename MetaOptimize/{MetaOptimize => }/MetaOptimize.csproj (100%) delete mode 100644 MetaOptimize/MetaOptimize/ISolver.cs rename MetaOptimize/{MetaOptimize => }/OptimizationEncoding.cs (100%) rename MetaOptimize/{MetaOptimize => }/OptimizationSolution.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/AIFOAvgDelayEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/AIFOEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/ModifiedSPPIFOAvgDelayEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/ModifiedSPPIFOEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOAdversarialInputGenerator.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOAvgDelayOptimalEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOOptimalEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOOptimizationEncoding.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOOptimizationSolution.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOUtils.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOWithDropAvgDelayEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/PIFOWithDropEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/SPPIFOAvgDelayEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/SPPIFOEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/SPPIFOWithDropAvgDelayEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PIFO/SPPIFOWithDropEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/PairwiseDemandList.cs (100%) rename MetaOptimize/{MetaOptimize => }/PathComparer.cs (100%) rename MetaOptimize/{MetaOptimize => }/Polynomial.cs (100%) rename MetaOptimize/{MetaOptimize => }/PrimalDualOptimizationGenerator.cs (100%) delete mode 100644 MetaOptimize/README.md rename MetaOptimize/{MetaOptimize => }/SolverGurobi.cs (100%) rename MetaOptimize/{MetaOptimize => }/SolverZen.cs (100%) rename MetaOptimize/{MetaOptimize => }/Term.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/AdversarialInputSimplifier.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/DemandPinningEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/DemandPinningLinkNegativeException.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/DemandPinningQuantizedEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/DirectDemandPinningEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/ExpectedPopEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/ModifiedDemandPinningQuantizedEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/PathType.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/PopEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TEAdversarialInputGenerator.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TECombineHeuristicsEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TEMaxFlowOptimalEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TEMaxFlowOptimizationSolution.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TEOptimizationEncoding.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/TEOptimizationSolution.cs (100%) rename MetaOptimize/{MetaOptimize => }/TrafficEngineering/Topology.cs (100%) rename MetaOptimize/{MetaOptimize => }/VariableType.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/Bins.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/FFDItemCentricEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/FFDItemCentricEncoderV2.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/FFDMethod.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/VBPAdversarialInputGenerator.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/VBPOptimalEncoder.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/VBPOptimizationEncoding.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/VBPOptimizationSolution.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/new/FFDItemCentricEncoderNew.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/new/VBPAdversarialInputGeneratorNew.cs (100%) rename MetaOptimize/{MetaOptimize => }/VectorBinPacking/new/VBPOptimalEncoderNew.cs (100%) delete mode 100644 MetaOptimize/build.yml rename MetaOptimize/{MetaOptimize => }/utils.cs (100%) rename {MetaOptimize/Topologies => Topologies}/Cogentco.json (100%) rename {MetaOptimize/Topologies => Topologies}/GtsCe.json (100%) rename {MetaOptimize/Topologies => Topologies}/Kdl.json (100%) rename {MetaOptimize/Topologies => Topologies}/Uninet2010.json (100%) rename {MetaOptimize/Topologies => Topologies}/abilene.json (100%) rename {MetaOptimize/Topologies => Topologies}/analyze_topo.py (100%) rename {MetaOptimize/Topologies => Topologies}/b4-teavar.json (100%) rename {MetaOptimize/Topologies => Topologies}/bottleneck-dumbell.json (100%) rename {MetaOptimize/Topologies => Topologies}/bottleneck.json (100%) rename {MetaOptimize/Topologies => Topologies}/dumbell-bottleneck.json (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/.gitignore (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/.gitignore (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/Makefile (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/fastcommunity_w_mh.cc (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/maxheap.h (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1-fc_test1.wpairs (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1.wpairs (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2-fc_t2.wpairs (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2.wpairs (100%) rename {MetaOptimize/Topologies => Topologies}/ext/modularity/FastCommunity_w_GPL_v1.0.1/vektor.h (100%) rename {MetaOptimize/Topologies => Topologies}/feasible1.json (100%) rename {MetaOptimize/Topologies => Topologies}/networks.py (100%) rename {MetaOptimize/Topologies => Topologies}/outputs/paths/Cogentco_2sp.json (100%) rename {MetaOptimize/Topologies => Topologies}/outputs/paths/b4-teavar_2.json (100%) rename {MetaOptimize/Topologies => Topologies}/parse_and_convert_graphml.py (100%) rename {MetaOptimize/Topologies => Topologies}/partition_network.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/abstract_partitioning_method.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/fm_partitioning.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/leader_election.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/leader_election_uniform.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/spectral_clustering.py (100%) rename {MetaOptimize/Topologies => Topologies}/partitioning/utils.py (100%) rename {MetaOptimize/Topologies => Topologies}/ring_20.json (100%) rename {MetaOptimize/Topologies => Topologies}/ring_200.json (100%) rename {MetaOptimize/Topologies => Topologies}/ring_400.json (100%) rename {MetaOptimize/Topologies => Topologies}/swan.json (100%) rename {MetaOptimize/Topologies => Topologies}/toy-network-2.json (100%) rename {MetaOptimize/Topologies => Topologies}/toy-network-3.json (100%) rename {MetaOptimize/Topologies => Topologies}/toy-network.json (100%) rename {MetaOptimize/Topologies => Topologies}/two-srcs.json (100%) rename {MetaOptimize/Topologies => Topologies}/verify_demand.py (100%) rename {MetaOptimize => figures}/metaopt_workflow.png (100%) rename {MetaOptimize/parsers => parsers}/demand_pinning_num_paths_sweep.ipynb (100%) rename {MetaOptimize/parsers => parsers}/demand_pinning_threshold_sweep.ipynb (100%) rename {MetaOptimize/parsers => parsers}/demand_pinning_topology_sweep.ipynb (100%) rename {MetaOptimize/parsers => parsers}/expected_pop.ipynb (100%) rename {MetaOptimize/parsers => parsers}/gap_vs_time.ipynb (100%) rename {MetaOptimize/parsers => parsers}/pop_varying_paths_partitions.ipynb (100%) rename {MetaOptimize/parsers => parsers}/problem_topo_latency.ipynb (100%) diff --git a/MetaOptimize/.stylecop/AnalysisDictionary.xml b/.stylecop/AnalysisDictionary.xml similarity index 100% rename from MetaOptimize/.stylecop/AnalysisDictionary.xml rename to .stylecop/AnalysisDictionary.xml diff --git a/MetaOptimize/.stylecop/StyleCop.props b/.stylecop/StyleCop.props similarity index 100% rename from MetaOptimize/.stylecop/StyleCop.props rename to .stylecop/StyleCop.props diff --git a/MetaOptimize/.stylecop/stylecop.json b/.stylecop/stylecop.json similarity index 100% rename from MetaOptimize/.stylecop/stylecop.json rename to .stylecop/stylecop.json diff --git a/MetaOptimize/.stylecop/stylecop.ruleset b/.stylecop/stylecop.ruleset similarity index 100% rename from MetaOptimize/.stylecop/stylecop.ruleset rename to .stylecop/stylecop.ruleset diff --git a/MetaOptimize/MetaOptimize.Cli/CliOptions.cs b/MetaOptimize.Cli/CliOptions.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/CliOptions.cs rename to MetaOptimize.Cli/CliOptions.cs diff --git a/MetaOptimize/MetaOptimize.Cli/MachineStat.cs b/MetaOptimize.Cli/MachineStat.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/MachineStat.cs rename to MetaOptimize.Cli/MachineStat.cs diff --git a/MetaOptimize/MetaOptimize.Cli/MetaOptimize.Cli.csproj b/MetaOptimize.Cli/MetaOptimize.Cli.csproj similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/MetaOptimize.Cli.csproj rename to MetaOptimize.Cli/MetaOptimize.Cli.csproj diff --git a/MetaOptimize/MetaOptimize.Cli/Parser.cs b/MetaOptimize.Cli/Parser.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/Parser.cs rename to MetaOptimize.Cli/Parser.cs diff --git a/MetaOptimize/MetaOptimize.Cli/cliUtils.cs b/MetaOptimize.Cli/cliUtils.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/cliUtils.cs rename to MetaOptimize.Cli/cliUtils.cs diff --git a/MetaOptimize/MetaOptimize.Cli/hotnetsExperiments.cs b/MetaOptimize.Cli/hotnetsExperiments.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/hotnetsExperiments.cs rename to MetaOptimize.Cli/hotnetsExperiments.cs diff --git a/MetaOptimize/MetaOptimize.Cli/nsdiExperiments.cs b/MetaOptimize.Cli/nsdiExperiments.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Cli/nsdiExperiments.cs rename to MetaOptimize.Cli/nsdiExperiments.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningGurobiBinary.cs b/MetaOptimize.Test/DemandPinningGurobiBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningGurobiBinary.cs rename to MetaOptimize.Test/DemandPinningGurobiBinary.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningGurobiMin.cs b/MetaOptimize.Test/DemandPinningGurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningGurobiMin.cs rename to MetaOptimize.Test/DemandPinningGurobiMin.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningTestZen.cs b/MetaOptimize.Test/DemandPinningTestZen.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningTestZen.cs rename to MetaOptimize.Test/DemandPinningTestZen.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningTests.cs b/MetaOptimize.Test/DemandPinningTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningTests.cs rename to MetaOptimize.Test/DemandPinningTests.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningTestsGurobi.cs b/MetaOptimize.Test/DemandPinningTestsGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningTestsGurobi.cs rename to MetaOptimize.Test/DemandPinningTestsGurobi.cs diff --git a/MetaOptimize/MetaOptimize.Test/DemandPinningTestsGurobiSoS.cs b/MetaOptimize.Test/DemandPinningTestsGurobiSoS.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/DemandPinningTestsGurobiSoS.cs rename to MetaOptimize.Test/DemandPinningTestsGurobiSoS.cs diff --git a/MetaOptimize/MetaOptimize.Test/KKtOptimizationTestGurobiBinary.cs b/MetaOptimize.Test/KKtOptimizationTestGurobiBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/KKtOptimizationTestGurobiBinary.cs rename to MetaOptimize.Test/KKtOptimizationTestGurobiBinary.cs diff --git a/MetaOptimize/MetaOptimize.Test/KKtOptimizationTestGurobiMin.cs b/MetaOptimize.Test/KKtOptimizationTestGurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/KKtOptimizationTestGurobiMin.cs rename to MetaOptimize.Test/KKtOptimizationTestGurobiMin.cs diff --git a/MetaOptimize/MetaOptimize.Test/KktOptimizationTests.cs b/MetaOptimize.Test/KktOptimizationTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/KktOptimizationTests.cs rename to MetaOptimize.Test/KktOptimizationTests.cs diff --git a/MetaOptimize/MetaOptimize.Test/KktOptimizationTestsGurobi.cs b/MetaOptimize.Test/KktOptimizationTestsGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/KktOptimizationTestsGurobi.cs rename to MetaOptimize.Test/KktOptimizationTestsGurobi.cs diff --git a/MetaOptimize/MetaOptimize.Test/KktOptimizationTestsGurobiSOS.cs b/MetaOptimize.Test/KktOptimizationTestsGurobiSOS.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/KktOptimizationTestsGurobiSOS.cs rename to MetaOptimize.Test/KktOptimizationTestsGurobiSOS.cs diff --git a/MetaOptimize/MetaOptimize.Test/KktOptimizationTestsZen.cs b/MetaOptimize.Test/KktOptimizationTestsZen.cs similarity index 98% rename from MetaOptimize/MetaOptimize.Test/KktOptimizationTestsZen.cs rename to MetaOptimize.Test/KktOptimizationTestsZen.cs index a17f2d11..a6f31caf 100644 --- a/MetaOptimize/MetaOptimize.Test/KktOptimizationTestsZen.cs +++ b/MetaOptimize.Test/KktOptimizationTestsZen.cs @@ -12,6 +12,7 @@ namespace MetaOptimize.Test /// Some basic optimization tests. ///
[TestClass] + [Ignore] public class KktOptimizationTestsZen : KktOptimizationTests, ZenSolution> { /// diff --git a/MetaOptimize/MetaOptimize.Test/MetaOptimize.Test.csproj b/MetaOptimize.Test/MetaOptimize.Test.csproj similarity index 100% rename from MetaOptimize/MetaOptimize.Test/MetaOptimize.Test.csproj rename to MetaOptimize.Test/MetaOptimize.Test.csproj diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingGurobiMin.cs b/MetaOptimize.Test/OptimalEncodingGurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingGurobiMin.cs rename to MetaOptimize.Test/OptimalEncodingGurobiMin.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTests.cs b/MetaOptimize.Test/OptimalEncodingTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingTests.cs rename to MetaOptimize.Test/OptimalEncodingTests.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsBinary.cs b/MetaOptimize.Test/OptimalEncodingTestsBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsBinary.cs rename to MetaOptimize.Test/OptimalEncodingTestsBinary.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsGurobi.cs b/MetaOptimize.Test/OptimalEncodingTestsGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsGurobi.cs rename to MetaOptimize.Test/OptimalEncodingTestsGurobi.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsGurobiSOS.cs b/MetaOptimize.Test/OptimalEncodingTestsGurobiSOS.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsGurobiSOS.cs rename to MetaOptimize.Test/OptimalEncodingTestsGurobiSOS.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsZen.cs b/MetaOptimize.Test/OptimalEncodingTestsZen.cs similarity index 95% rename from MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsZen.cs rename to MetaOptimize.Test/OptimalEncodingTestsZen.cs index decd6b31..154b9919 100644 --- a/MetaOptimize/MetaOptimize.Test/OptimalEncodingTestsZen.cs +++ b/MetaOptimize.Test/OptimalEncodingTestsZen.cs @@ -12,12 +12,14 @@ namespace MetaOptimize.Test /// Tests for the optimal encoder. /// [TestClass] + [Ignore] public class OptimalEncodingTestsZen : OptimalEncodingTests, ZenSolution> { /// /// Initialize the test class. /// [TestInitialize] + [Ignore] public void Initialize() { this.CreateSolver = () => new SolverZen(); diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestGurobiMin.cs b/MetaOptimize.Test/OptimalityGapTestGurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTestGurobiMin.cs rename to MetaOptimize.Test/OptimalityGapTestGurobiMin.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTests.cs b/MetaOptimize.Test/OptimalityGapTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTests.cs rename to MetaOptimize.Test/OptimalityGapTests.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobi.cs b/MetaOptimize.Test/OptimalityGapTestsGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobi.cs rename to MetaOptimize.Test/OptimalityGapTestsGurobi.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobiBinary.cs b/MetaOptimize.Test/OptimalityGapTestsGurobiBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobiBinary.cs rename to MetaOptimize.Test/OptimalityGapTestsGurobiBinary.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobiSOS.cs b/MetaOptimize.Test/OptimalityGapTestsGurobiSOS.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTestsGurobiSOS.cs rename to MetaOptimize.Test/OptimalityGapTestsGurobiSOS.cs diff --git a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestsZen.cs b/MetaOptimize.Test/OptimalityGapTestsZen.cs similarity index 98% rename from MetaOptimize/MetaOptimize.Test/OptimalityGapTestsZen.cs rename to MetaOptimize.Test/OptimalityGapTestsZen.cs index 621fca9a..910200fe 100644 --- a/MetaOptimize/MetaOptimize.Test/OptimalityGapTestsZen.cs +++ b/MetaOptimize.Test/OptimalityGapTestsZen.cs @@ -12,6 +12,7 @@ namespace MetaOptimize.Test /// Tests for the optimality gap. /// [TestClass] + [Ignore] public class OptimalityGapTestsZen : OptimalityGapTests, ZenSolution> { /// diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTests.cs b/MetaOptimize.Test/PopEncodingTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTests.cs rename to MetaOptimize.Test/PopEncodingTests.cs diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobi.cs b/MetaOptimize.Test/PopEncodingTestsGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobi.cs rename to MetaOptimize.Test/PopEncodingTestsGurobi.cs diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiBinary.cs b/MetaOptimize.Test/PopEncodingTestsGurobiBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiBinary.cs rename to MetaOptimize.Test/PopEncodingTestsGurobiBinary.cs diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiMin.cs b/MetaOptimize.Test/PopEncodingTestsGurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiMin.cs rename to MetaOptimize.Test/PopEncodingTestsGurobiMin.cs diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiSOS.cs b/MetaOptimize.Test/PopEncodingTestsGurobiSOS.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTestsGurobiSOS.cs rename to MetaOptimize.Test/PopEncodingTestsGurobiSOS.cs diff --git a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsZen.cs b/MetaOptimize.Test/PopEncodingTestsZen.cs similarity index 98% rename from MetaOptimize/MetaOptimize.Test/PopEncodingTestsZen.cs rename to MetaOptimize.Test/PopEncodingTestsZen.cs index 9b135fb5..bdc05128 100644 --- a/MetaOptimize/MetaOptimize.Test/PopEncodingTestsZen.cs +++ b/MetaOptimize.Test/PopEncodingTestsZen.cs @@ -12,6 +12,7 @@ namespace MetaOptimize.Test /// Tests for the pop encoder. /// [TestClass] + [Ignore] public class PopEncodingTestsZen : PopEncodingTests, ZenSolution> { /// diff --git a/MetaOptimize/MetaOptimize.Test/TopologyTests.cs b/MetaOptimize.Test/TopologyTests.cs similarity index 100% rename from MetaOptimize/MetaOptimize.Test/TopologyTests.cs rename to MetaOptimize.Test/TopologyTests.cs diff --git a/MetaOptimize/MetaOptimize.sln b/MetaOptimize.sln similarity index 100% rename from MetaOptimize/MetaOptimize.sln rename to MetaOptimize.sln diff --git a/MetaOptimize/.gitignore b/MetaOptimize/.gitignore deleted file mode 100644 index 1dfb48ac..00000000 --- a/MetaOptimize/.gitignore +++ /dev/null @@ -1,354 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -logs/* -figs/* -Topologies/partition_log/* \ No newline at end of file diff --git a/MetaOptimize/MetaOptimize/AdversarialGenMethod.cs b/MetaOptimize/AdversarialGenMethod.cs similarity index 100% rename from MetaOptimize/MetaOptimize/AdversarialGenMethod.cs rename to MetaOptimize/AdversarialGenMethod.cs diff --git a/MetaOptimize/MetaOptimize/EncodingUtils.cs b/MetaOptimize/EncodingUtils.cs similarity index 100% rename from MetaOptimize/MetaOptimize/EncodingUtils.cs rename to MetaOptimize/EncodingUtils.cs diff --git a/MetaOptimize/MetaOptimize/Exceptions.cs b/MetaOptimize/Exceptions.cs similarity index 100% rename from MetaOptimize/MetaOptimize/Exceptions.cs rename to MetaOptimize/Exceptions.cs diff --git a/MetaOptimize/MetaOptimize/GenericDemandList.cs b/MetaOptimize/GenericDemandList.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GenericDemandList.cs rename to MetaOptimize/GenericDemandList.cs diff --git a/MetaOptimize/MetaOptimize/GurobiBinary.cs b/MetaOptimize/GurobiBinary.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiBinary.cs rename to MetaOptimize/GurobiBinary.cs diff --git a/MetaOptimize/MetaOptimize/GurobiCallback.cs b/MetaOptimize/GurobiCallback.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiCallback.cs rename to MetaOptimize/GurobiCallback.cs diff --git a/MetaOptimize/MetaOptimize/GurobiEnvironment.cs b/MetaOptimize/GurobiEnvironment.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiEnvironment.cs rename to MetaOptimize/GurobiEnvironment.cs diff --git a/MetaOptimize/MetaOptimize/GurobiMin.cs b/MetaOptimize/GurobiMin.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiMin.cs rename to MetaOptimize/GurobiMin.cs diff --git a/MetaOptimize/MetaOptimize/GurobiSOS.cs b/MetaOptimize/GurobiSOS.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiSOS.cs rename to MetaOptimize/GurobiSOS.cs diff --git a/MetaOptimize/MetaOptimize/GurobiStoreProgressCallback.cs b/MetaOptimize/GurobiStoreProgressCallback.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiStoreProgressCallback.cs rename to MetaOptimize/GurobiStoreProgressCallback.cs diff --git a/MetaOptimize/MetaOptimize/GurobiTerminationCallback.cs b/MetaOptimize/GurobiTerminationCallback.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiTerminationCallback.cs rename to MetaOptimize/GurobiTerminationCallback.cs diff --git a/MetaOptimize/MetaOptimize/GurobiTimeoutCallback.cs b/MetaOptimize/GurobiTimeoutCallback.cs similarity index 100% rename from MetaOptimize/MetaOptimize/GurobiTimeoutCallback.cs rename to MetaOptimize/GurobiTimeoutCallback.cs diff --git a/MetaOptimize/MetaOptimize/IDemandList.cs b/MetaOptimize/IDemandList.cs similarity index 100% rename from MetaOptimize/MetaOptimize/IDemandList.cs rename to MetaOptimize/IDemandList.cs diff --git a/MetaOptimize/MetaOptimize/IEncoder.cs b/MetaOptimize/IEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/IEncoder.cs rename to MetaOptimize/IEncoder.cs diff --git a/MetaOptimize/MetaOptimize/InnerEncodingMethod.cs b/MetaOptimize/InnerEncodingMethod.cs similarity index 100% rename from MetaOptimize/MetaOptimize/InnerEncodingMethod.cs rename to MetaOptimize/InnerEncodingMethod.cs diff --git a/MetaOptimize/MetaOptimize/KktOptimizationGenerator.cs b/MetaOptimize/KktOptimizationGenerator.cs similarity index 100% rename from MetaOptimize/MetaOptimize/KktOptimizationGenerator.cs rename to MetaOptimize/KktOptimizationGenerator.cs diff --git a/MetaOptimize/MetaOptimize/McCormickRelaxation.cs b/MetaOptimize/McCormickRelaxation.cs similarity index 100% rename from MetaOptimize/MetaOptimize/McCormickRelaxation.cs rename to MetaOptimize/McCormickRelaxation.cs diff --git a/MetaOptimize/MetaOptimize.Cli/Program.cs b/MetaOptimize/MetaOptimize.Cli/Program.cs deleted file mode 100644 index dd82a5dd..00000000 --- a/MetaOptimize/MetaOptimize.Cli/Program.cs +++ /dev/null @@ -1,608 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// - -namespace MetaOptimize.Cli -{ - using System; - using System.Diagnostics; - using CommandLine; - using Gurobi; - using MetaOptimize; - using ZenLib; - - /// - /// Main entry point for the program. - /// - public class Program - { - /// - /// checks whether we get the solution we expect after running the solvers. - /// - /// - public static void TEExampleMain(string[] args) - { - var topology = new Topology(); - topology.AddNode("a"); - topology.AddNode("b"); - topology.AddNode("c"); - topology.AddNode("d"); - topology.AddEdge("a", "b", capacity: 10); - topology.AddEdge("a", "c", capacity: 10); - topology.AddEdge("b", "d", capacity: 10); - topology.AddEdge("c", "d", capacity: 10); - - var partition = topology.RandomPartition(2); - // create the optimal encoder. - var solverG = new GurobiSOS(); - var optimalEncoderG = new TEMaxFlowOptimalEncoder(solverG, maxNumPaths: 1); - var popEncoderG = new PopEncoder(solverG, maxNumPaths: 1, numPartitions: 2, demandPartitions: partition); - var adversarialInputGenerator = new TEAdversarialInputGenerator(topology, maxNumPaths: 1); - - var (optimalSolutionG, popSolutionG) = adversarialInputGenerator.MaximizeOptimalityGap(optimalEncoderG, popEncoderG); - Console.WriteLine("Optimal:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimalSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("Heuristic:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(popSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - - var optimal = optimalSolutionG.MaxObjective; - var heuristic = popSolutionG.MaxObjective; - Console.WriteLine($"optimalG={optimal}, heuristicG={heuristic}"); - - var demands = new Dictionary<(string, string), double>(optimalSolutionG.Demands); - var optGSolver = new GurobiSOS(); - optimalEncoderG = new TEMaxFlowOptimalEncoder(optGSolver, maxNumPaths: 1); - var popGSolver = new GurobiSOS(); - popEncoderG = new PopEncoder(popGSolver, maxNumPaths: 1, numPartitions: 2, demandPartitions: partition); - Utils.checkSolution(topology, popEncoderG, optimalEncoderG, heuristic, optimal, demands, "gurobiCheck"); - } - - /// - /// Use this function to test our theorem for VBP. - /// (see theorem 1 in our NSDI24 Paper). - /// - public static void vbpMain(string[] args) - { - // OPT = 2m + 3n - // HUE = 4m + 6n - // num jobs = 6m + 9n - var solverG = new GurobiSOS(verbose: 0); - - for (int m = 1; m < 10; m++) - { - for (int n = 0; n < 2; n++) - { - Console.WriteLine(String.Format("============ m = {0}, n = {1}", m, n)); - var binSize = new List(); - binSize.Add(1.0001); - binSize.Add(1.0001); - var bins = new Bins(4 * m + 6 * n, binSize); - // TODO: need to change var name to be appropriate for the problem. - var demands = new Dictionary>(); - int nxt_key = 0; - - // TODO: need a comment that describes what the constants are here. you also may benefit from changing the constants to have a name. - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.92, 0.0 }; - nxt_key += 1; - } - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.91, 0.01 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.48, 0.2 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.68, 0 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.52, 0.12 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.32, 0.32 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.19, 0.45 }; - nxt_key += 1; - demands[nxt_key] = new List() { 0.42, 0.22 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.1, 0.54 }; - nxt_key += 1; - demands[nxt_key] = new List() { 0.1, 0.54 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.1, 0.53 }; - nxt_key += 1; - } - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.06, 0.48 }; - nxt_key += 1; - } - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.07, 0.47 }; - nxt_key += 1; - } - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.01, 0.53 }; - nxt_key += 1; - } - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.03, 0.51 }; - nxt_key += 1; - } - for (int i = 0; i < demands.Count - 1; i++) - { - double total_sum_1 = 0; - double total_sum_2 = 0; - for (int j = 0; j < demands[0].Count; j++) - { - total_sum_1 += demands[i][j]; - total_sum_2 += demands[i + 1][j]; - } - Debug.Assert(total_sum_1 >= total_sum_2 - 0.00001); - } - solverG.CleanAll(); - var optimalEncoder = new VBPOptimalEncoder(solverG, demands.Count, demands[0].Count); - var optimalEncoding = optimalEncoder.Encoding(bins, inputEqualityConstraints: demands, verbose: false); - var solverSolutionOptimal = optimalEncoder.Solver.Maximize(optimalEncoding.MaximizationObjective); - var optimizationSolutionOptimal = (VBPOptimizationSolution)optimalEncoder.GetSolution(solverSolutionOptimal); - Console.WriteLine( - String.Format("===== OPT {0}", optimizationSolutionOptimal.TotalNumBinsUsed)); - - solverG.CleanAll(); - var ffdEncoder = new FFDItemCentricEncoder(solverG, demands.Count, demands[0].Count); - var ffdEncoding = ffdEncoder.Encoding(bins, inputEqualityConstraints: demands, verbose: false); - var solverSolutionFFD = optimalEncoder.Solver.Maximize(ffdEncoding.MaximizationObjective); - var solutionFFD = (VBPOptimizationSolution)ffdEncoder.GetSolution(solverSolutionFFD); - Console.WriteLine( - String.Format("===== HUE {0}", solutionFFD.TotalNumBinsUsed)); - Debug.Assert(optimizationSolutionOptimal.TotalNumBinsUsed * 2 == solutionFFD.TotalNumBinsUsed); - } - } - } - - /// - /// test MetaOpt on VBP. - /// - /// TODO: specify how this function is different from the previous. - public static void Main(string[] args) - { - var binSize = new List(); - binSize.Add(1.00001); - binSize.Add(1.00001); - var bins = new Bins(6, binSize); - var numDemands = 9; - var numDimensions = 2; - var optimalBins = 3; - var ffdMethod = FFDMethodChoice.FFDSum; - List> demandList = null; - double perIterationTimeout = 1000; - // double perIterationTimeout = double.PositiveInfinity; - var solverG = new GurobiSOS(timeout: perIterationTimeout, verbose: 1); - var optimalEncoder = new VBPOptimalEncoder(solverG, numDemands, numDimensions, BreakSymmetry: false); - var ffdEncoder = new FFDItemCentricEncoder(solverG, numDemands, numDimensions); - var adversarialGenerator = new VBPAdversarialInputGenerator(bins, numDemands, numDimensions); - var (optimalSolutionG, ffdSolutionG) = adversarialGenerator.MaximizeOptimalityGapFFD(optimalEncoder, ffdEncoder, - optimalBins, ffdMethod: ffdMethod, itemList: demandList, verbose: true); - Console.WriteLine("Optimal:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimalSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("Heuristic:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(ffdSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("Optimal number of bins: " + optimalSolutionG.TotalNumBinsUsed); - Console.WriteLine("FFD number of bins: " + ffdSolutionG.TotalNumBinsUsed); - } - - /// - /// test case for SP-PIFO. - /// - public static void PIFOTestMain(string[] args) - { - int maxRank = 8; - int numPackets = 15; - int numQueues = 4; - int splitQueue = 2; - int splitRank = 5; - var solverG = new GurobiSOS(verbose: 0); - - var packetRankEqualityConstraint = new Dictionary(); - packetRankEqualityConstraint[0] = 7; - packetRankEqualityConstraint[1] = 2; - packetRankEqualityConstraint[2] = 1; - packetRankEqualityConstraint[3] = 0; - packetRankEqualityConstraint[4] = 7; - packetRankEqualityConstraint[5] = 7; - packetRankEqualityConstraint[6] = 2; - packetRankEqualityConstraint[7] = 1; - packetRankEqualityConstraint[8] = 0; - packetRankEqualityConstraint[9] = 2; - packetRankEqualityConstraint[10] = 1; - packetRankEqualityConstraint[11] = 0; - packetRankEqualityConstraint[12] = 2; - packetRankEqualityConstraint[13] = 1; - packetRankEqualityConstraint[14] = 0; - solverG.CleanAll(); - var optimalEncoder = new PIFOAvgDelayOptimalEncoder(solverG, numPackets, maxRank); - var optimalEncoding = optimalEncoder.Encoding(rankEqualityConstraints: packetRankEqualityConstraint); - var solverSolutionOptimal = optimalEncoder.Solver.Maximize(optimalEncoding.MaximizationObjective); - var optimizationSolutionOptimal = (PIFOOptimizationSolution)optimalEncoder.GetSolution(solverSolutionOptimal); - Console.WriteLine("Optimal:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimizationSolutionOptimal, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("===== OPT {0}", optimizationSolutionOptimal.Cost); - - solverG.CleanAll(); - var heuristicEncoder = new ModifiedSPPIFOAvgDelayEncoder(solverG, numPackets, splitQueue, numQueues, splitRank, maxRank); - var heuristicEncoding = heuristicEncoder.Encoding(rankEqualityConstraints: packetRankEqualityConstraint); - var solverSolutionHeuristic = optimalEncoder.Solver.Maximize(heuristicEncoding.MaximizationObjective); - var solutionHeuristic = (PIFOOptimizationSolution)heuristicEncoder.GetSolution(solverSolutionHeuristic); - Console.WriteLine("Heuristic:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(solutionHeuristic, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("===== HUE {0}", solutionHeuristic.Cost); - } - - /// - /// test MetaOpt on PIFO. - /// - public static void PIFOMain(string[] args) - { - int maxRank = 8; - int numPackets = 18; - int numQueues = 4; - // int splitQueue = 2; - // int splitRank = 4; - int maxQueueSize = 12; - int windowSize = 12; - double burstParam = 0.1; - - var solverG = new GurobiSOS(verbose: 1, timeout: 1000); - // var optimalEncoder = new PIFOAvgDelayOptimalEncoder(solverG, numPackets, maxRank); - // var heuristicEncoder = new SPPIFOAvgDelayEncoder(solverG, numPackets, numQueues, maxRank); - // var optimalEncoder = new SPPIFOAvgDelayEncoder(solverG, numPackets, numQueues, maxRank); - // var heuristicEncoder = new ModifiedSPPIFOAvgDelayEncoder(solverG, numPackets, splitQueue, numQueues, - // splitRank, maxRank); - // var optimalEncoder = new PIFOWithDropAvgDelayEncoder(solverG, numPackets, maxRank, maxQueueSize); - var H1 = new SPPIFOWithDropAvgDelayEncoder(solverG, numPackets, numQueues, maxRank, maxQueueSize); - var H2 = new AIFOAvgDelayEncoder(solverG, numPackets, maxRank, maxQueueSize, windowSize, burstParam); - - var adversarialGenerator = new PIFOAdversarialInputGenerator(numPackets, maxRank); - var (optimalSolutionG, heuristicSolutionG) = adversarialGenerator.MaximizeOptimalityGap(H1, - H2, verbose: true); - Console.WriteLine("Optimal:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimalSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("Heuristic:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(heuristicSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("Optimal cost: " + optimalSolutionG.Cost); - Console.WriteLine("Heuristic cost: " + heuristicSolutionG.Cost); - - var orderToRankOpt = new Dictionary(); - var orderToRankHeu = new Dictionary(); - for (int pid = 0; pid < numPackets; pid++) { - if (optimalSolutionG.Admit[pid] == 1) { - orderToRankOpt[optimalSolutionG.Order[pid]] = optimalSolutionG.Ranks[pid]; - } - if (heuristicSolutionG.Admit[pid] == 1) { - orderToRankHeu[heuristicSolutionG.Order[pid]] = heuristicSolutionG.Ranks[pid]; - } - } - - int numInvOpt = 0; - int numInvHeu = 0; - for (int pid = 0; pid < numPackets; pid++) - { - numInvOpt += ComputeInversionNum(optimalSolutionG, orderToRankOpt, pid); - numInvHeu += ComputeInversionNum(heuristicSolutionG, orderToRankHeu, pid); - } - Console.WriteLine("number of inversions in OPT: " + numInvOpt); - Console.WriteLine("number of inversions in HEU: " + numInvHeu); - } - - private static int ComputeInversionNum(PIFOOptimizationSolution optimalSolutionG, Dictionary orderToRankOpt, int pid) - { - int numInvOpt = 0; - if (optimalSolutionG.Admit[pid] >= 0.98) - { - int currOrder = optimalSolutionG.Order[pid]; - for (int prev = 0; prev < currOrder; prev++) - { - if (orderToRankOpt[prev] > optimalSolutionG.Ranks[pid]) - { - numInvOpt += 1; - } - } - } - else - { - foreach (var (order, rank) in orderToRankOpt) - { - if (rank > optimalSolutionG.Ranks[pid]) - { - numInvOpt += 1; - } - } - } - - return numInvOpt; - } - - /// - /// Experiments for NSDI. - /// - public static void NSDIMain(string[] args) - { - // NSDIExp.compareGapDelayDiffMethodsDP(); - // NSDIExp.compareLargeScaleGapDelayDiffMethodsDP(); - // NSDIExp.compareGapDelayDiffMethodsPop(); - // NSDIExp.AblationStudyClusteringOnDP(); - // NSDIExp.BlackBoxParameterTunning(); - NSDIExp.AddRealisticConstraintsDP(); - // NSDIExp.gapThresholdDemandPinningForDifferentTopologies(); - // NSDIExp.ImpactNumPathsPartitionsExpectedPop(); - // NSDIExp.AblationStudyClusteringOnDP(); - // NSDIExp.BlackBoxParameterTunning(); - // NSDIExp.AnalyzeModifiedDP(); - // NSDIExp.ImpactNumNodesRadixSmallWordTopoDemandPinning(); - // NSDIExp.ImpactNumSamplesExpectedPop(); - // NSDIExp.AnalyzeParallelHeuristics(); - } - - /// - /// Experiments for hotnets. - /// - public static void hotnetsMain(string[] args) - { - // var topology = Topology.RandomRegularGraph(8, 7, 1, seed: 0); - // var topology = Topology.SmallWordGraph(5, 4, 1); - // foreach (var edge in topology.GetAllEdges()) { - // Console.WriteLine(edge.Source + "_" + edge.Target); - // } - // foreach (var pair in topology.GetNodePairs()) { - // if (!topology.ContaintsEdge(pair.Item1, pair.Item2, 1)) { - // Console.WriteLine("missing link " + pair.Item1 + " " + pair.Item2); - // } - // } - // Experiment.printPaths(); - // HotNetsExperiment.impactOfDPThresholdOnGap(); - // Experiment.ImpactNumPathsDemandPinning(); - // Experiment.ImpactNumNodesRadixRandomRegularGraphDemandPinning(); - HotNetsExperiment.impactSmallWordGraphParamsDP(); - // Experiment.ImpactNumPathsPartitionsPop(); - // Experiment.compareGapDelayDiffMethodsPop(); - // Experiment.compareGapDelayDiffMethodsDP(); - // Experiment.compareTopoSizeLatency(); - } - - /// - /// Main entry point for the program. - /// The function takes the command line arguments and stores them in a - /// static instance property of the CliOptions class. - /// It then reads the topology and clusters from the files specified in the - /// command line arguments and then proceeds to find the optimality gap. - /// - /// The arguments. - public static void ssMain(string[] args) - { - // read the command line arguments. - var opts = CommandLine.Parser.Default.ParseArguments(args).MapResult(o => o, e => null); - CliOptions.Instance = opts; - - if (opts == null) - { - Environment.Exit(0); - } - - // read the topology and clusters. - var (topology, clusters) = CliUtils.getTopology(opts.TopologyFile, opts.PathFile, opts.DownScaleFactor, opts.EnableClustering, - opts.NumClusters, opts.ClusterDir, opts.Verbose); - - getSolverAndRunNetwork(topology, clusters); - } - - // TODO: this function is missing proper commenting - private static void getSolverAndRunNetwork(Topology topology, List clusters) - { - var opts = CliOptions.Instance; - // use the Z3 solver via the Zen wrapper library. - switch (opts.SolverChoice) - { - case SolverChoice.Zen: - // run the zen optimizer. - RunNetwork(new SolverZen(), topology, clusters); - break; - case SolverChoice.Gurobi: - var storeProgress = opts.StoreProgress & (opts.Method == MethodChoice.Direct); - if (opts.Heuristic == Heuristic.DemandPinning) - { - RunNetwork(new GurobiSOS(opts.Timeout, Convert.ToInt32(opts.Verbose), - timeToTerminateNoImprovement: opts.TimeToTerminateIfNoImprovement, - numThreads: opts.NumGurobiThreads, - recordProgress: storeProgress, - logPath: opts.LogFile), - topology, clusters); - } - else - { - RunNetwork(new GurobiSOS(opts.Timeout, Convert.ToInt32(opts.Verbose), - timeToTerminateNoImprovement: opts.TimeToTerminateIfNoImprovement, - numThreads: opts.NumGurobiThreads, - recordProgress: storeProgress, - logPath: opts.LogFile), - topology, clusters); - } - break; - default: - throw new Exception("Other solvers are currently invalid."); - } - } - - // TODO: this function is missing proper commenting - private static void RunNetwork(ISolver solver, - Topology topology, List clusters) - { - var opts = CliOptions.Instance; - - // setup the optimal encoder and adversarial input generator. - var optimalEncoder = new TEMaxFlowOptimalEncoder(solver, opts.Paths); - TEAdversarialInputGenerator adversarialInputGenerator; - adversarialInputGenerator = new TEAdversarialInputGenerator(topology, opts.Paths, opts.NumProcesses); - - // setup the heuristic encoder and partitions. - var heuristicSolver = solver; - var (heuristicEncoder, partitioning, partitionList) = CliUtils.getHeuristic(heuristicSolver, topology, opts.Heuristic, opts.Paths, opts.PopSlices, - opts.DemandPinningThreshold * opts.DownScaleFactor, numSamples: opts.NumRandom, partitionSensitivity: opts.PartitionSensitivity, - scaleFactor: opts.DownScaleFactor, InnerEncoding: opts.InnerEncoding, maxShortestPathLen: opts.MaxShortestPathLen); - - // find an adversarial example and show the time taken. - var demandList = new GenericDemandList((opts.DemandList.Split(",")).Select(x => double.Parse(x) * opts.DownScaleFactor).ToHashSet()); - Utils.logger( - string.Format("Demand List:{0}", Newtonsoft.Json.JsonConvert.SerializeObject(demandList.demandList, Newtonsoft.Json.Formatting.Indented)), - opts.Verbose); - var timer = System.Diagnostics.Stopwatch.StartNew(); - Utils.logger("Starting setup", opts.Verbose); - (TEOptimizationSolution, TEOptimizationSolution) result; - switch (opts.Method) - { - case MethodChoice.Direct: - result = CliUtils.getMetaOptResult(adversarialInputGenerator, optimalEncoder, heuristicEncoder, opts.DemandUB, opts.InnerEncoding, - demandList, opts.EnableClustering, opts.ClusterVersion, clusters, opts.NumInterClusterSamples, opts.NumNodesPerCluster, - opts.NumInterClusterQuantizations, opts.Simplify, opts.Verbose, opts.MaxDensity, opts.LargeDemandLB, opts.maxLargeDistance, - opts.maxSmallDistance, false, null); - break; - case MethodChoice.Search: - Utils.logger("Going to use search to find a desirable gap", opts.Verbose); - result = adversarialInputGenerator.FindMaximumGapInterval(optimalEncoder, heuristicEncoder, opts.Confidencelvl, opts.StartingGap, opts.DemandUB, - demandList: demandList); - break; - case MethodChoice.FindFeas: - Utils.logger("Going to find one feasible solution with the specified gap", opts.Verbose); - result = adversarialInputGenerator.FindOptimalityGapAtLeast(optimalEncoder, heuristicEncoder, opts.StartingGap, opts.DemandUB, - demandList: demandList, simplify: opts.Simplify); - break; - case MethodChoice.Random: - Utils.logger("Going to do random search to find some advers inputs", opts.Verbose); - result = adversarialInputGenerator.RandomAdversarialGenerator(optimalEncoder, heuristicEncoder, opts.NumRandom, opts.DemandUB, seed: opts.Seed, - verbose: opts.Verbose, storeProgress: opts.StoreProgress, logPath: opts.LogFile, timeout: opts.Timeout); - break; - case MethodChoice.HillClimber: - Utils.logger("Going to use HillClimber to find some advers inputs", opts.Verbose); - result = adversarialInputGenerator.HillClimbingAdversarialGenerator(optimalEncoder, heuristicEncoder, opts.NumRandom, - opts.NumNeighbors, opts.DemandUB, opts.StdDev, seed: opts.Seed, verbose: opts.Verbose, storeProgress: opts.StoreProgress, - logPath: opts.LogFile, timeout: opts.Timeout); - break; - case MethodChoice.SimulatedAnnealing: - Utils.logger("Going to use Simulated Annealing to find some advers inputs", opts.Verbose); - Utils.logger(opts.LogFile, opts.Verbose); - result = adversarialInputGenerator.SimulatedAnnealing(optimalEncoder, heuristicEncoder, opts.NumRandom, opts.NumNeighbors, - opts.DemandUB, opts.StdDev, opts.InitTmp, opts.TmpDecreaseFactor, seed: opts.Seed, verbose: opts.Verbose, storeProgress: opts.StoreProgress, - logPath: opts.LogFile, timeout: opts.Timeout); - break; - default: - throw new Exception("Wrong Method, please choose between available methods!!"); - } - - if (opts.FullOpt) - { - if (!opts.EnableClustering) - { - throw new Exception("does not need to be enable for non-clustering method"); - } - if (opts.InnerEncoding != InnerRewriteMethodChoice.PrimalDual) - { - throw new Exception("inner encoding should be primal dual"); - } - optimalEncoder.Solver.CleanAll(timeout: opts.FullOptTimer); - var currDemands = new Dictionary<(string, string), double>(result.Item1.Demands); - Utils.setEmptyPairsToZero(topology, currDemands); - result = adversarialInputGenerator.MaximizeOptimalityGap(optimalEncoder, heuristicEncoder, opts.DemandUB, innerEncoding: opts.InnerEncoding, - demandList: demandList, simplify: opts.Simplify, verbose: opts.Verbose, demandInits: currDemands); - optimalEncoder.Solver.CleanAll(focusBstBd: false, timeout: opts.Timeout); - } - - if (opts.UBFocus) - { - var currDemands = new Dictionary<(string, string), double>(result.Item1.Demands); - optimalEncoder.Solver.CleanAll(focusBstBd: true, timeout: opts.UBFocusTimer); - Utils.setEmptyPairsToZero(topology, currDemands); - result = adversarialInputGenerator.MaximizeOptimalityGap(optimalEncoder, heuristicEncoder, opts.DemandUB, innerEncoding: opts.InnerEncoding, - demandList: demandList, simplify: opts.Simplify, verbose: opts.Verbose, demandInits: currDemands); - optimalEncoder.Solver.CleanAll(focusBstBd: false, timeout: opts.Timeout); - } - var optimal = result.Item1.MaxObjective; - var heuristic = result.Item2.MaxObjective; - var demands = new Dictionary<(string, string), double>(result.Item1.Demands); - Utils.setEmptyPairsToZero(topology, demands); - Console.WriteLine("##############################################"); - Console.WriteLine("##############################################"); - Console.WriteLine("##############################################"); - Console.WriteLine($"optimal={optimal}, heuristic={heuristic}, time={timer.ElapsedMilliseconds}ms"); - if (opts.Heuristic == Heuristic.ExpectedPop) - { - CliUtils.findGapExpectedPopAdversarialDemandOnIndependentPartitions(opts, topology, demands, optimal); - } - Console.WriteLine("##############################################"); - Console.WriteLine("##############################################"); - Console.WriteLine("##############################################"); - var optGSolver = new GurobiBinary(); - var optimalEncoderG = new TEMaxFlowOptimalEncoder(optGSolver, maxNumPaths: opts.Paths); - var optZSolver = new SolverZen(); - var optimalEncoderZen = new TEMaxFlowOptimalEncoder, ZenSolution>(optZSolver, maxNumPaths: opts.Paths); - - var gSolver = new GurobiBinary(); - var zSolver = new SolverZen(); - IEncoder heuristicEncoderG; - IEncoder, ZenSolution> heuristicEncoderZ; - switch (opts.Heuristic) - { - case Heuristic.Pop: - Console.WriteLine("Starting exploring pop heuristic"); - heuristicEncoderG = new PopEncoder(gSolver, maxNumPaths: opts.Paths, numPartitions: opts.PopSlices, demandPartitions: partitioning); - heuristicEncoderZ = new PopEncoder, ZenSolution>(zSolver, maxNumPaths: opts.Paths, numPartitions: opts.PopSlices, demandPartitions: partitioning); - break; - case Heuristic.DemandPinning: - Console.WriteLine("Starting exploring demand pinning heuristic"); - heuristicEncoderG = new DirectDemandPinningEncoder(gSolver, k: opts.Paths, threshold: opts.DemandPinningThreshold * opts.DownScaleFactor); - heuristicEncoderZ = new DirectDemandPinningEncoder, ZenSolution>(zSolver, k: opts.Paths, threshold: opts.DemandPinningThreshold * opts.DownScaleFactor); - break; - case Heuristic.ExpectedPop: - Console.WriteLine("Starting to explore expected pop heuristic"); - heuristicEncoderG = new ExpectedPopEncoder(gSolver, k: opts.Paths, numSamples: opts.NumRandom, - numPartitionsPerSample: opts.PopSlices, demandPartitionsList: partitionList); - heuristicEncoderZ = new ExpectedPopEncoder, ZenSolution>(zSolver, k: opts.Paths, numSamples: opts.NumRandom, - numPartitionsPerSample: opts.PopSlices, demandPartitionsList: partitionList); - break; - case Heuristic.PopDp: - throw new Exception("Not Implemented Yet."); - default: - throw new Exception("No heuristic selected."); - } - Utils.checkSolution(topology, heuristicEncoderG, optimalEncoderG, heuristic, optimal, demands, "gurobiCheck"); - } - } -} \ No newline at end of file diff --git a/MetaOptimize/MetaOptimize/MetaOptimize.csproj b/MetaOptimize/MetaOptimize.csproj similarity index 100% rename from MetaOptimize/MetaOptimize/MetaOptimize.csproj rename to MetaOptimize/MetaOptimize.csproj diff --git a/MetaOptimize/MetaOptimize/ISolver.cs b/MetaOptimize/MetaOptimize/ISolver.cs deleted file mode 100644 index 7aa7ea68..00000000 --- a/MetaOptimize/MetaOptimize/ISolver.cs +++ /dev/null @@ -1,258 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// - -namespace MetaOptimize -{ - using System.Collections.Generic; - using Gurobi; - /// - /// An interface for an optimization solver. - /// - public interface ISolver - { - /// - /// Reset the solver by removing all the variables and constraints. - /// - public void CleanAll(double timeout = -1, bool disableStoreProgress = false); - - /// - /// Reset the solver by removing all the variables and constraints. - /// - public void CleanAll(bool focusBstBd, double timeout = -1); - - /// - /// Create a new variable with a given name. - /// - /// The variable name. - /// the type of variable. - /// The lb on the variable. - /// The ub on the variable. - /// The solver variable. - public TVar CreateVariable(string name, char type = GRB.CONTINUOUS, - double lb = double.NegativeInfinity, double ub = double.PositiveInfinity); - - /// - /// Get the resulting value assigned to a variable. - /// - /// The solver solution. - /// The variable. - /// which solution to return (if multiple solutions). - /// The value as a double. - public double GetVariable(TSolution solution, TVar variable, int solutionNumber = 0); - - /// - /// Get the resulting value assigned to a variable. - /// - public double GetDualVariable(TSolution solution, string constrName); - - /// - /// set the objective. - /// - /// The solver solution. - public void SetObjective(Polynomial objective); - - /// - /// set the objective. - /// - /// The solver solution. - public void SetObjective(TVar objective); - - /// - /// set the objective. - /// - /// value for timeout. - public void SetTimeout(double timeout); - - /// - /// set the FocusBstBd. - /// - public void SetFocusBstBd(bool focusBstBd); - - /// - /// get model. - /// - public TSolution GetModel(); - - /// - /// Add a less than or equal to zero constraint. - /// - /// The polynomial. - /// name of the constraint. - public string AddLeqZeroConstraint(Polynomial polynomial); - - /// - /// Add a less than or equal to zero constraint (Quadratic). - /// Following constraints; A * B + C \leq 0. - /// - /// The coefficent polynomial list (A). - /// The variable list (B). - /// The linear term (C). - /// type of variable in coeff polynomial list (C). - /// type of variable in variable list (E). - /// name of the constraint. - public string AddLeqZeroConstraint(IList> coeffPolyList, IList variableList, - Polynomial linearPoly, VariableType coeffVarType = VariableType.BINARY, - VariableType varType = VariableType.CONTINUOUS); - - /// - /// Add a equal to zero constraint. - /// - /// The polynomial. - /// name of the constraint. - public string AddEqZeroConstraint(Polynomial polynomial); - - /// - /// Add a equal to zero constraint (Quadratic). - /// Following constraints; A * B + C == 0. - /// - /// The coefficent polynomial list (A). - /// The variable list (B). - /// The linear term (C). - /// type of variable in coeff polynomial list (D). - /// type of variable in variable list (E). - /// name of the constraint. - public string AddEqZeroConstraint(IList> coeffPolyList, IList variableList, - Polynomial linearPoly, VariableType coeffVarType = VariableType.BINARY, - VariableType varType = VariableType.CONTINUOUS); - - /// - /// Add or equals zero. - /// - /// The first polynomial. - /// The second polynomial. - public void AddOrEqZeroConstraint(Polynomial polynomial1, Polynomial polynomial2); - - /// - /// Add a = max(b, c) constraint. - /// - public void AddMaxConstraint(TVar LHS, Polynomial maxItem1, Polynomial maxItem2); - - /// - /// Add a = max(b, constant) constraint. - /// - public void AddMaxConstraint(TVar LHS, Polynomial var1, double constant); - - /// - /// Add a = max(b, constant) constraint. - /// - public void AddMaxConstraint(TVar LHS, TVar var1, double constant); - - /// - /// Add a = max(b, c) constraint. - /// - public void AddMaxConstraint(TVar LHS, TVar var1, TVar var2); - - /// - /// Logistic constraint y = 1/(1 + exp(-x)). - /// - public void AddLogisticConstraint(TVar xVar, TVar yVar, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, - double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); - - /// - /// power constraint y = x^a. - /// - public void AddPowerConstraint(TVar xVar, TVar yVar, int a, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, - double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); - - /// - /// polynomial constraint y = p0 x^d + p1 x^{d-1} + ... + pd. - /// - public void AddPolynomialConstraint(TVar xVar, TVar yVar, double[] p, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, - double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); - - /// - /// polynomial constraint y = norm_d(x_1, ..., x_n). - /// - public void AddNormConstraint(TVar[] xVar, TVar yVar, double which, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, - double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); - - /// - /// Remove a constraint. - /// - /// name of the constraint in the string format. - public void RemoveConstraint(string constraintName); - - /// - /// Change constraint's RHS. - /// - /// name of the constraint in the string format. - /// new RHS of the constraint. - public void ChangeConstraintRHS(string constraintName, double newRHS); - - /// - /// Combine the constraints and variables of another solver into this one. - /// - /// The other solver. - public void CombineWith(ISolver otherSolver); - - /// - /// Maximize the objective. - /// - /// A solution. - public TSolution Maximize(); - - /// - /// Maximize the objective with objective as input. - /// - /// A solution. - public TSolution Maximize(Polynomial objective); - - /// - /// Maximize the objective with objective as input. - /// reset the callback timer. - /// - /// A solution. - public TSolution Maximize(Polynomial objective, bool reset); - - /// - /// find the top $k$ solutions. - /// - public TSolution Maximize(Polynomial objective, bool reset, int solutionCount); - - /// - /// Maximize a quadratic objective with objective as input. - /// reset the callback timer. - /// - /// A solution. - public TSolution MaximizeQuadPow2(IList> quadObjective, IList quadCoeff, Polynomial linObjective, bool reset = false); - - /// - /// Maximize the objective with objective as input. - /// - /// A solution. - public TSolution Maximize(TVar objective); - - /// - /// Check feasibility. - /// - /// A solution. - public TSolution CheckFeasibility(double objectiveValue); - - /// - /// Call the model update to apply new constraints and objectives. - /// - public void ModelUpdate(); - - /// - /// initialize some of the variables. - /// - public void InitializeVariables(TVar variable, double value); - - /// - /// adding some auxiliary term to be added to the global objective when maximized. - /// - public void AddGlobalTerm(Polynomial auxObjPoly); - - /// - /// append as the next line of the store progress file. - /// - public void AppendToStoreProgressFile(double time_ms, double gap, bool reset = false); - - /// - /// writes the model to a file. - /// - /// - public void WriteModel(string location); - } -} diff --git a/MetaOptimize/MetaOptimize/OptimizationEncoding.cs b/MetaOptimize/OptimizationEncoding.cs similarity index 100% rename from MetaOptimize/MetaOptimize/OptimizationEncoding.cs rename to MetaOptimize/OptimizationEncoding.cs diff --git a/MetaOptimize/MetaOptimize/OptimizationSolution.cs b/MetaOptimize/OptimizationSolution.cs similarity index 100% rename from MetaOptimize/MetaOptimize/OptimizationSolution.cs rename to MetaOptimize/OptimizationSolution.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/AIFOAvgDelayEncoder.cs b/MetaOptimize/PIFO/AIFOAvgDelayEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/AIFOAvgDelayEncoder.cs rename to MetaOptimize/PIFO/AIFOAvgDelayEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/AIFOEncoder.cs b/MetaOptimize/PIFO/AIFOEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/AIFOEncoder.cs rename to MetaOptimize/PIFO/AIFOEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/ModifiedSPPIFOAvgDelayEncoder.cs b/MetaOptimize/PIFO/ModifiedSPPIFOAvgDelayEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/ModifiedSPPIFOAvgDelayEncoder.cs rename to MetaOptimize/PIFO/ModifiedSPPIFOAvgDelayEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/ModifiedSPPIFOEncoder.cs b/MetaOptimize/PIFO/ModifiedSPPIFOEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/ModifiedSPPIFOEncoder.cs rename to MetaOptimize/PIFO/ModifiedSPPIFOEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOAdversarialInputGenerator.cs b/MetaOptimize/PIFO/PIFOAdversarialInputGenerator.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOAdversarialInputGenerator.cs rename to MetaOptimize/PIFO/PIFOAdversarialInputGenerator.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOAvgDelayOptimalEncoder.cs b/MetaOptimize/PIFO/PIFOAvgDelayOptimalEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOAvgDelayOptimalEncoder.cs rename to MetaOptimize/PIFO/PIFOAvgDelayOptimalEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOOptimalEncoder.cs b/MetaOptimize/PIFO/PIFOOptimalEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOOptimalEncoder.cs rename to MetaOptimize/PIFO/PIFOOptimalEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOOptimizationEncoding.cs b/MetaOptimize/PIFO/PIFOOptimizationEncoding.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOOptimizationEncoding.cs rename to MetaOptimize/PIFO/PIFOOptimizationEncoding.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOOptimizationSolution.cs b/MetaOptimize/PIFO/PIFOOptimizationSolution.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOOptimizationSolution.cs rename to MetaOptimize/PIFO/PIFOOptimizationSolution.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOUtils.cs b/MetaOptimize/PIFO/PIFOUtils.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOUtils.cs rename to MetaOptimize/PIFO/PIFOUtils.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOWithDropAvgDelayEncoder.cs b/MetaOptimize/PIFO/PIFOWithDropAvgDelayEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOWithDropAvgDelayEncoder.cs rename to MetaOptimize/PIFO/PIFOWithDropAvgDelayEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/PIFOWithDropEncoder.cs b/MetaOptimize/PIFO/PIFOWithDropEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/PIFOWithDropEncoder.cs rename to MetaOptimize/PIFO/PIFOWithDropEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/SPPIFOAvgDelayEncoder.cs b/MetaOptimize/PIFO/SPPIFOAvgDelayEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/SPPIFOAvgDelayEncoder.cs rename to MetaOptimize/PIFO/SPPIFOAvgDelayEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/SPPIFOEncoder.cs b/MetaOptimize/PIFO/SPPIFOEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/SPPIFOEncoder.cs rename to MetaOptimize/PIFO/SPPIFOEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/SPPIFOWithDropAvgDelayEncoder.cs b/MetaOptimize/PIFO/SPPIFOWithDropAvgDelayEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/SPPIFOWithDropAvgDelayEncoder.cs rename to MetaOptimize/PIFO/SPPIFOWithDropAvgDelayEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PIFO/SPPIFOWithDropEncoder.cs b/MetaOptimize/PIFO/SPPIFOWithDropEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PIFO/SPPIFOWithDropEncoder.cs rename to MetaOptimize/PIFO/SPPIFOWithDropEncoder.cs diff --git a/MetaOptimize/MetaOptimize/PairwiseDemandList.cs b/MetaOptimize/PairwiseDemandList.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PairwiseDemandList.cs rename to MetaOptimize/PairwiseDemandList.cs diff --git a/MetaOptimize/MetaOptimize/PathComparer.cs b/MetaOptimize/PathComparer.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PathComparer.cs rename to MetaOptimize/PathComparer.cs diff --git a/MetaOptimize/MetaOptimize/Polynomial.cs b/MetaOptimize/Polynomial.cs similarity index 100% rename from MetaOptimize/MetaOptimize/Polynomial.cs rename to MetaOptimize/Polynomial.cs diff --git a/MetaOptimize/MetaOptimize/PrimalDualOptimizationGenerator.cs b/MetaOptimize/PrimalDualOptimizationGenerator.cs similarity index 100% rename from MetaOptimize/MetaOptimize/PrimalDualOptimizationGenerator.cs rename to MetaOptimize/PrimalDualOptimizationGenerator.cs diff --git a/MetaOptimize/README.md b/MetaOptimize/README.md deleted file mode 100644 index c7084ea2..00000000 --- a/MetaOptimize/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# MetaOpt: Examining, explaining, and improving heuristic performance - -`MetaOpt` is the first general-purpose and scalable tool that enables users to analyze a broad class of heuristics through easy-to-use abstractions that apply to a broad range of practical heuristics. For more information, checkout [MetaOpt's project webpage](https://www.microsoft.com/en-us/research/project/finding-adversarial-inputs-for-heuristics/overview/) and our NSDI'24 paper ([Finding Adversarial Inputs for Heuristics using Multi-level Optimization](https://arxiv.org/abs/2311.12779)). - - -## Code Structure -``` -├── MetaOptimize # Implementation of all the main components of MetaOpt. -| | # (helper functions, solver APIs, rewrites, etc.) -| | -| ├── TrafficEngineering # implementation of TE encoders (OPT, DP, and POP) -| | # and TE adversarial generator. -| | -| ├── VectorBinPacking # implementation of VBP encoders (OPT and variants of FF) -| | # and VBP adversarial generator. -| | -| └── PIFO # implementation of PIFO, SP-PIFO, and AIFO encoders. -| -| -├── MetaOptimize.Cli # examples and scripts to reproduce the results in -| # our NSDI24 and HotNet22 papers. -| -└── MetaOptimize.Test # testcases for MetaOpt. -``` - -## Getting Started - -We provide multiple example Main functions that you can try in `MetaOptimize.Cli/Program.cs` for different heuristics in vector bin packing, packet scheduling, and traffic engineering. - -We also provide many unit-tests that can serve as a starting point in `MetaOptimize.Test`. - -You can use MetaOpt either with the [Gurobi optimization solver](https://www.gurobi.com/documentation/current/examples/cs_examples.html) -or with [Zen](https://dl.acm.org/doi/10.1145/3422604.3425930). -Make sure you install both solvers and configure the proper Gurobi license. If you are in academia, you can follow the instructions on Gurobi's website to obtain a license. - -## Analyzing heuristics using MetaOpt - -

- -

- - -If you would like to analyze a heuristic that we have not modeled as part of MetaOpt yet, here are the steps to follow: - -1- Model your heuristic as either a convex optimization problem or a feasibility problem which our solvers can support. -How you model the problem is important and can significantly influence MetaOpt's ability to scale (and also whether Gurobi can run into -numerical issues). If you run into trouble with this step, feel free to contact the MetaOpt authors at: namyar@usc.edu and bearzani@microsoft.com. - -2- You need to write an `Encoder` library for both the heuristic you want to analyze and the optimal form of the problem (or if you want to compare two heuristics, for the other heuristics). -We strongly recommend looking at the Traffic Engineering, VBP, and packet scheduling Encoders we have provided as part of the MetaOpt code-base for examples. -Encoders must meet the specifications in the `IEncoder.cs` library. -If your problem is a convex optimization problem (and NOT a feasibility problem), you also need to pick the type of re-write you want to use (`KKT` or `quantized primal dual`). -We recommend the quantized primal dual approach to achieve better scalability. - -To use the quantized primal dual approach, you also need to specify the quantization levels. - -3- Once you have both of the encoders in place, you have to write an adversarial input generator. See the `TE` and `VBP` folders for examples. -To solve the MetaOpt problem, you need to create the `input variables` in the adversarial input generator and pass the SAME input variables to the encoders -for the algorithms you want to analyze. -Also notice that the adversarial input generator and the two encoders need to use the same solver instance. - -To see examples of this workflow, we highly recommend looking at the test cases in `MetaOptimize.Test`. - -## Citations -```bibtex -@inproceedings{metaopt, - author = {Namyar, Pooria and Arzani, Behnaz and Beckett, Ryan and Segarra, Santiago and Raj, Himanshu and Krishnaswamy, Umesh and Govindan, Ramesh and Kandula, Srikanth}, - title = {{F}inding {A}dversarial {I}nputs for {H}euristics using - {M}ulti-level {O}ptimization}, - booktitle = {21st USENIX Symposium on Networked Systems Design and - Implementation (NSDI 24)}, - year = {2024}, -} -``` - -```bibtex -@inproceedings{10.1145/3563766.3564102, - author = {Namyar, Pooria and Arzani, Behnaz and Beckett, Ryan and Segarra, Santiago and Raj, Himanshu and Kandula, Srikanth}, - title = {Minding the gap between fast heuristics and their optimal counterparts}, - booktitle = {Proceedings of the 21st ACM Workshop on Hot Topics in Networks}, - year = {2022} -} -``` - -## Who do I contact if I have questions -- Behnaz Arzani (bearzani@microsoft.com) -- Pooria Namyar (namyar@usc.edu) \ No newline at end of file diff --git a/MetaOptimize/MetaOptimize/SolverGurobi.cs b/MetaOptimize/SolverGurobi.cs similarity index 100% rename from MetaOptimize/MetaOptimize/SolverGurobi.cs rename to MetaOptimize/SolverGurobi.cs diff --git a/MetaOptimize/MetaOptimize/SolverZen.cs b/MetaOptimize/SolverZen.cs similarity index 100% rename from MetaOptimize/MetaOptimize/SolverZen.cs rename to MetaOptimize/SolverZen.cs diff --git a/MetaOptimize/MetaOptimize/Term.cs b/MetaOptimize/Term.cs similarity index 100% rename from MetaOptimize/MetaOptimize/Term.cs rename to MetaOptimize/Term.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/AdversarialInputSimplifier.cs b/MetaOptimize/TrafficEngineering/AdversarialInputSimplifier.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/AdversarialInputSimplifier.cs rename to MetaOptimize/TrafficEngineering/AdversarialInputSimplifier.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningEncoder.cs b/MetaOptimize/TrafficEngineering/DemandPinningEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningEncoder.cs rename to MetaOptimize/TrafficEngineering/DemandPinningEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningLinkNegativeException.cs b/MetaOptimize/TrafficEngineering/DemandPinningLinkNegativeException.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningLinkNegativeException.cs rename to MetaOptimize/TrafficEngineering/DemandPinningLinkNegativeException.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningQuantizedEncoder.cs b/MetaOptimize/TrafficEngineering/DemandPinningQuantizedEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/DemandPinningQuantizedEncoder.cs rename to MetaOptimize/TrafficEngineering/DemandPinningQuantizedEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/DirectDemandPinningEncoder.cs b/MetaOptimize/TrafficEngineering/DirectDemandPinningEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/DirectDemandPinningEncoder.cs rename to MetaOptimize/TrafficEngineering/DirectDemandPinningEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/ExpectedPopEncoder.cs b/MetaOptimize/TrafficEngineering/ExpectedPopEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/ExpectedPopEncoder.cs rename to MetaOptimize/TrafficEngineering/ExpectedPopEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/ModifiedDemandPinningQuantizedEncoder.cs b/MetaOptimize/TrafficEngineering/ModifiedDemandPinningQuantizedEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/ModifiedDemandPinningQuantizedEncoder.cs rename to MetaOptimize/TrafficEngineering/ModifiedDemandPinningQuantizedEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/PathType.cs b/MetaOptimize/TrafficEngineering/PathType.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/PathType.cs rename to MetaOptimize/TrafficEngineering/PathType.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/PopEncoder.cs b/MetaOptimize/TrafficEngineering/PopEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/PopEncoder.cs rename to MetaOptimize/TrafficEngineering/PopEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TEAdversarialInputGenerator.cs b/MetaOptimize/TrafficEngineering/TEAdversarialInputGenerator.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TEAdversarialInputGenerator.cs rename to MetaOptimize/TrafficEngineering/TEAdversarialInputGenerator.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TECombineHeuristicsEncoder.cs b/MetaOptimize/TrafficEngineering/TECombineHeuristicsEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TECombineHeuristicsEncoder.cs rename to MetaOptimize/TrafficEngineering/TECombineHeuristicsEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TEMaxFlowOptimalEncoder.cs b/MetaOptimize/TrafficEngineering/TEMaxFlowOptimalEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TEMaxFlowOptimalEncoder.cs rename to MetaOptimize/TrafficEngineering/TEMaxFlowOptimalEncoder.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TEMaxFlowOptimizationSolution.cs b/MetaOptimize/TrafficEngineering/TEMaxFlowOptimizationSolution.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TEMaxFlowOptimizationSolution.cs rename to MetaOptimize/TrafficEngineering/TEMaxFlowOptimizationSolution.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TEOptimizationEncoding.cs b/MetaOptimize/TrafficEngineering/TEOptimizationEncoding.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TEOptimizationEncoding.cs rename to MetaOptimize/TrafficEngineering/TEOptimizationEncoding.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/TEOptimizationSolution.cs b/MetaOptimize/TrafficEngineering/TEOptimizationSolution.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/TEOptimizationSolution.cs rename to MetaOptimize/TrafficEngineering/TEOptimizationSolution.cs diff --git a/MetaOptimize/MetaOptimize/TrafficEngineering/Topology.cs b/MetaOptimize/TrafficEngineering/Topology.cs similarity index 100% rename from MetaOptimize/MetaOptimize/TrafficEngineering/Topology.cs rename to MetaOptimize/TrafficEngineering/Topology.cs diff --git a/MetaOptimize/MetaOptimize/VariableType.cs b/MetaOptimize/VariableType.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VariableType.cs rename to MetaOptimize/VariableType.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/Bins.cs b/MetaOptimize/VectorBinPacking/Bins.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/Bins.cs rename to MetaOptimize/VectorBinPacking/Bins.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/FFDItemCentricEncoder.cs b/MetaOptimize/VectorBinPacking/FFDItemCentricEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/FFDItemCentricEncoder.cs rename to MetaOptimize/VectorBinPacking/FFDItemCentricEncoder.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/FFDItemCentricEncoderV2.cs b/MetaOptimize/VectorBinPacking/FFDItemCentricEncoderV2.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/FFDItemCentricEncoderV2.cs rename to MetaOptimize/VectorBinPacking/FFDItemCentricEncoderV2.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/FFDMethod.cs b/MetaOptimize/VectorBinPacking/FFDMethod.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/FFDMethod.cs rename to MetaOptimize/VectorBinPacking/FFDMethod.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/VBPAdversarialInputGenerator.cs b/MetaOptimize/VectorBinPacking/VBPAdversarialInputGenerator.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/VBPAdversarialInputGenerator.cs rename to MetaOptimize/VectorBinPacking/VBPAdversarialInputGenerator.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimalEncoder.cs b/MetaOptimize/VectorBinPacking/VBPOptimalEncoder.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimalEncoder.cs rename to MetaOptimize/VectorBinPacking/VBPOptimalEncoder.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimizationEncoding.cs b/MetaOptimize/VectorBinPacking/VBPOptimizationEncoding.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimizationEncoding.cs rename to MetaOptimize/VectorBinPacking/VBPOptimizationEncoding.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimizationSolution.cs b/MetaOptimize/VectorBinPacking/VBPOptimizationSolution.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/VBPOptimizationSolution.cs rename to MetaOptimize/VectorBinPacking/VBPOptimizationSolution.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/new/FFDItemCentricEncoderNew.cs b/MetaOptimize/VectorBinPacking/new/FFDItemCentricEncoderNew.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/new/FFDItemCentricEncoderNew.cs rename to MetaOptimize/VectorBinPacking/new/FFDItemCentricEncoderNew.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/new/VBPAdversarialInputGeneratorNew.cs b/MetaOptimize/VectorBinPacking/new/VBPAdversarialInputGeneratorNew.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/new/VBPAdversarialInputGeneratorNew.cs rename to MetaOptimize/VectorBinPacking/new/VBPAdversarialInputGeneratorNew.cs diff --git a/MetaOptimize/MetaOptimize/VectorBinPacking/new/VBPOptimalEncoderNew.cs b/MetaOptimize/VectorBinPacking/new/VBPOptimalEncoderNew.cs similarity index 100% rename from MetaOptimize/MetaOptimize/VectorBinPacking/new/VBPOptimalEncoderNew.cs rename to MetaOptimize/VectorBinPacking/new/VBPOptimalEncoderNew.cs diff --git a/MetaOptimize/build.yml b/MetaOptimize/build.yml deleted file mode 100644 index 64fe5897..00000000 --- a/MetaOptimize/build.yml +++ /dev/null @@ -1,26 +0,0 @@ -trigger: -- master -pool: - vmImage: 'windows-latest' - -steps: -- task: CredScan@2 - inputs: - toolMajorVersion: 'V3' - -- task: Semmle@1 - inputs: - sourceCodeDirectory: '$(Build.SourcesDirectory)//MetaOptimize' - language: 'csharp' - querySuite: 'Recommended' - timeout: '1800' - ram: '16384' - addProjectDirToScanningExclusionList: true - -schedules: -- cron: "0 0 * * 1" - displayName: Weekly build - branches: - include: - - master - always: true diff --git a/MetaOptimize/MetaOptimize/utils.cs b/MetaOptimize/utils.cs similarity index 100% rename from MetaOptimize/MetaOptimize/utils.cs rename to MetaOptimize/utils.cs diff --git a/README.md b/README.md index 5cd7cecf..9ec1c751 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,87 @@ -# Project +# MetaOpt: Examining, explaining, and improving heuristic performance -> This repo has been populated by an initial template to help get you started. Please -> make sure to update the content to build a great experience for community-building. +`MetaOpt` is the first general-purpose and scalable tool that enables users to analyze a broad class of heuristics through easy-to-use abstractions that apply to a broad range of practical heuristics. For more information, checkout [MetaOpt's project webpage](https://www.microsoft.com/en-us/research/project/finding-adversarial-inputs-for-heuristics/overview/) and our NSDI'24 paper ([Finding Adversarial Inputs for Heuristics using Multi-level Optimization](https://arxiv.org/abs/2311.12779)). -As the maintainer of this project, please make a few updates: -- Improving this README.MD file to provide a great experience -- Updating SUPPORT.MD with content about this project's support experience -- Understanding the security reporting process in SECURITY.MD -- Remove this section from the README +## Code Structure +``` +├── MetaOptimize # Implementation of all the main components of MetaOpt. +| | # (helper functions, solver APIs, rewrites, etc.) +| | +| ├── TrafficEngineering # implementation of TE encoders (OPT, DP, and POP) +| | # and TE adversarial generator. +| | +| ├── VectorBinPacking # implementation of VBP encoders (OPT and variants of FF) +| | # and VBP adversarial generator. +| | +| └── PIFO # implementation of PIFO, SP-PIFO, and AIFO encoders. +| +| +├── MetaOptimize.Cli # examples and scripts to reproduce the results in +| # our NSDI24 and HotNet22 papers. +| +└── MetaOptimize.Test # testcases for MetaOpt. +``` + +## Getting Started + +We provide multiple example Main functions that you can try in `MetaOptimize.Cli/Program.cs` for different heuristics in vector bin packing, packet scheduling, and traffic engineering. + +We also provide many unit-tests that can serve as a starting point in `MetaOptimize.Test`. + +You can use MetaOpt either with the [Gurobi optimization solver](https://www.gurobi.com/documentation/current/examples/cs_examples.html) +or with [Zen](https://dl.acm.org/doi/10.1145/3422604.3425930). +Make sure you install both solvers and configure the proper Gurobi license. If you are in academia, you can follow the instructions on Gurobi's website to obtain a license. + +## Analyzing heuristics using MetaOpt + +

+ +

+ + +If you would like to analyze a heuristic that we have not modeled as part of MetaOpt yet, here are the steps to follow: + +1- Model your heuristic as either a convex optimization problem or a feasibility problem which our solvers can support. +How you model the problem is important and can significantly influence MetaOpt's ability to scale (and also whether Gurobi can run into +numerical issues). If you run into trouble with this step, feel free to contact the MetaOpt authors at: namyar@usc.edu and bearzani@microsoft.com. + +2- You need to write an `Encoder` library for both the heuristic you want to analyze and the optimal form of the problem (or if you want to compare two heuristics, for the other heuristics). +We strongly recommend looking at the Traffic Engineering, VBP, and packet scheduling Encoders we have provided as part of the MetaOpt code-base for examples. +Encoders must meet the specifications in the `IEncoder.cs` library. +If your problem is a convex optimization problem (and NOT a feasibility problem), you also need to pick the type of re-write you want to use (`KKT` or `quantized primal dual`). +We recommend the quantized primal dual approach to achieve better scalability. + +To use the quantized primal dual approach, you also need to specify the quantization levels. + +3- Once you have both of the encoders in place, you have to write an adversarial input generator. See the `TE` and `VBP` folders for examples. +To solve the MetaOpt problem, you need to create the `input variables` in the adversarial input generator and pass the SAME input variables to the encoders +for the algorithms you want to analyze. +Also notice that the adversarial input generator and the two encoders need to use the same solver instance. + +To see examples of this workflow, we highly recommend looking at the test cases in `MetaOptimize.Test`. + +## Citations +Refer to the following two papers for more information: +```bibtex +@inproceedings{metaopt, + author = {Namyar, Pooria and Arzani, Behnaz and Beckett, Ryan and Segarra, Santiago and Raj, Himanshu and Krishnaswamy, Umesh and Govindan, Ramesh and Kandula, Srikanth}, + title = {{F}inding {A}dversarial {I}nputs for {H}euristics using + {M}ulti-level {O}ptimization}, + booktitle = {21st USENIX Symposium on Networked Systems Design and + Implementation (NSDI 24)}, + year = {2024}, +} +``` + +```bibtex +@inproceedings{10.1145/3563766.3564102, + author = {Namyar, Pooria and Arzani, Behnaz and Beckett, Ryan and Segarra, Santiago and Raj, Himanshu and Kandula, Srikanth}, + title = {Minding the gap between fast heuristics and their optimal counterparts}, + booktitle = {Proceedings of the 21st ACM Workshop on Hot Topics in Networks}, + year = {2022} +} +``` ## Contributing @@ -31,3 +104,8 @@ trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies. + +## Contacts +You can reach out to us with any questions: +- Behnaz Arzani (bearzani@microsoft.com) +- Pooria Namyar (namyar@usc.edu) diff --git a/MetaOptimize/Topologies/Cogentco.json b/Topologies/Cogentco.json similarity index 100% rename from MetaOptimize/Topologies/Cogentco.json rename to Topologies/Cogentco.json diff --git a/MetaOptimize/Topologies/GtsCe.json b/Topologies/GtsCe.json similarity index 100% rename from MetaOptimize/Topologies/GtsCe.json rename to Topologies/GtsCe.json diff --git a/MetaOptimize/Topologies/Kdl.json b/Topologies/Kdl.json similarity index 100% rename from MetaOptimize/Topologies/Kdl.json rename to Topologies/Kdl.json diff --git a/MetaOptimize/Topologies/Uninet2010.json b/Topologies/Uninet2010.json similarity index 100% rename from MetaOptimize/Topologies/Uninet2010.json rename to Topologies/Uninet2010.json diff --git a/MetaOptimize/Topologies/abilene.json b/Topologies/abilene.json similarity index 100% rename from MetaOptimize/Topologies/abilene.json rename to Topologies/abilene.json diff --git a/MetaOptimize/Topologies/analyze_topo.py b/Topologies/analyze_topo.py similarity index 100% rename from MetaOptimize/Topologies/analyze_topo.py rename to Topologies/analyze_topo.py diff --git a/MetaOptimize/Topologies/b4-teavar.json b/Topologies/b4-teavar.json similarity index 100% rename from MetaOptimize/Topologies/b4-teavar.json rename to Topologies/b4-teavar.json diff --git a/MetaOptimize/Topologies/bottleneck-dumbell.json b/Topologies/bottleneck-dumbell.json similarity index 100% rename from MetaOptimize/Topologies/bottleneck-dumbell.json rename to Topologies/bottleneck-dumbell.json diff --git a/MetaOptimize/Topologies/bottleneck.json b/Topologies/bottleneck.json similarity index 100% rename from MetaOptimize/Topologies/bottleneck.json rename to Topologies/bottleneck.json diff --git a/MetaOptimize/Topologies/dumbell-bottleneck.json b/Topologies/dumbell-bottleneck.json similarity index 100% rename from MetaOptimize/Topologies/dumbell-bottleneck.json rename to Topologies/dumbell-bottleneck.json diff --git a/MetaOptimize/Topologies/ext/modularity/.gitignore b/Topologies/ext/modularity/.gitignore similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/.gitignore rename to Topologies/ext/modularity/.gitignore diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/.gitignore b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/.gitignore similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/.gitignore rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/.gitignore diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/Makefile b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/Makefile similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/Makefile rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/Makefile diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/fastcommunity_w_mh.cc b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/fastcommunity_w_mh.cc similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/fastcommunity_w_mh.cc rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/fastcommunity_w_mh.cc diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/maxheap.h b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/maxheap.h similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/maxheap.h rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/maxheap.h diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1-fc_test1.wpairs b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1-fc_test1.wpairs similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1-fc_test1.wpairs rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1-fc_test1.wpairs diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1.wpairs b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1.wpairs similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1.wpairs rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test1.wpairs diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2-fc_t2.wpairs b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2-fc_t2.wpairs similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2-fc_t2.wpairs rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2-fc_t2.wpairs diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2.wpairs b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2.wpairs similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2.wpairs rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/test2.wpairs diff --git a/MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/vektor.h b/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/vektor.h similarity index 100% rename from MetaOptimize/Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/vektor.h rename to Topologies/ext/modularity/FastCommunity_w_GPL_v1.0.1/vektor.h diff --git a/MetaOptimize/Topologies/feasible1.json b/Topologies/feasible1.json similarity index 100% rename from MetaOptimize/Topologies/feasible1.json rename to Topologies/feasible1.json diff --git a/MetaOptimize/Topologies/networks.py b/Topologies/networks.py similarity index 100% rename from MetaOptimize/Topologies/networks.py rename to Topologies/networks.py diff --git a/MetaOptimize/Topologies/outputs/paths/Cogentco_2sp.json b/Topologies/outputs/paths/Cogentco_2sp.json similarity index 100% rename from MetaOptimize/Topologies/outputs/paths/Cogentco_2sp.json rename to Topologies/outputs/paths/Cogentco_2sp.json diff --git a/MetaOptimize/Topologies/outputs/paths/b4-teavar_2.json b/Topologies/outputs/paths/b4-teavar_2.json similarity index 100% rename from MetaOptimize/Topologies/outputs/paths/b4-teavar_2.json rename to Topologies/outputs/paths/b4-teavar_2.json diff --git a/MetaOptimize/Topologies/parse_and_convert_graphml.py b/Topologies/parse_and_convert_graphml.py similarity index 100% rename from MetaOptimize/Topologies/parse_and_convert_graphml.py rename to Topologies/parse_and_convert_graphml.py diff --git a/MetaOptimize/Topologies/partition_network.py b/Topologies/partition_network.py similarity index 100% rename from MetaOptimize/Topologies/partition_network.py rename to Topologies/partition_network.py diff --git a/MetaOptimize/Topologies/partitioning/abstract_partitioning_method.py b/Topologies/partitioning/abstract_partitioning_method.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/abstract_partitioning_method.py rename to Topologies/partitioning/abstract_partitioning_method.py diff --git a/MetaOptimize/Topologies/partitioning/fm_partitioning.py b/Topologies/partitioning/fm_partitioning.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/fm_partitioning.py rename to Topologies/partitioning/fm_partitioning.py diff --git a/MetaOptimize/Topologies/partitioning/leader_election.py b/Topologies/partitioning/leader_election.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/leader_election.py rename to Topologies/partitioning/leader_election.py diff --git a/MetaOptimize/Topologies/partitioning/leader_election_uniform.py b/Topologies/partitioning/leader_election_uniform.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/leader_election_uniform.py rename to Topologies/partitioning/leader_election_uniform.py diff --git a/MetaOptimize/Topologies/partitioning/spectral_clustering.py b/Topologies/partitioning/spectral_clustering.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/spectral_clustering.py rename to Topologies/partitioning/spectral_clustering.py diff --git a/MetaOptimize/Topologies/partitioning/utils.py b/Topologies/partitioning/utils.py similarity index 100% rename from MetaOptimize/Topologies/partitioning/utils.py rename to Topologies/partitioning/utils.py diff --git a/MetaOptimize/Topologies/ring_20.json b/Topologies/ring_20.json similarity index 100% rename from MetaOptimize/Topologies/ring_20.json rename to Topologies/ring_20.json diff --git a/MetaOptimize/Topologies/ring_200.json b/Topologies/ring_200.json similarity index 100% rename from MetaOptimize/Topologies/ring_200.json rename to Topologies/ring_200.json diff --git a/MetaOptimize/Topologies/ring_400.json b/Topologies/ring_400.json similarity index 100% rename from MetaOptimize/Topologies/ring_400.json rename to Topologies/ring_400.json diff --git a/MetaOptimize/Topologies/swan.json b/Topologies/swan.json similarity index 100% rename from MetaOptimize/Topologies/swan.json rename to Topologies/swan.json diff --git a/MetaOptimize/Topologies/toy-network-2.json b/Topologies/toy-network-2.json similarity index 100% rename from MetaOptimize/Topologies/toy-network-2.json rename to Topologies/toy-network-2.json diff --git a/MetaOptimize/Topologies/toy-network-3.json b/Topologies/toy-network-3.json similarity index 100% rename from MetaOptimize/Topologies/toy-network-3.json rename to Topologies/toy-network-3.json diff --git a/MetaOptimize/Topologies/toy-network.json b/Topologies/toy-network.json similarity index 100% rename from MetaOptimize/Topologies/toy-network.json rename to Topologies/toy-network.json diff --git a/MetaOptimize/Topologies/two-srcs.json b/Topologies/two-srcs.json similarity index 100% rename from MetaOptimize/Topologies/two-srcs.json rename to Topologies/two-srcs.json diff --git a/MetaOptimize/Topologies/verify_demand.py b/Topologies/verify_demand.py similarity index 100% rename from MetaOptimize/Topologies/verify_demand.py rename to Topologies/verify_demand.py diff --git a/MetaOptimize/metaopt_workflow.png b/figures/metaopt_workflow.png similarity index 100% rename from MetaOptimize/metaopt_workflow.png rename to figures/metaopt_workflow.png diff --git a/MetaOptimize/parsers/demand_pinning_num_paths_sweep.ipynb b/parsers/demand_pinning_num_paths_sweep.ipynb similarity index 100% rename from MetaOptimize/parsers/demand_pinning_num_paths_sweep.ipynb rename to parsers/demand_pinning_num_paths_sweep.ipynb diff --git a/MetaOptimize/parsers/demand_pinning_threshold_sweep.ipynb b/parsers/demand_pinning_threshold_sweep.ipynb similarity index 100% rename from MetaOptimize/parsers/demand_pinning_threshold_sweep.ipynb rename to parsers/demand_pinning_threshold_sweep.ipynb diff --git a/MetaOptimize/parsers/demand_pinning_topology_sweep.ipynb b/parsers/demand_pinning_topology_sweep.ipynb similarity index 100% rename from MetaOptimize/parsers/demand_pinning_topology_sweep.ipynb rename to parsers/demand_pinning_topology_sweep.ipynb diff --git a/MetaOptimize/parsers/expected_pop.ipynb b/parsers/expected_pop.ipynb similarity index 100% rename from MetaOptimize/parsers/expected_pop.ipynb rename to parsers/expected_pop.ipynb diff --git a/MetaOptimize/parsers/gap_vs_time.ipynb b/parsers/gap_vs_time.ipynb similarity index 100% rename from MetaOptimize/parsers/gap_vs_time.ipynb rename to parsers/gap_vs_time.ipynb diff --git a/MetaOptimize/parsers/pop_varying_paths_partitions.ipynb b/parsers/pop_varying_paths_partitions.ipynb similarity index 100% rename from MetaOptimize/parsers/pop_varying_paths_partitions.ipynb rename to parsers/pop_varying_paths_partitions.ipynb diff --git a/MetaOptimize/parsers/problem_topo_latency.ipynb b/parsers/problem_topo_latency.ipynb similarity index 100% rename from MetaOptimize/parsers/problem_topo_latency.ipynb rename to parsers/problem_topo_latency.ipynb From 1fc0d54a56692b3d6c00963631fb6545fbed111e Mon Sep 17 00:00:00 2001 From: PooriaNamyar Date: Tue, 2 Apr 2024 08:52:31 +0000 Subject: [PATCH 3/7] minor clean up --- .github/workflows/dotnet.yml | 2 -- README.md | 9 ++++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 9f3d9fb0..6c1a12fe 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -24,5 +24,3 @@ jobs: run: dotnet restore - name: Build run: dotnet build --no-restore - - name: Test - run: dotnet test --no-build --verbosity normal diff --git a/README.md b/README.md index 9ec1c751..ba5dd6fe 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,14 @@ ├── MetaOptimize.Cli # examples and scripts to reproduce the results in | # our NSDI24 and HotNet22 papers. | -└── MetaOptimize.Test # testcases for MetaOpt. +├── MetaOptimize.Test # testcases for MetaOpt. +| +├── parsers # codes for parsing the log files +| # and ploting some of the results. +| +└── Topologies # topologies for our TE experiments. + + ``` ## Getting Started From b240e086ca748e90ec6a96568664c43d6b099474 Mon Sep 17 00:00:00 2001 From: PooriaNamyar Date: Tue, 2 Apr 2024 08:52:31 +0000 Subject: [PATCH 4/7] minor clean up --- .github/workflows/dotnet.yml | 2 -- README.md | 9 ++++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 9f3d9fb0..6c1a12fe 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -24,5 +24,3 @@ jobs: run: dotnet restore - name: Build run: dotnet build --no-restore - - name: Test - run: dotnet test --no-build --verbosity normal diff --git a/README.md b/README.md index 9ec1c751..ba5dd6fe 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,14 @@ ├── MetaOptimize.Cli # examples and scripts to reproduce the results in | # our NSDI24 and HotNet22 papers. | -└── MetaOptimize.Test # testcases for MetaOpt. +├── MetaOptimize.Test # testcases for MetaOpt. +| +├── parsers # codes for parsing the log files +| # and ploting some of the results. +| +└── Topologies # topologies for our TE experiments. + + ``` ## Getting Started From ba3a926cf8944fb86aff2298fcb681d4f259fcd3 Mon Sep 17 00:00:00 2001 From: Behnaz Arzani Date: Tue, 2 Apr 2024 09:38:47 -0700 Subject: [PATCH 5/7] committing new mainEntry file --- MetaOptimize.Cli/MainEntry.cs | 608 +++++++++++++++++++++++ MetaOptimize.Cli/MetaOptimize.Cli.csproj | 1 + 2 files changed, 609 insertions(+) create mode 100644 MetaOptimize.Cli/MainEntry.cs diff --git a/MetaOptimize.Cli/MainEntry.cs b/MetaOptimize.Cli/MainEntry.cs new file mode 100644 index 00000000..fb63e8dd --- /dev/null +++ b/MetaOptimize.Cli/MainEntry.cs @@ -0,0 +1,608 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// + +namespace MetaOptimize.Cli +{ + using System; + using System.Diagnostics; + using CommandLine; + using Gurobi; + using MetaOptimize; + using ZenLib; + + /// + /// Main entry point for the program. + /// + public class MainEntry + { + /// + /// checks whether we get the solution we expect after running the solvers. + /// + /// + public static void TEExampleMain(string[] args) + { + var topology = new Topology(); + topology.AddNode("a"); + topology.AddNode("b"); + topology.AddNode("c"); + topology.AddNode("d"); + topology.AddEdge("a", "b", capacity: 10); + topology.AddEdge("a", "c", capacity: 10); + topology.AddEdge("b", "d", capacity: 10); + topology.AddEdge("c", "d", capacity: 10); + + var partition = topology.RandomPartition(2); + // create the optimal encoder. + var solverG = new GurobiSOS(); + var optimalEncoderG = new TEMaxFlowOptimalEncoder(solverG, maxNumPaths: 1); + var popEncoderG = new PopEncoder(solverG, maxNumPaths: 1, numPartitions: 2, demandPartitions: partition); + var adversarialInputGenerator = new TEAdversarialInputGenerator(topology, maxNumPaths: 1); + + var (optimalSolutionG, popSolutionG) = adversarialInputGenerator.MaximizeOptimalityGap(optimalEncoderG, popEncoderG); + Console.WriteLine("Optimal:"); + Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimalSolutionG, Newtonsoft.Json.Formatting.Indented)); + Console.WriteLine("****"); + Console.WriteLine("Heuristic:"); + Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(popSolutionG, Newtonsoft.Json.Formatting.Indented)); + Console.WriteLine("****"); + + var optimal = optimalSolutionG.MaxObjective; + var heuristic = popSolutionG.MaxObjective; + Console.WriteLine($"optimalG={optimal}, heuristicG={heuristic}"); + + var demands = new Dictionary<(string, string), double>(optimalSolutionG.Demands); + var optGSolver = new GurobiSOS(); + optimalEncoderG = new TEMaxFlowOptimalEncoder(optGSolver, maxNumPaths: 1); + var popGSolver = new GurobiSOS(); + popEncoderG = new PopEncoder(popGSolver, maxNumPaths: 1, numPartitions: 2, demandPartitions: partition); + Utils.checkSolution(topology, popEncoderG, optimalEncoderG, heuristic, optimal, demands, "gurobiCheck"); + } + + /// + /// Use this function to test our theorem for VBP. + /// (see theorem 1 in our NSDI24 Paper). + /// + public static void vbpMain(string[] args) + { + // OPT = 2m + 3n + // HUE = 4m + 6n + // num jobs = 6m + 9n + var solverG = new GurobiSOS(verbose: 0); + + for (int m = 1; m < 10; m++) + { + for (int n = 0; n < 2; n++) + { + Console.WriteLine(String.Format("============ m = {0}, n = {1}", m, n)); + var binSize = new List(); + binSize.Add(1.0001); + binSize.Add(1.0001); + var bins = new Bins(4 * m + 6 * n, binSize); + // TODO: need to change var name to be appropriate for the problem. + var demands = new Dictionary>(); + int nxt_key = 0; + + // TODO: need a comment that describes what the constants are here. you also may benefit from changing the constants to have a name. + for (int i = 0; i < m; i++) + { + demands[nxt_key] = new List() { 0.92, 0.0 }; + nxt_key += 1; + } + for (int i = 0; i < m; i++) + { + demands[nxt_key] = new List() { 0.91, 0.01 }; + nxt_key += 1; + } + for (int i = 0; i < n; i++) + { + demands[nxt_key] = new List() { 0.48, 0.2 }; + nxt_key += 1; + } + for (int i = 0; i < n; i++) + { + demands[nxt_key] = new List() { 0.68, 0 }; + nxt_key += 1; + } + for (int i = 0; i < n; i++) + { + demands[nxt_key] = new List() { 0.52, 0.12 }; + nxt_key += 1; + } + for (int i = 0; i < n; i++) + { + demands[nxt_key] = new List() { 0.32, 0.32 }; + nxt_key += 1; + } + for (int i = 0; i < n; i++) + { + demands[nxt_key] = new List() { 0.19, 0.45 }; + nxt_key += 1; + demands[nxt_key] = new List() { 0.42, 0.22 }; + nxt_key += 1; + } + for (int i = 0; i < n; i++) + { + demands[nxt_key] = new List() { 0.1, 0.54 }; + nxt_key += 1; + demands[nxt_key] = new List() { 0.1, 0.54 }; + nxt_key += 1; + } + for (int i = 0; i < n; i++) + { + demands[nxt_key] = new List() { 0.1, 0.53 }; + nxt_key += 1; + } + for (int i = 0; i < m; i++) + { + demands[nxt_key] = new List() { 0.06, 0.48 }; + nxt_key += 1; + } + for (int i = 0; i < m; i++) + { + demands[nxt_key] = new List() { 0.07, 0.47 }; + nxt_key += 1; + } + for (int i = 0; i < m; i++) + { + demands[nxt_key] = new List() { 0.01, 0.53 }; + nxt_key += 1; + } + for (int i = 0; i < m; i++) + { + demands[nxt_key] = new List() { 0.03, 0.51 }; + nxt_key += 1; + } + for (int i = 0; i < demands.Count - 1; i++) + { + double total_sum_1 = 0; + double total_sum_2 = 0; + for (int j = 0; j < demands[0].Count; j++) + { + total_sum_1 += demands[i][j]; + total_sum_2 += demands[i + 1][j]; + } + Debug.Assert(total_sum_1 >= total_sum_2 - 0.00001); + } + solverG.CleanAll(); + var optimalEncoder = new VBPOptimalEncoder(solverG, demands.Count, demands[0].Count); + var optimalEncoding = optimalEncoder.Encoding(bins, inputEqualityConstraints: demands, verbose: false); + var solverSolutionOptimal = optimalEncoder.Solver.Maximize(optimalEncoding.MaximizationObjective); + var optimizationSolutionOptimal = (VBPOptimizationSolution)optimalEncoder.GetSolution(solverSolutionOptimal); + Console.WriteLine( + String.Format("===== OPT {0}", optimizationSolutionOptimal.TotalNumBinsUsed)); + + solverG.CleanAll(); + var ffdEncoder = new FFDItemCentricEncoder(solverG, demands.Count, demands[0].Count); + var ffdEncoding = ffdEncoder.Encoding(bins, inputEqualityConstraints: demands, verbose: false); + var solverSolutionFFD = optimalEncoder.Solver.Maximize(ffdEncoding.MaximizationObjective); + var solutionFFD = (VBPOptimizationSolution)ffdEncoder.GetSolution(solverSolutionFFD); + Console.WriteLine( + String.Format("===== HUE {0}", solutionFFD.TotalNumBinsUsed)); + Debug.Assert(optimizationSolutionOptimal.TotalNumBinsUsed * 2 == solutionFFD.TotalNumBinsUsed); + } + } + } + + /// + /// test MetaOpt on VBP. + /// + /// TODO: specify how this function is different from the previous. + public static void Main(string[] args) + { + var binSize = new List(); + binSize.Add(1.00001); + binSize.Add(1.00001); + var bins = new Bins(6, binSize); + var numDemands = 9; + var numDimensions = 2; + var optimalBins = 3; + var ffdMethod = FFDMethodChoice.FFDSum; + List> demandList = null; + double perIterationTimeout = 1000; + // double perIterationTimeout = double.PositiveInfinity; + var solverG = new GurobiSOS(timeout: perIterationTimeout, verbose: 1); + var optimalEncoder = new VBPOptimalEncoder(solverG, numDemands, numDimensions, BreakSymmetry: false); + var ffdEncoder = new FFDItemCentricEncoder(solverG, numDemands, numDimensions); + var adversarialGenerator = new VBPAdversarialInputGenerator(bins, numDemands, numDimensions); + var (optimalSolutionG, ffdSolutionG) = adversarialGenerator.MaximizeOptimalityGapFFD(optimalEncoder, ffdEncoder, + optimalBins, ffdMethod: ffdMethod, itemList: demandList, verbose: true); + Console.WriteLine("Optimal:"); + Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimalSolutionG, Newtonsoft.Json.Formatting.Indented)); + Console.WriteLine("****"); + Console.WriteLine("Heuristic:"); + Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(ffdSolutionG, Newtonsoft.Json.Formatting.Indented)); + Console.WriteLine("****"); + Console.WriteLine("Optimal number of bins: " + optimalSolutionG.TotalNumBinsUsed); + Console.WriteLine("FFD number of bins: " + ffdSolutionG.TotalNumBinsUsed); + } + + /// + /// test case for SP-PIFO. + /// + public static void PIFOTestMain(string[] args) + { + int maxRank = 8; + int numPackets = 15; + int numQueues = 4; + int splitQueue = 2; + int splitRank = 5; + var solverG = new GurobiSOS(verbose: 0); + + var packetRankEqualityConstraint = new Dictionary(); + packetRankEqualityConstraint[0] = 7; + packetRankEqualityConstraint[1] = 2; + packetRankEqualityConstraint[2] = 1; + packetRankEqualityConstraint[3] = 0; + packetRankEqualityConstraint[4] = 7; + packetRankEqualityConstraint[5] = 7; + packetRankEqualityConstraint[6] = 2; + packetRankEqualityConstraint[7] = 1; + packetRankEqualityConstraint[8] = 0; + packetRankEqualityConstraint[9] = 2; + packetRankEqualityConstraint[10] = 1; + packetRankEqualityConstraint[11] = 0; + packetRankEqualityConstraint[12] = 2; + packetRankEqualityConstraint[13] = 1; + packetRankEqualityConstraint[14] = 0; + solverG.CleanAll(); + var optimalEncoder = new PIFOAvgDelayOptimalEncoder(solverG, numPackets, maxRank); + var optimalEncoding = optimalEncoder.Encoding(rankEqualityConstraints: packetRankEqualityConstraint); + var solverSolutionOptimal = optimalEncoder.Solver.Maximize(optimalEncoding.MaximizationObjective); + var optimizationSolutionOptimal = (PIFOOptimizationSolution)optimalEncoder.GetSolution(solverSolutionOptimal); + Console.WriteLine("Optimal:"); + Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimizationSolutionOptimal, Newtonsoft.Json.Formatting.Indented)); + Console.WriteLine("****"); + Console.WriteLine("===== OPT {0}", optimizationSolutionOptimal.Cost); + + solverG.CleanAll(); + var heuristicEncoder = new ModifiedSPPIFOAvgDelayEncoder(solverG, numPackets, splitQueue, numQueues, splitRank, maxRank); + var heuristicEncoding = heuristicEncoder.Encoding(rankEqualityConstraints: packetRankEqualityConstraint); + var solverSolutionHeuristic = optimalEncoder.Solver.Maximize(heuristicEncoding.MaximizationObjective); + var solutionHeuristic = (PIFOOptimizationSolution)heuristicEncoder.GetSolution(solverSolutionHeuristic); + Console.WriteLine("Heuristic:"); + Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(solutionHeuristic, Newtonsoft.Json.Formatting.Indented)); + Console.WriteLine("****"); + Console.WriteLine("===== HUE {0}", solutionHeuristic.Cost); + } + + /// + /// test MetaOpt on PIFO. + /// + public static void PIFOMain(string[] args) + { + int maxRank = 8; + int numPackets = 18; + int numQueues = 4; + // int splitQueue = 2; + // int splitRank = 4; + int maxQueueSize = 12; + int windowSize = 12; + double burstParam = 0.1; + + var solverG = new GurobiSOS(verbose: 1, timeout: 1000); + // var optimalEncoder = new PIFOAvgDelayOptimalEncoder(solverG, numPackets, maxRank); + // var heuristicEncoder = new SPPIFOAvgDelayEncoder(solverG, numPackets, numQueues, maxRank); + // var optimalEncoder = new SPPIFOAvgDelayEncoder(solverG, numPackets, numQueues, maxRank); + // var heuristicEncoder = new ModifiedSPPIFOAvgDelayEncoder(solverG, numPackets, splitQueue, numQueues, + // splitRank, maxRank); + // var optimalEncoder = new PIFOWithDropAvgDelayEncoder(solverG, numPackets, maxRank, maxQueueSize); + var H1 = new SPPIFOWithDropAvgDelayEncoder(solverG, numPackets, numQueues, maxRank, maxQueueSize); + var H2 = new AIFOAvgDelayEncoder(solverG, numPackets, maxRank, maxQueueSize, windowSize, burstParam); + + var adversarialGenerator = new PIFOAdversarialInputGenerator(numPackets, maxRank); + var (optimalSolutionG, heuristicSolutionG) = adversarialGenerator.MaximizeOptimalityGap(H1, + H2, verbose: true); + Console.WriteLine("Optimal:"); + Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimalSolutionG, Newtonsoft.Json.Formatting.Indented)); + Console.WriteLine("****"); + Console.WriteLine("Heuristic:"); + Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(heuristicSolutionG, Newtonsoft.Json.Formatting.Indented)); + Console.WriteLine("****"); + Console.WriteLine("Optimal cost: " + optimalSolutionG.Cost); + Console.WriteLine("Heuristic cost: " + heuristicSolutionG.Cost); + + var orderToRankOpt = new Dictionary(); + var orderToRankHeu = new Dictionary(); + for (int pid = 0; pid < numPackets; pid++) { + if (optimalSolutionG.Admit[pid] == 1) { + orderToRankOpt[optimalSolutionG.Order[pid]] = optimalSolutionG.Ranks[pid]; + } + if (heuristicSolutionG.Admit[pid] == 1) { + orderToRankHeu[heuristicSolutionG.Order[pid]] = heuristicSolutionG.Ranks[pid]; + } + } + + int numInvOpt = 0; + int numInvHeu = 0; + for (int pid = 0; pid < numPackets; pid++) + { + numInvOpt += ComputeInversionNum(optimalSolutionG, orderToRankOpt, pid); + numInvHeu += ComputeInversionNum(heuristicSolutionG, orderToRankHeu, pid); + } + Console.WriteLine("number of inversions in OPT: " + numInvOpt); + Console.WriteLine("number of inversions in HEU: " + numInvHeu); + } + + private static int ComputeInversionNum(PIFOOptimizationSolution optimalSolutionG, Dictionary orderToRankOpt, int pid) + { + int numInvOpt = 0; + if (optimalSolutionG.Admit[pid] >= 0.98) + { + int currOrder = optimalSolutionG.Order[pid]; + for (int prev = 0; prev < currOrder; prev++) + { + if (orderToRankOpt[prev] > optimalSolutionG.Ranks[pid]) + { + numInvOpt += 1; + } + } + } + else + { + foreach (var (order, rank) in orderToRankOpt) + { + if (rank > optimalSolutionG.Ranks[pid]) + { + numInvOpt += 1; + } + } + } + + return numInvOpt; + } + + /// + /// Experiments for NSDI. + /// + public static void NSDIMain(string[] args) + { + // NSDIExp.compareGapDelayDiffMethodsDP(); + // NSDIExp.compareLargeScaleGapDelayDiffMethodsDP(); + // NSDIExp.compareGapDelayDiffMethodsPop(); + // NSDIExp.AblationStudyClusteringOnDP(); + // NSDIExp.BlackBoxParameterTunning(); + NSDIExp.AddRealisticConstraintsDP(); + // NSDIExp.gapThresholdDemandPinningForDifferentTopologies(); + // NSDIExp.ImpactNumPathsPartitionsExpectedPop(); + // NSDIExp.AblationStudyClusteringOnDP(); + // NSDIExp.BlackBoxParameterTunning(); + // NSDIExp.AnalyzeModifiedDP(); + // NSDIExp.ImpactNumNodesRadixSmallWordTopoDemandPinning(); + // NSDIExp.ImpactNumSamplesExpectedPop(); + // NSDIExp.AnalyzeParallelHeuristics(); + } + + /// + /// Experiments for hotnets. + /// + public static void hotnetsMain(string[] args) + { + // var topology = Topology.RandomRegularGraph(8, 7, 1, seed: 0); + // var topology = Topology.SmallWordGraph(5, 4, 1); + // foreach (var edge in topology.GetAllEdges()) { + // Console.WriteLine(edge.Source + "_" + edge.Target); + // } + // foreach (var pair in topology.GetNodePairs()) { + // if (!topology.ContaintsEdge(pair.Item1, pair.Item2, 1)) { + // Console.WriteLine("missing link " + pair.Item1 + " " + pair.Item2); + // } + // } + // Experiment.printPaths(); + // HotNetsExperiment.impactOfDPThresholdOnGap(); + // Experiment.ImpactNumPathsDemandPinning(); + // Experiment.ImpactNumNodesRadixRandomRegularGraphDemandPinning(); + HotNetsExperiment.impactSmallWordGraphParamsDP(); + // Experiment.ImpactNumPathsPartitionsPop(); + // Experiment.compareGapDelayDiffMethodsPop(); + // Experiment.compareGapDelayDiffMethodsDP(); + // Experiment.compareTopoSizeLatency(); + } + + /// + /// Main entry point for the program. + /// The function takes the command line arguments and stores them in a + /// static instance property of the CliOptions class. + /// It then reads the topology and clusters from the files specified in the + /// command line arguments and then proceeds to find the optimality gap. + /// + /// The arguments. + public static void ssMain(string[] args) + { + // read the command line arguments. + var opts = CommandLine.Parser.Default.ParseArguments(args).MapResult(o => o, e => null); + CliOptions.Instance = opts; + + if (opts == null) + { + Environment.Exit(0); + } + + // read the topology and clusters. + var (topology, clusters) = CliUtils.getTopology(opts.TopologyFile, opts.PathFile, opts.DownScaleFactor, opts.EnableClustering, + opts.NumClusters, opts.ClusterDir, opts.Verbose); + + getSolverAndRunNetwork(topology, clusters); + } + + // TODO: this function is missing proper commenting + private static void getSolverAndRunNetwork(Topology topology, List clusters) + { + var opts = CliOptions.Instance; + // use the Z3 solver via the Zen wrapper library. + switch (opts.SolverChoice) + { + case SolverChoice.Zen: + // run the zen optimizer. + RunNetwork(new SolverZen(), topology, clusters); + break; + case SolverChoice.Gurobi: + var storeProgress = opts.StoreProgress & (opts.Method == MethodChoice.Direct); + if (opts.Heuristic == Heuristic.DemandPinning) + { + RunNetwork(new GurobiSOS(opts.Timeout, Convert.ToInt32(opts.Verbose), + timeToTerminateNoImprovement: opts.TimeToTerminateIfNoImprovement, + numThreads: opts.NumGurobiThreads, + recordProgress: storeProgress, + logPath: opts.LogFile), + topology, clusters); + } + else + { + RunNetwork(new GurobiSOS(opts.Timeout, Convert.ToInt32(opts.Verbose), + timeToTerminateNoImprovement: opts.TimeToTerminateIfNoImprovement, + numThreads: opts.NumGurobiThreads, + recordProgress: storeProgress, + logPath: opts.LogFile), + topology, clusters); + } + break; + default: + throw new Exception("Other solvers are currently invalid."); + } + } + + // TODO: this function is missing proper commenting + private static void RunNetwork(ISolver solver, + Topology topology, List clusters) + { + var opts = CliOptions.Instance; + + // setup the optimal encoder and adversarial input generator. + var optimalEncoder = new TEMaxFlowOptimalEncoder(solver, opts.Paths); + TEAdversarialInputGenerator adversarialInputGenerator; + adversarialInputGenerator = new TEAdversarialInputGenerator(topology, opts.Paths, opts.NumProcesses); + + // setup the heuristic encoder and partitions. + var heuristicSolver = solver; + var (heuristicEncoder, partitioning, partitionList) = CliUtils.getHeuristic(heuristicSolver, topology, opts.Heuristic, opts.Paths, opts.PopSlices, + opts.DemandPinningThreshold * opts.DownScaleFactor, numSamples: opts.NumRandom, partitionSensitivity: opts.PartitionSensitivity, + scaleFactor: opts.DownScaleFactor, InnerEncoding: opts.InnerEncoding, maxShortestPathLen: opts.MaxShortestPathLen); + + // find an adversarial example and show the time taken. + var demandList = new GenericDemandList((opts.DemandList.Split(",")).Select(x => double.Parse(x) * opts.DownScaleFactor).ToHashSet()); + Utils.logger( + string.Format("Demand List:{0}", Newtonsoft.Json.JsonConvert.SerializeObject(demandList.demandList, Newtonsoft.Json.Formatting.Indented)), + opts.Verbose); + var timer = System.Diagnostics.Stopwatch.StartNew(); + Utils.logger("Starting setup", opts.Verbose); + (TEOptimizationSolution, TEOptimizationSolution) result; + switch (opts.Method) + { + case MethodChoice.Direct: + result = CliUtils.getMetaOptResult(adversarialInputGenerator, optimalEncoder, heuristicEncoder, opts.DemandUB, opts.InnerEncoding, + demandList, opts.EnableClustering, opts.ClusterVersion, clusters, opts.NumInterClusterSamples, opts.NumNodesPerCluster, + opts.NumInterClusterQuantizations, opts.Simplify, opts.Verbose, opts.MaxDensity, opts.LargeDemandLB, opts.maxLargeDistance, + opts.maxSmallDistance, false, null); + break; + case MethodChoice.Search: + Utils.logger("Going to use search to find a desirable gap", opts.Verbose); + result = adversarialInputGenerator.FindMaximumGapInterval(optimalEncoder, heuristicEncoder, opts.Confidencelvl, opts.StartingGap, opts.DemandUB, + demandList: demandList); + break; + case MethodChoice.FindFeas: + Utils.logger("Going to find one feasible solution with the specified gap", opts.Verbose); + result = adversarialInputGenerator.FindOptimalityGapAtLeast(optimalEncoder, heuristicEncoder, opts.StartingGap, opts.DemandUB, + demandList: demandList, simplify: opts.Simplify); + break; + case MethodChoice.Random: + Utils.logger("Going to do random search to find some advers inputs", opts.Verbose); + result = adversarialInputGenerator.RandomAdversarialGenerator(optimalEncoder, heuristicEncoder, opts.NumRandom, opts.DemandUB, seed: opts.Seed, + verbose: opts.Verbose, storeProgress: opts.StoreProgress, logPath: opts.LogFile, timeout: opts.Timeout); + break; + case MethodChoice.HillClimber: + Utils.logger("Going to use HillClimber to find some advers inputs", opts.Verbose); + result = adversarialInputGenerator.HillClimbingAdversarialGenerator(optimalEncoder, heuristicEncoder, opts.NumRandom, + opts.NumNeighbors, opts.DemandUB, opts.StdDev, seed: opts.Seed, verbose: opts.Verbose, storeProgress: opts.StoreProgress, + logPath: opts.LogFile, timeout: opts.Timeout); + break; + case MethodChoice.SimulatedAnnealing: + Utils.logger("Going to use Simulated Annealing to find some advers inputs", opts.Verbose); + Utils.logger(opts.LogFile, opts.Verbose); + result = adversarialInputGenerator.SimulatedAnnealing(optimalEncoder, heuristicEncoder, opts.NumRandom, opts.NumNeighbors, + opts.DemandUB, opts.StdDev, opts.InitTmp, opts.TmpDecreaseFactor, seed: opts.Seed, verbose: opts.Verbose, storeProgress: opts.StoreProgress, + logPath: opts.LogFile, timeout: opts.Timeout); + break; + default: + throw new Exception("Wrong Method, please choose between available methods!!"); + } + + if (opts.FullOpt) + { + if (!opts.EnableClustering) + { + throw new Exception("does not need to be enable for non-clustering method"); + } + if (opts.InnerEncoding != InnerRewriteMethodChoice.PrimalDual) + { + throw new Exception("inner encoding should be primal dual"); + } + optimalEncoder.Solver.CleanAll(timeout: opts.FullOptTimer); + var currDemands = new Dictionary<(string, string), double>(result.Item1.Demands); + Utils.setEmptyPairsToZero(topology, currDemands); + result = adversarialInputGenerator.MaximizeOptimalityGap(optimalEncoder, heuristicEncoder, opts.DemandUB, innerEncoding: opts.InnerEncoding, + demandList: demandList, simplify: opts.Simplify, verbose: opts.Verbose, demandInits: currDemands); + optimalEncoder.Solver.CleanAll(focusBstBd: false, timeout: opts.Timeout); + } + + if (opts.UBFocus) + { + var currDemands = new Dictionary<(string, string), double>(result.Item1.Demands); + optimalEncoder.Solver.CleanAll(focusBstBd: true, timeout: opts.UBFocusTimer); + Utils.setEmptyPairsToZero(topology, currDemands); + result = adversarialInputGenerator.MaximizeOptimalityGap(optimalEncoder, heuristicEncoder, opts.DemandUB, innerEncoding: opts.InnerEncoding, + demandList: demandList, simplify: opts.Simplify, verbose: opts.Verbose, demandInits: currDemands); + optimalEncoder.Solver.CleanAll(focusBstBd: false, timeout: opts.Timeout); + } + var optimal = result.Item1.MaxObjective; + var heuristic = result.Item2.MaxObjective; + var demands = new Dictionary<(string, string), double>(result.Item1.Demands); + Utils.setEmptyPairsToZero(topology, demands); + Console.WriteLine("##############################################"); + Console.WriteLine("##############################################"); + Console.WriteLine("##############################################"); + Console.WriteLine($"optimal={optimal}, heuristic={heuristic}, time={timer.ElapsedMilliseconds}ms"); + if (opts.Heuristic == Heuristic.ExpectedPop) + { + CliUtils.findGapExpectedPopAdversarialDemandOnIndependentPartitions(opts, topology, demands, optimal); + } + Console.WriteLine("##############################################"); + Console.WriteLine("##############################################"); + Console.WriteLine("##############################################"); + var optGSolver = new GurobiBinary(); + var optimalEncoderG = new TEMaxFlowOptimalEncoder(optGSolver, maxNumPaths: opts.Paths); + var optZSolver = new SolverZen(); + var optimalEncoderZen = new TEMaxFlowOptimalEncoder, ZenSolution>(optZSolver, maxNumPaths: opts.Paths); + + var gSolver = new GurobiBinary(); + var zSolver = new SolverZen(); + IEncoder heuristicEncoderG; + IEncoder, ZenSolution> heuristicEncoderZ; + switch (opts.Heuristic) + { + case Heuristic.Pop: + Console.WriteLine("Starting exploring pop heuristic"); + heuristicEncoderG = new PopEncoder(gSolver, maxNumPaths: opts.Paths, numPartitions: opts.PopSlices, demandPartitions: partitioning); + heuristicEncoderZ = new PopEncoder, ZenSolution>(zSolver, maxNumPaths: opts.Paths, numPartitions: opts.PopSlices, demandPartitions: partitioning); + break; + case Heuristic.DemandPinning: + Console.WriteLine("Starting exploring demand pinning heuristic"); + heuristicEncoderG = new DirectDemandPinningEncoder(gSolver, k: opts.Paths, threshold: opts.DemandPinningThreshold * opts.DownScaleFactor); + heuristicEncoderZ = new DirectDemandPinningEncoder, ZenSolution>(zSolver, k: opts.Paths, threshold: opts.DemandPinningThreshold * opts.DownScaleFactor); + break; + case Heuristic.ExpectedPop: + Console.WriteLine("Starting to explore expected pop heuristic"); + heuristicEncoderG = new ExpectedPopEncoder(gSolver, k: opts.Paths, numSamples: opts.NumRandom, + numPartitionsPerSample: opts.PopSlices, demandPartitionsList: partitionList); + heuristicEncoderZ = new ExpectedPopEncoder, ZenSolution>(zSolver, k: opts.Paths, numSamples: opts.NumRandom, + numPartitionsPerSample: opts.PopSlices, demandPartitionsList: partitionList); + break; + case Heuristic.PopDp: + throw new Exception("Not Implemented Yet."); + default: + throw new Exception("No heuristic selected."); + } + Utils.checkSolution(topology, heuristicEncoderG, optimalEncoderG, heuristic, optimal, demands, "gurobiCheck"); + } + } +} \ No newline at end of file diff --git a/MetaOptimize.Cli/MetaOptimize.Cli.csproj b/MetaOptimize.Cli/MetaOptimize.Cli.csproj index 96fe8214..d262e5e7 100644 --- a/MetaOptimize.Cli/MetaOptimize.Cli.csproj +++ b/MetaOptimize.Cli/MetaOptimize.Cli.csproj @@ -7,6 +7,7 @@ disable x64 x64 + MetaOptimize.Cli.MainEntry From 55b44a416a40ad13adc3bebcf7d705753adecd9b Mon Sep 17 00:00:00 2001 From: Behnaz Arzani Date: Tue, 2 Apr 2024 09:44:49 -0700 Subject: [PATCH 6/7] removing main.cs --- MetaOptimize.Cli/Program.cs | 608 ------------------------------------ 1 file changed, 608 deletions(-) delete mode 100644 MetaOptimize.Cli/Program.cs diff --git a/MetaOptimize.Cli/Program.cs b/MetaOptimize.Cli/Program.cs deleted file mode 100644 index dd82a5dd..00000000 --- a/MetaOptimize.Cli/Program.cs +++ /dev/null @@ -1,608 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// - -namespace MetaOptimize.Cli -{ - using System; - using System.Diagnostics; - using CommandLine; - using Gurobi; - using MetaOptimize; - using ZenLib; - - /// - /// Main entry point for the program. - /// - public class Program - { - /// - /// checks whether we get the solution we expect after running the solvers. - /// - /// - public static void TEExampleMain(string[] args) - { - var topology = new Topology(); - topology.AddNode("a"); - topology.AddNode("b"); - topology.AddNode("c"); - topology.AddNode("d"); - topology.AddEdge("a", "b", capacity: 10); - topology.AddEdge("a", "c", capacity: 10); - topology.AddEdge("b", "d", capacity: 10); - topology.AddEdge("c", "d", capacity: 10); - - var partition = topology.RandomPartition(2); - // create the optimal encoder. - var solverG = new GurobiSOS(); - var optimalEncoderG = new TEMaxFlowOptimalEncoder(solverG, maxNumPaths: 1); - var popEncoderG = new PopEncoder(solverG, maxNumPaths: 1, numPartitions: 2, demandPartitions: partition); - var adversarialInputGenerator = new TEAdversarialInputGenerator(topology, maxNumPaths: 1); - - var (optimalSolutionG, popSolutionG) = adversarialInputGenerator.MaximizeOptimalityGap(optimalEncoderG, popEncoderG); - Console.WriteLine("Optimal:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimalSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("Heuristic:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(popSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - - var optimal = optimalSolutionG.MaxObjective; - var heuristic = popSolutionG.MaxObjective; - Console.WriteLine($"optimalG={optimal}, heuristicG={heuristic}"); - - var demands = new Dictionary<(string, string), double>(optimalSolutionG.Demands); - var optGSolver = new GurobiSOS(); - optimalEncoderG = new TEMaxFlowOptimalEncoder(optGSolver, maxNumPaths: 1); - var popGSolver = new GurobiSOS(); - popEncoderG = new PopEncoder(popGSolver, maxNumPaths: 1, numPartitions: 2, demandPartitions: partition); - Utils.checkSolution(topology, popEncoderG, optimalEncoderG, heuristic, optimal, demands, "gurobiCheck"); - } - - /// - /// Use this function to test our theorem for VBP. - /// (see theorem 1 in our NSDI24 Paper). - /// - public static void vbpMain(string[] args) - { - // OPT = 2m + 3n - // HUE = 4m + 6n - // num jobs = 6m + 9n - var solverG = new GurobiSOS(verbose: 0); - - for (int m = 1; m < 10; m++) - { - for (int n = 0; n < 2; n++) - { - Console.WriteLine(String.Format("============ m = {0}, n = {1}", m, n)); - var binSize = new List(); - binSize.Add(1.0001); - binSize.Add(1.0001); - var bins = new Bins(4 * m + 6 * n, binSize); - // TODO: need to change var name to be appropriate for the problem. - var demands = new Dictionary>(); - int nxt_key = 0; - - // TODO: need a comment that describes what the constants are here. you also may benefit from changing the constants to have a name. - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.92, 0.0 }; - nxt_key += 1; - } - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.91, 0.01 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.48, 0.2 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.68, 0 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.52, 0.12 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.32, 0.32 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.19, 0.45 }; - nxt_key += 1; - demands[nxt_key] = new List() { 0.42, 0.22 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.1, 0.54 }; - nxt_key += 1; - demands[nxt_key] = new List() { 0.1, 0.54 }; - nxt_key += 1; - } - for (int i = 0; i < n; i++) - { - demands[nxt_key] = new List() { 0.1, 0.53 }; - nxt_key += 1; - } - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.06, 0.48 }; - nxt_key += 1; - } - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.07, 0.47 }; - nxt_key += 1; - } - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.01, 0.53 }; - nxt_key += 1; - } - for (int i = 0; i < m; i++) - { - demands[nxt_key] = new List() { 0.03, 0.51 }; - nxt_key += 1; - } - for (int i = 0; i < demands.Count - 1; i++) - { - double total_sum_1 = 0; - double total_sum_2 = 0; - for (int j = 0; j < demands[0].Count; j++) - { - total_sum_1 += demands[i][j]; - total_sum_2 += demands[i + 1][j]; - } - Debug.Assert(total_sum_1 >= total_sum_2 - 0.00001); - } - solverG.CleanAll(); - var optimalEncoder = new VBPOptimalEncoder(solverG, demands.Count, demands[0].Count); - var optimalEncoding = optimalEncoder.Encoding(bins, inputEqualityConstraints: demands, verbose: false); - var solverSolutionOptimal = optimalEncoder.Solver.Maximize(optimalEncoding.MaximizationObjective); - var optimizationSolutionOptimal = (VBPOptimizationSolution)optimalEncoder.GetSolution(solverSolutionOptimal); - Console.WriteLine( - String.Format("===== OPT {0}", optimizationSolutionOptimal.TotalNumBinsUsed)); - - solverG.CleanAll(); - var ffdEncoder = new FFDItemCentricEncoder(solverG, demands.Count, demands[0].Count); - var ffdEncoding = ffdEncoder.Encoding(bins, inputEqualityConstraints: demands, verbose: false); - var solverSolutionFFD = optimalEncoder.Solver.Maximize(ffdEncoding.MaximizationObjective); - var solutionFFD = (VBPOptimizationSolution)ffdEncoder.GetSolution(solverSolutionFFD); - Console.WriteLine( - String.Format("===== HUE {0}", solutionFFD.TotalNumBinsUsed)); - Debug.Assert(optimizationSolutionOptimal.TotalNumBinsUsed * 2 == solutionFFD.TotalNumBinsUsed); - } - } - } - - /// - /// test MetaOpt on VBP. - /// - /// TODO: specify how this function is different from the previous. - public static void Main(string[] args) - { - var binSize = new List(); - binSize.Add(1.00001); - binSize.Add(1.00001); - var bins = new Bins(6, binSize); - var numDemands = 9; - var numDimensions = 2; - var optimalBins = 3; - var ffdMethod = FFDMethodChoice.FFDSum; - List> demandList = null; - double perIterationTimeout = 1000; - // double perIterationTimeout = double.PositiveInfinity; - var solverG = new GurobiSOS(timeout: perIterationTimeout, verbose: 1); - var optimalEncoder = new VBPOptimalEncoder(solverG, numDemands, numDimensions, BreakSymmetry: false); - var ffdEncoder = new FFDItemCentricEncoder(solverG, numDemands, numDimensions); - var adversarialGenerator = new VBPAdversarialInputGenerator(bins, numDemands, numDimensions); - var (optimalSolutionG, ffdSolutionG) = adversarialGenerator.MaximizeOptimalityGapFFD(optimalEncoder, ffdEncoder, - optimalBins, ffdMethod: ffdMethod, itemList: demandList, verbose: true); - Console.WriteLine("Optimal:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimalSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("Heuristic:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(ffdSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("Optimal number of bins: " + optimalSolutionG.TotalNumBinsUsed); - Console.WriteLine("FFD number of bins: " + ffdSolutionG.TotalNumBinsUsed); - } - - /// - /// test case for SP-PIFO. - /// - public static void PIFOTestMain(string[] args) - { - int maxRank = 8; - int numPackets = 15; - int numQueues = 4; - int splitQueue = 2; - int splitRank = 5; - var solverG = new GurobiSOS(verbose: 0); - - var packetRankEqualityConstraint = new Dictionary(); - packetRankEqualityConstraint[0] = 7; - packetRankEqualityConstraint[1] = 2; - packetRankEqualityConstraint[2] = 1; - packetRankEqualityConstraint[3] = 0; - packetRankEqualityConstraint[4] = 7; - packetRankEqualityConstraint[5] = 7; - packetRankEqualityConstraint[6] = 2; - packetRankEqualityConstraint[7] = 1; - packetRankEqualityConstraint[8] = 0; - packetRankEqualityConstraint[9] = 2; - packetRankEqualityConstraint[10] = 1; - packetRankEqualityConstraint[11] = 0; - packetRankEqualityConstraint[12] = 2; - packetRankEqualityConstraint[13] = 1; - packetRankEqualityConstraint[14] = 0; - solverG.CleanAll(); - var optimalEncoder = new PIFOAvgDelayOptimalEncoder(solverG, numPackets, maxRank); - var optimalEncoding = optimalEncoder.Encoding(rankEqualityConstraints: packetRankEqualityConstraint); - var solverSolutionOptimal = optimalEncoder.Solver.Maximize(optimalEncoding.MaximizationObjective); - var optimizationSolutionOptimal = (PIFOOptimizationSolution)optimalEncoder.GetSolution(solverSolutionOptimal); - Console.WriteLine("Optimal:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimizationSolutionOptimal, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("===== OPT {0}", optimizationSolutionOptimal.Cost); - - solverG.CleanAll(); - var heuristicEncoder = new ModifiedSPPIFOAvgDelayEncoder(solverG, numPackets, splitQueue, numQueues, splitRank, maxRank); - var heuristicEncoding = heuristicEncoder.Encoding(rankEqualityConstraints: packetRankEqualityConstraint); - var solverSolutionHeuristic = optimalEncoder.Solver.Maximize(heuristicEncoding.MaximizationObjective); - var solutionHeuristic = (PIFOOptimizationSolution)heuristicEncoder.GetSolution(solverSolutionHeuristic); - Console.WriteLine("Heuristic:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(solutionHeuristic, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("===== HUE {0}", solutionHeuristic.Cost); - } - - /// - /// test MetaOpt on PIFO. - /// - public static void PIFOMain(string[] args) - { - int maxRank = 8; - int numPackets = 18; - int numQueues = 4; - // int splitQueue = 2; - // int splitRank = 4; - int maxQueueSize = 12; - int windowSize = 12; - double burstParam = 0.1; - - var solverG = new GurobiSOS(verbose: 1, timeout: 1000); - // var optimalEncoder = new PIFOAvgDelayOptimalEncoder(solverG, numPackets, maxRank); - // var heuristicEncoder = new SPPIFOAvgDelayEncoder(solverG, numPackets, numQueues, maxRank); - // var optimalEncoder = new SPPIFOAvgDelayEncoder(solverG, numPackets, numQueues, maxRank); - // var heuristicEncoder = new ModifiedSPPIFOAvgDelayEncoder(solverG, numPackets, splitQueue, numQueues, - // splitRank, maxRank); - // var optimalEncoder = new PIFOWithDropAvgDelayEncoder(solverG, numPackets, maxRank, maxQueueSize); - var H1 = new SPPIFOWithDropAvgDelayEncoder(solverG, numPackets, numQueues, maxRank, maxQueueSize); - var H2 = new AIFOAvgDelayEncoder(solverG, numPackets, maxRank, maxQueueSize, windowSize, burstParam); - - var adversarialGenerator = new PIFOAdversarialInputGenerator(numPackets, maxRank); - var (optimalSolutionG, heuristicSolutionG) = adversarialGenerator.MaximizeOptimalityGap(H1, - H2, verbose: true); - Console.WriteLine("Optimal:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(optimalSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("Heuristic:"); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(heuristicSolutionG, Newtonsoft.Json.Formatting.Indented)); - Console.WriteLine("****"); - Console.WriteLine("Optimal cost: " + optimalSolutionG.Cost); - Console.WriteLine("Heuristic cost: " + heuristicSolutionG.Cost); - - var orderToRankOpt = new Dictionary(); - var orderToRankHeu = new Dictionary(); - for (int pid = 0; pid < numPackets; pid++) { - if (optimalSolutionG.Admit[pid] == 1) { - orderToRankOpt[optimalSolutionG.Order[pid]] = optimalSolutionG.Ranks[pid]; - } - if (heuristicSolutionG.Admit[pid] == 1) { - orderToRankHeu[heuristicSolutionG.Order[pid]] = heuristicSolutionG.Ranks[pid]; - } - } - - int numInvOpt = 0; - int numInvHeu = 0; - for (int pid = 0; pid < numPackets; pid++) - { - numInvOpt += ComputeInversionNum(optimalSolutionG, orderToRankOpt, pid); - numInvHeu += ComputeInversionNum(heuristicSolutionG, orderToRankHeu, pid); - } - Console.WriteLine("number of inversions in OPT: " + numInvOpt); - Console.WriteLine("number of inversions in HEU: " + numInvHeu); - } - - private static int ComputeInversionNum(PIFOOptimizationSolution optimalSolutionG, Dictionary orderToRankOpt, int pid) - { - int numInvOpt = 0; - if (optimalSolutionG.Admit[pid] >= 0.98) - { - int currOrder = optimalSolutionG.Order[pid]; - for (int prev = 0; prev < currOrder; prev++) - { - if (orderToRankOpt[prev] > optimalSolutionG.Ranks[pid]) - { - numInvOpt += 1; - } - } - } - else - { - foreach (var (order, rank) in orderToRankOpt) - { - if (rank > optimalSolutionG.Ranks[pid]) - { - numInvOpt += 1; - } - } - } - - return numInvOpt; - } - - /// - /// Experiments for NSDI. - /// - public static void NSDIMain(string[] args) - { - // NSDIExp.compareGapDelayDiffMethodsDP(); - // NSDIExp.compareLargeScaleGapDelayDiffMethodsDP(); - // NSDIExp.compareGapDelayDiffMethodsPop(); - // NSDIExp.AblationStudyClusteringOnDP(); - // NSDIExp.BlackBoxParameterTunning(); - NSDIExp.AddRealisticConstraintsDP(); - // NSDIExp.gapThresholdDemandPinningForDifferentTopologies(); - // NSDIExp.ImpactNumPathsPartitionsExpectedPop(); - // NSDIExp.AblationStudyClusteringOnDP(); - // NSDIExp.BlackBoxParameterTunning(); - // NSDIExp.AnalyzeModifiedDP(); - // NSDIExp.ImpactNumNodesRadixSmallWordTopoDemandPinning(); - // NSDIExp.ImpactNumSamplesExpectedPop(); - // NSDIExp.AnalyzeParallelHeuristics(); - } - - /// - /// Experiments for hotnets. - /// - public static void hotnetsMain(string[] args) - { - // var topology = Topology.RandomRegularGraph(8, 7, 1, seed: 0); - // var topology = Topology.SmallWordGraph(5, 4, 1); - // foreach (var edge in topology.GetAllEdges()) { - // Console.WriteLine(edge.Source + "_" + edge.Target); - // } - // foreach (var pair in topology.GetNodePairs()) { - // if (!topology.ContaintsEdge(pair.Item1, pair.Item2, 1)) { - // Console.WriteLine("missing link " + pair.Item1 + " " + pair.Item2); - // } - // } - // Experiment.printPaths(); - // HotNetsExperiment.impactOfDPThresholdOnGap(); - // Experiment.ImpactNumPathsDemandPinning(); - // Experiment.ImpactNumNodesRadixRandomRegularGraphDemandPinning(); - HotNetsExperiment.impactSmallWordGraphParamsDP(); - // Experiment.ImpactNumPathsPartitionsPop(); - // Experiment.compareGapDelayDiffMethodsPop(); - // Experiment.compareGapDelayDiffMethodsDP(); - // Experiment.compareTopoSizeLatency(); - } - - /// - /// Main entry point for the program. - /// The function takes the command line arguments and stores them in a - /// static instance property of the CliOptions class. - /// It then reads the topology and clusters from the files specified in the - /// command line arguments and then proceeds to find the optimality gap. - /// - /// The arguments. - public static void ssMain(string[] args) - { - // read the command line arguments. - var opts = CommandLine.Parser.Default.ParseArguments(args).MapResult(o => o, e => null); - CliOptions.Instance = opts; - - if (opts == null) - { - Environment.Exit(0); - } - - // read the topology and clusters. - var (topology, clusters) = CliUtils.getTopology(opts.TopologyFile, opts.PathFile, opts.DownScaleFactor, opts.EnableClustering, - opts.NumClusters, opts.ClusterDir, opts.Verbose); - - getSolverAndRunNetwork(topology, clusters); - } - - // TODO: this function is missing proper commenting - private static void getSolverAndRunNetwork(Topology topology, List clusters) - { - var opts = CliOptions.Instance; - // use the Z3 solver via the Zen wrapper library. - switch (opts.SolverChoice) - { - case SolverChoice.Zen: - // run the zen optimizer. - RunNetwork(new SolverZen(), topology, clusters); - break; - case SolverChoice.Gurobi: - var storeProgress = opts.StoreProgress & (opts.Method == MethodChoice.Direct); - if (opts.Heuristic == Heuristic.DemandPinning) - { - RunNetwork(new GurobiSOS(opts.Timeout, Convert.ToInt32(opts.Verbose), - timeToTerminateNoImprovement: opts.TimeToTerminateIfNoImprovement, - numThreads: opts.NumGurobiThreads, - recordProgress: storeProgress, - logPath: opts.LogFile), - topology, clusters); - } - else - { - RunNetwork(new GurobiSOS(opts.Timeout, Convert.ToInt32(opts.Verbose), - timeToTerminateNoImprovement: opts.TimeToTerminateIfNoImprovement, - numThreads: opts.NumGurobiThreads, - recordProgress: storeProgress, - logPath: opts.LogFile), - topology, clusters); - } - break; - default: - throw new Exception("Other solvers are currently invalid."); - } - } - - // TODO: this function is missing proper commenting - private static void RunNetwork(ISolver solver, - Topology topology, List clusters) - { - var opts = CliOptions.Instance; - - // setup the optimal encoder and adversarial input generator. - var optimalEncoder = new TEMaxFlowOptimalEncoder(solver, opts.Paths); - TEAdversarialInputGenerator adversarialInputGenerator; - adversarialInputGenerator = new TEAdversarialInputGenerator(topology, opts.Paths, opts.NumProcesses); - - // setup the heuristic encoder and partitions. - var heuristicSolver = solver; - var (heuristicEncoder, partitioning, partitionList) = CliUtils.getHeuristic(heuristicSolver, topology, opts.Heuristic, opts.Paths, opts.PopSlices, - opts.DemandPinningThreshold * opts.DownScaleFactor, numSamples: opts.NumRandom, partitionSensitivity: opts.PartitionSensitivity, - scaleFactor: opts.DownScaleFactor, InnerEncoding: opts.InnerEncoding, maxShortestPathLen: opts.MaxShortestPathLen); - - // find an adversarial example and show the time taken. - var demandList = new GenericDemandList((opts.DemandList.Split(",")).Select(x => double.Parse(x) * opts.DownScaleFactor).ToHashSet()); - Utils.logger( - string.Format("Demand List:{0}", Newtonsoft.Json.JsonConvert.SerializeObject(demandList.demandList, Newtonsoft.Json.Formatting.Indented)), - opts.Verbose); - var timer = System.Diagnostics.Stopwatch.StartNew(); - Utils.logger("Starting setup", opts.Verbose); - (TEOptimizationSolution, TEOptimizationSolution) result; - switch (opts.Method) - { - case MethodChoice.Direct: - result = CliUtils.getMetaOptResult(adversarialInputGenerator, optimalEncoder, heuristicEncoder, opts.DemandUB, opts.InnerEncoding, - demandList, opts.EnableClustering, opts.ClusterVersion, clusters, opts.NumInterClusterSamples, opts.NumNodesPerCluster, - opts.NumInterClusterQuantizations, opts.Simplify, opts.Verbose, opts.MaxDensity, opts.LargeDemandLB, opts.maxLargeDistance, - opts.maxSmallDistance, false, null); - break; - case MethodChoice.Search: - Utils.logger("Going to use search to find a desirable gap", opts.Verbose); - result = adversarialInputGenerator.FindMaximumGapInterval(optimalEncoder, heuristicEncoder, opts.Confidencelvl, opts.StartingGap, opts.DemandUB, - demandList: demandList); - break; - case MethodChoice.FindFeas: - Utils.logger("Going to find one feasible solution with the specified gap", opts.Verbose); - result = adversarialInputGenerator.FindOptimalityGapAtLeast(optimalEncoder, heuristicEncoder, opts.StartingGap, opts.DemandUB, - demandList: demandList, simplify: opts.Simplify); - break; - case MethodChoice.Random: - Utils.logger("Going to do random search to find some advers inputs", opts.Verbose); - result = adversarialInputGenerator.RandomAdversarialGenerator(optimalEncoder, heuristicEncoder, opts.NumRandom, opts.DemandUB, seed: opts.Seed, - verbose: opts.Verbose, storeProgress: opts.StoreProgress, logPath: opts.LogFile, timeout: opts.Timeout); - break; - case MethodChoice.HillClimber: - Utils.logger("Going to use HillClimber to find some advers inputs", opts.Verbose); - result = adversarialInputGenerator.HillClimbingAdversarialGenerator(optimalEncoder, heuristicEncoder, opts.NumRandom, - opts.NumNeighbors, opts.DemandUB, opts.StdDev, seed: opts.Seed, verbose: opts.Verbose, storeProgress: opts.StoreProgress, - logPath: opts.LogFile, timeout: opts.Timeout); - break; - case MethodChoice.SimulatedAnnealing: - Utils.logger("Going to use Simulated Annealing to find some advers inputs", opts.Verbose); - Utils.logger(opts.LogFile, opts.Verbose); - result = adversarialInputGenerator.SimulatedAnnealing(optimalEncoder, heuristicEncoder, opts.NumRandom, opts.NumNeighbors, - opts.DemandUB, opts.StdDev, opts.InitTmp, opts.TmpDecreaseFactor, seed: opts.Seed, verbose: opts.Verbose, storeProgress: opts.StoreProgress, - logPath: opts.LogFile, timeout: opts.Timeout); - break; - default: - throw new Exception("Wrong Method, please choose between available methods!!"); - } - - if (opts.FullOpt) - { - if (!opts.EnableClustering) - { - throw new Exception("does not need to be enable for non-clustering method"); - } - if (opts.InnerEncoding != InnerRewriteMethodChoice.PrimalDual) - { - throw new Exception("inner encoding should be primal dual"); - } - optimalEncoder.Solver.CleanAll(timeout: opts.FullOptTimer); - var currDemands = new Dictionary<(string, string), double>(result.Item1.Demands); - Utils.setEmptyPairsToZero(topology, currDemands); - result = adversarialInputGenerator.MaximizeOptimalityGap(optimalEncoder, heuristicEncoder, opts.DemandUB, innerEncoding: opts.InnerEncoding, - demandList: demandList, simplify: opts.Simplify, verbose: opts.Verbose, demandInits: currDemands); - optimalEncoder.Solver.CleanAll(focusBstBd: false, timeout: opts.Timeout); - } - - if (opts.UBFocus) - { - var currDemands = new Dictionary<(string, string), double>(result.Item1.Demands); - optimalEncoder.Solver.CleanAll(focusBstBd: true, timeout: opts.UBFocusTimer); - Utils.setEmptyPairsToZero(topology, currDemands); - result = adversarialInputGenerator.MaximizeOptimalityGap(optimalEncoder, heuristicEncoder, opts.DemandUB, innerEncoding: opts.InnerEncoding, - demandList: demandList, simplify: opts.Simplify, verbose: opts.Verbose, demandInits: currDemands); - optimalEncoder.Solver.CleanAll(focusBstBd: false, timeout: opts.Timeout); - } - var optimal = result.Item1.MaxObjective; - var heuristic = result.Item2.MaxObjective; - var demands = new Dictionary<(string, string), double>(result.Item1.Demands); - Utils.setEmptyPairsToZero(topology, demands); - Console.WriteLine("##############################################"); - Console.WriteLine("##############################################"); - Console.WriteLine("##############################################"); - Console.WriteLine($"optimal={optimal}, heuristic={heuristic}, time={timer.ElapsedMilliseconds}ms"); - if (opts.Heuristic == Heuristic.ExpectedPop) - { - CliUtils.findGapExpectedPopAdversarialDemandOnIndependentPartitions(opts, topology, demands, optimal); - } - Console.WriteLine("##############################################"); - Console.WriteLine("##############################################"); - Console.WriteLine("##############################################"); - var optGSolver = new GurobiBinary(); - var optimalEncoderG = new TEMaxFlowOptimalEncoder(optGSolver, maxNumPaths: opts.Paths); - var optZSolver = new SolverZen(); - var optimalEncoderZen = new TEMaxFlowOptimalEncoder, ZenSolution>(optZSolver, maxNumPaths: opts.Paths); - - var gSolver = new GurobiBinary(); - var zSolver = new SolverZen(); - IEncoder heuristicEncoderG; - IEncoder, ZenSolution> heuristicEncoderZ; - switch (opts.Heuristic) - { - case Heuristic.Pop: - Console.WriteLine("Starting exploring pop heuristic"); - heuristicEncoderG = new PopEncoder(gSolver, maxNumPaths: opts.Paths, numPartitions: opts.PopSlices, demandPartitions: partitioning); - heuristicEncoderZ = new PopEncoder, ZenSolution>(zSolver, maxNumPaths: opts.Paths, numPartitions: opts.PopSlices, demandPartitions: partitioning); - break; - case Heuristic.DemandPinning: - Console.WriteLine("Starting exploring demand pinning heuristic"); - heuristicEncoderG = new DirectDemandPinningEncoder(gSolver, k: opts.Paths, threshold: opts.DemandPinningThreshold * opts.DownScaleFactor); - heuristicEncoderZ = new DirectDemandPinningEncoder, ZenSolution>(zSolver, k: opts.Paths, threshold: opts.DemandPinningThreshold * opts.DownScaleFactor); - break; - case Heuristic.ExpectedPop: - Console.WriteLine("Starting to explore expected pop heuristic"); - heuristicEncoderG = new ExpectedPopEncoder(gSolver, k: opts.Paths, numSamples: opts.NumRandom, - numPartitionsPerSample: opts.PopSlices, demandPartitionsList: partitionList); - heuristicEncoderZ = new ExpectedPopEncoder, ZenSolution>(zSolver, k: opts.Paths, numSamples: opts.NumRandom, - numPartitionsPerSample: opts.PopSlices, demandPartitionsList: partitionList); - break; - case Heuristic.PopDp: - throw new Exception("Not Implemented Yet."); - default: - throw new Exception("No heuristic selected."); - } - Utils.checkSolution(topology, heuristicEncoderG, optimalEncoderG, heuristic, optimal, demands, "gurobiCheck"); - } - } -} \ No newline at end of file From 7827024dd8e45814a498625b2500b0124d6ebc38 Mon Sep 17 00:00:00 2001 From: PooriaNamyar Date: Tue, 2 Apr 2024 17:17:30 +0000 Subject: [PATCH 7/7] clean history ISolver --- MetaOptimize/ISolver.cs | 258 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 MetaOptimize/ISolver.cs diff --git a/MetaOptimize/ISolver.cs b/MetaOptimize/ISolver.cs new file mode 100644 index 00000000..0e1de600 --- /dev/null +++ b/MetaOptimize/ISolver.cs @@ -0,0 +1,258 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// + +namespace MetaOptimize +{ + using System.Collections.Generic; + using Gurobi; + /// + /// An interface for an optimization solver. + /// + public interface ISolver + { + /// + /// Reset the solver by removing all the variables and constraints. + /// + public void CleanAll(double timeout = -1, bool disableStoreProgress = false); + + /// + /// Reset the solver by removing all the variables and constraints. + /// + public void CleanAll(bool focusBstBd, double timeout = -1); + + /// + /// Create a new variable with a given name. + /// + /// The variable name. + /// the type of variable. + /// The lb on the variable. + /// The ub on the variable. + /// The solver variable. + public TVar CreateVariable(string name, char type = GRB.CONTINUOUS, + double lb = double.NegativeInfinity, double ub = double.PositiveInfinity); + + /// + /// Get the resulting value assigned to a variable. + /// + /// The solver solution. + /// The variable. + /// which solution to return (if multiple solutions). + /// The value as a double. + public double GetVariable(TSolution solution, TVar variable, int solutionNumber = 0); + + /// + /// Get the resulting value assigned to a variable. + /// + public double GetDualVariable(TSolution solution, string constrName); + + /// + /// set the objective. + /// + /// The solver solution. + public void SetObjective(Polynomial objective); + + /// + /// set the objective. + /// + /// The solver solution. + public void SetObjective(TVar objective); + + /// + /// set the objective. + /// + /// value for timeout. + public void SetTimeout(double timeout); + + /// + /// set the FocusBstBd. + /// + public void SetFocusBstBd(bool focusBstBd); + + /// + /// get model. + /// + public TSolution GetModel(); + + /// + /// Add a less than or equal to zero constraint. + /// + /// The polynomial. + /// name of the constraint. + public string AddLeqZeroConstraint(Polynomial polynomial); + + /// + /// Add a less than or equal to zero constraint (Quadratic). + /// Following constraints; A * B + C \leq 0. + /// + /// The coefficent polynomial list (A). + /// The variable list (B). + /// The linear term (C). + /// type of variable in coeff polynomial list (C). + /// type of variable in variable list (E). + /// name of the constraint. + public string AddLeqZeroConstraint(IList> coeffPolyList, IList variableList, + Polynomial linearPoly, VariableType coeffVarType = VariableType.BINARY, + VariableType varType = VariableType.CONTINUOUS); + + /// + /// Add a equal to zero constraint. + /// + /// The polynomial. + /// name of the constraint. + public string AddEqZeroConstraint(Polynomial polynomial); + + /// + /// Add a equal to zero constraint (Quadratic). + /// Following constraints; A * B + C == 0. + /// + /// The coefficent polynomial list (A). + /// The variable list (B). + /// The linear term (C). + /// type of variable in coeff polynomial list (D). + /// type of variable in variable list (E). + /// name of the constraint. + public string AddEqZeroConstraint(IList> coeffPolyList, IList variableList, + Polynomial linearPoly, VariableType coeffVarType = VariableType.BINARY, + VariableType varType = VariableType.CONTINUOUS); + + /// + /// Add or equals zero. + /// + /// The first polynomial. + /// The second polynomial. + public void AddOrEqZeroConstraint(Polynomial polynomial1, Polynomial polynomial2); + + /// + /// Add a = max(b, c) constraint. + /// + public void AddMaxConstraint(TVar LHS, Polynomial maxItem1, Polynomial maxItem2); + + /// + /// Add a = max(b, constant) constraint. + /// + public void AddMaxConstraint(TVar LHS, Polynomial var1, double constant); + + /// + /// Add a = max(b, constant) constraint. + /// + public void AddMaxConstraint(TVar LHS, TVar var1, double constant); + + /// + /// Add a = max(b, c) constraint. + /// + public void AddMaxConstraint(TVar LHS, TVar var1, TVar var2); + + /// + /// Logistic constraint y = 1/(1 + exp(-x)). + /// + public void AddLogisticConstraint(TVar xVar, TVar yVar, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, + double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); + + /// + /// power constraint y = x^a. + /// + public void AddPowerConstraint(TVar xVar, TVar yVar, int a, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, + double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); + + /// + /// polynomial constraint y = p0 x^d + p1 x^{d-1} + ... + pd. + /// + public void AddPolynomialConstraint(TVar xVar, TVar yVar, double[] p, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, + double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); + + /// + /// polynomial constraint y = norm_d(x_1, ..., x_n). + /// + public void AddNormConstraint(TVar[] xVar, TVar yVar, double which, string name, double FuncPieces = -1, double FuncPeiceError = 0.01, + double FuncPieceLength = 0.01, double FuncPieceRatio = -1.0); + + /// + /// Remove a constraint. + /// + /// name of the constraint in the string format. + public void RemoveConstraint(string constraintName); + + /// + /// Change constraint's RHS. + /// + /// name of the constraint in the string format. + /// new RHS of the constraint. + public void ChangeConstraintRHS(string constraintName, double newRHS); + + /// + /// Combine the constraints and variables of another solver into this one. + /// + /// The other solver. + public void CombineWith(ISolver otherSolver); + + /// + /// Maximize the objective. + /// + /// A solution. + public TSolution Maximize(); + + /// + /// Maximize the objective with objective as input. + /// + /// A solution. + public TSolution Maximize(Polynomial objective); + + /// + /// Maximize the objective with objective as input. + /// reset the callback timer. + /// + /// A solution. + public TSolution Maximize(Polynomial objective, bool reset); + + /// + /// find the top $k$ solutions. + /// + public TSolution Maximize(Polynomial objective, bool reset, int solutionCount); + + /// + /// Maximize a quadratic objective with objective as input. + /// reset the callback timer. + /// + /// A solution. + public TSolution MaximizeQuadPow2(IList> quadObjective, IList quadCoeff, Polynomial linObjective, bool reset = false); + + /// + /// Maximize the objective with objective as input. + /// + /// A solution. + public TSolution Maximize(TVar objective); + + /// + /// Check feasibility. + /// + /// A solution. + public TSolution CheckFeasibility(double objectiveValue); + + /// + /// Call the model update to apply new constraints and objectives. + /// + public void ModelUpdate(); + + /// + /// initialize some of the variables. + /// + public void InitializeVariables(TVar variable, double value); + + /// + /// adding some auxiliary term to be added to the global objective when maximized. + /// + public void AddGlobalTerm(Polynomial auxObjPoly); + + /// + /// append as the next line of the store progress file. + /// + public void AppendToStoreProgressFile(double time_ms, double gap, bool reset = false); + + /// + /// writes the model to a file. + /// + /// + public void WriteModel(string location); + } +}