Package: feloopy
IntroductionFelooPy(pronounced /fɛlupaɪ/) is anintegrated optimization environment(IOE) designed as adecision optimization hub. It involves the use ofautomated operations research(AutoOR) methods and techniques to identifyfeasible solutionsthat lead tological decisionswith theoptimal (best possible)outcomes based ongivenorlearnablepolicies. This Python librarysimplifiesandenhancesthe use ofexistingandoriginally developedmodeling, algorithm development, and analytical tools for decision-making within simulatedsystems,industries, andsupply chains. FelooPy is an acronym alluding to an operations research scientist (a.k.a, decision scientist) in pursuit offeasible solutions,logical decisions, andoptimal outcomes by optimization inPython. Additionally, it alludes to the concept ofloopsin computer programming and thefloppy disk, symbolizing computing and memory efficiency. The development of FelooPy, which started inSeptember 2022, continues under theMIT license.Overview:Learn more:FeaturesFelooPy supports the followingmathematical structure-basedclassification of optimization problems:Display as a listNumerical optimizationLinear Programming (LP)[Unconstrained] Linear Programming (ULP, or LP)[Constrained] Linear Programming (CLP, or LP)General Linear Programming (GLP, or LP)Non-Linear Programming (NLP)with non-linear objectives[Unconstrained] Quadratic Programming (UQP, or QP)[Constrained] Quadratic Programming (CQP, or QP)with non-linear constraintsSecond Order Cone Programming (SOCP)with non-linear objectives and constraintsGeneral Non-Linear Programming (GNLP)Combinatorial optimizationInteger Programming (IP)Pure Integer Linear Programming (PILP)[Unconstrained] Pure Integer Linear Programming (UPILP, or PILP)[Constrained] Pure Integer Linear Programming (CPILP, or PILP)Pure Integer Non-Linear Programming (PINLP)with non-linear objectives[Unconstrained] Integer Quadratic Programming (UIQP, IQP, or QUIO)[Unconstrained] Binary Quadratic Programming (UBQP, BQP, or QUBO)[Constrained] Integer Quadratic Programming (CIQP, IQP, or QUIO)[Constrained] Binary Quadratic Programming (CBQP, BQP, or QUBO)with non-linear constraintswith non-linear objectives and constraintsGeneral Pure Integer Non-Linear Programming (GPINLP)Mixed Integer Programming (MIP)Mixed Integer Linear Programming (MILP)[Unconstrained] Mixed Integer Linear Programming (UMILP, or MILP)[Constrained] Mixed Integer Linear Programming (CMILP, or MILP)Mixed Integer Non-Linear Programming (MINLP)with non-linear objectives[Unconstrained] Mixed Integer Quadratic Programming (UMIQP, or MIQP)[Constrained] Mixed Integer Quadratic Programming (CMIQP, or MIQP)with non-linear constraintswith non-linear objectives and constraintsGeneral Mixed Integer Non-Linear Programming (GMINLP, or GMIP)Credit: Keivan TafakkoriDisplay as a graphgraph LR 
 CLASS["FelooPy"] --> SUBCLASS1["Numerical Optimization"]
 CLASS["FelooPy"] --> SUBCLASS2["Combinatorial Optimization"]
 SUBCLASS1["Numerical Optimization"] --> A["LP"]
 SUBCLASS1["Numerical Optimization"] --> B["NLP"]
 SUBCLASS2["Combinatorial Optimization"] --> C["IP"]
 SUBCLASS2["Combinatorial Optimization"] --> D["MIP"]
 A["LP"] --> A1["ULP, or LP"]
 A["LP"] --> A2["CLP, or LP"]
 A["LP"] --> A3["GLP, or LP"]
 B["NLP"] --> B1["NLO"]
 B1["NLO"] --> B11["UQP, or QP"]
 B1["NLO"] --> B12["CQP, or QP"]
 B["NLP"] --> B2["NLC"]
 B2["NLC"] --> B21["SOCP"]
 B["NLP"] --> B3["NLOC"]
 B3["NLOC"] --> B31["GNLP"]
 C["IP"] --> C1["PILP"]
 C1["PILP"] --> C11["UPILP, or PILP"]
 C1["PILP"] --> C12["CPILP, or PILP"]
 C["IP"] --> C2["PINLP"]
 C2["PINLP"] --> C21["NLO"]
 C21["NLO"] --> C211["UIQP, IQP, or UQIO"]
 C21["NLO"] --> C212["UBQP, BQP, or UBIO"]
 C21["NLO"] --> C213["CIQP, IQP, or CQIO"]
 C21["NLO"] --> C214["CBQP, BQP, or CBIO"]
 C2["PINLP"] --> C22["NLC"]
 C2["PINLP"] --> C23["NLOC"]
 C23["NLOC"] --> C231["GPINLP"]
 D["MIP"] --> D1["MILP"]  
 D1["MILP"] --> D11["UMILP, or MILP"]
 D1["MILP"] --> D12["CMILP, or MILP"]
 D["MIP"] --> D2["MINLP"]  
 D2["MINLP"] --> D21["NLO"]
 D21["NLO"] --> D211["UMIQP"]
 D21["NLO"] --> D212["CMIQP"]
 D2["MINLP"] --> D22["NLC"]
 D2["MINLP"] --> D23["NLOC"]
 D23["NLOC"] --> D231["GMINLP, or GMIP"]Credit: Keivan TafakkoriFelooPy supports the followingexpert-basedclassification of decision-making problems:Display as a listMulti-Attribute Decision-Making (MADM)Weighting methodswithout a decision-making matrixwith a decision-making matrixRanking methodsCompensatory methodsScoring methodsCompromising methodsNon-compensatory methodsConjunctive satisfying methodsLexicographic methodsOutranking methodsGroup Decision-Making (GDM)Credit: Keivan TafakkoriDisplay as a graphgraph LR 
 CLASS["FelooPy"] --> SUBCLASS1["MADM"]
 CLASS["FelooPy"] --> SUBCLASS2["GDM"]
 SUBCLASS1["MADM"] --> A["Weighting"]
 SUBCLASS1["MADM"] --> B["Ranking"]
 A["Weighting"] --> A1["without decision matrix"]
 A["Weighting"] --> A2["with decision matrix"]
 B["Ranking"] --> B1["Compensatory"]
 B["Ranking"] --> B2["Non-compensatory"]
 B1["Compensatory"] --> B11["Scoring"]
 B1["Compensatory"] --> B12["Compromising"]
 B2["Non-compensatory"] --> B21["Conjunctive satisfying"]
 B2["Non-compensatory"] --> B22["Lexicographic"]
 B2["Non-compensatory"] --> B23["Outranking"]Credit: Keivan TafakkoriInstallationFor a quick installation with a classic support of interfaces and solvers, you may use thepippackage manager (please refer to thislinkto install, update, or get one) as follows:pipinstall-Ufeloopy[stock]However, as some users might prefer a dedicated version, the following lists the available variants of FelooPy:Core variantThis variant installs the base package without any additional features. It installs FelooPy with its common dependencies.pipinstall-UfeloopyFree variantspicovariant:This variant installs the base package without any additional features. It is the same as the core variant. It installs FelooPy with its common dependencies.pipinstall-Ufeloopy[pico]nanovariant:This variant includes a small set of additional features. It installs FelooPy with its common dependencies and thepymprogpackage.pipinstall-Ufeloopy[nano]microvariant:This variant includes a moderate set of additional features. It installs FelooPy with its common dependencies and thepymprog,gekko, andmealpypackages.pipinstall-Ufeloopy[micro]minivariant:This variant includes a large set of additional features. It installs FelooPy with its common dependencies and thepymprog,gekko,mealpy,ortools, andcvxpypackages.pipinstall-Ufeloopy[mini]fullvariant:This variant includes all available features. It installs FelooPy with its common dependencies and thepymprog,gekko,mealpy,ortools,cvxpy,pymoo, andpydecisionpackages.pipinstall-Ufeloopy[full]stockvariant:This variant includes all interface packages. It installs FelooPy with its common dependencies and thegekko,ortools,pulp,pyomo,pymprog,picos,linopy,cvxpy,mip,mealpy,pydecision,rsome,pymoo,niapy, andpygadpackages.pipinstall-Ufeloopy[stock]Commercial variantsplus_gurobivariant:This variant includes the Gurobi solver. It requires a valid Gurobi license. Refer to theGurobi websitefor more information.pipinstall-Ufeloopy[plus_gurobi]plus_cplexvariant:This variant includes the CPLEX solver. It requires a valid CPLEX license. Refer to theCPLEX websitefor more information.pipinstall-Ufeloopy[plus_cplex]plus_xpressvariant:This variant includes the Xpress solver. It requires a valid Xpress license. Refer to theXpress websitefor more information.pipinstall-Ufeloopy[plus_xpress]plus_coptvariant:This variant includes the COPT solver. It requires a valid COPT license. Refer to theCOPT websitefor more information.pipinstall-Ufeloopy[plus_copt]Non-compatible variantsonly_cylpvariant:This variant includes the CyLP solver. It requires a valid CyLP installation. Refer to thislinkfor more information.pipinstall-Ufeloopy[plus_cylp]only_linuxvariant:This variant includes additional features for Linux-based distros. It installs FelooPy with its common dependencies and thepymultiobjectivepackage.pipinstall-Ufeloopy[only_linux]Complete variantshypervariant:This variant includes all interface and solver packages. It installs FelooPy with its common dependencies and thegekko,ortools,pulp,pyomo,pymprog,picos,linopy,cvxpy,mip,mealpy,pydecision,rsome,pymoo,niapy,pygad,cplex,docplex,xpress,gurobipy,cylp, andcoptpypackages.pipinstall-Ufeloopy[hyper]megavariant:This variant includes all interface and solver packages. It installs a complete FelooPy with all its dependencies, regardless of whether they are compatible with your operating system, or not.pipinstall-Ufeloopy[mega]Dev variantsTo contribute to the project, support the developer with pull requests, and to get the latest updates, you can install a development variant as follows:pipinstall-Ugit+https://github.com/ktafakkori/feloopy.git#egg=feloopy[variant_name]orgitclonehttps://github.com/ktafakkori/feloopy.gitcdfeloopy
pipinstall.[variant_name]or!gitclonehttps://github.com/ktafakkori/feloopy.git
%cdfeloopy
!pipinstall.[variant_name]wherevariant_nameis one of the above variants. (please refer to thislinkto install, update, or getgit.)UsageCommand line interfaceTo verify FelooPy's command line interface (CLI) accessibility, open a bash, activate the virtual environment or use the global environment with FelooPy installed, and execute either of the following commands:feloopy-vorflp-vDetailsNext, you can create your optimization project:flpproject--name=testThis command opens a GUI interface to assist with placing the project folder and prints the project directory for you to navigate using thecdcommand.The FelooPy's optimization project structure is as follows:test├──data
│├──final
│├──processed
│└──raw
├──debug.ipynb
├──log.txt
├──main.py
├──modules
│└──__init__.py
└──results├──figures├──tables└──textsNote that at specific project progress levels, you can create backups from the project root using:flpbackupThis generates a backup file, preserving the project progress up to a specific date and time, as illustrated below:test├──backups
│└──bkp-on-2023-12-05-at-21-00-00.zip
├──data
│├──final
│├──processed
│└──raw
├──debug.ipynb
├──log.txt
├──main.py
├──modules
│└──__init__.py
└──results├──figures├──tables└──textsTo recover to a specific project state, use the following command from the project root:flprecoverTo clean residuals, execute the following command from the project root:flpcleanQuick startExact optimizationNote: Implementing this example at least requires installing thefeloopy[nano]variant.fromfeloopyimport*# Define a modelm=model('exact','target_model_name','pymprog')# Define variablesx=m.bvar(name='x',dim=0)y=m.pvar(name='y',dim=0,bound=[0,10])# Define constraintsm.con(x+y<=1,label='c1')m.con(x-y>=1,label='c2')# Define an objectivem.obj(x+y)# Solve the modelm.sol(['max'],'glpk')# Report the resultsm.report()Display the output╭─FelooPyv0.2.8───────────────────────────────────────────────────────────────╮
││
│Date:2023-12-04Time:00:00:00│
│Interface:pymprogSolver:glpk│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Model────────────────────────────────────────────────────────────────────────╮
││
│Name:target_model_name│
│Feature:Class:Total:│
│Positivevariable11│
│Binaryvariable11│
│Totalvariables22│
│Objective-1│
│Constraint22│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Solve────────────────────────────────────────────────────────────────────────╮
││
│Method:exactObjectivevalue│
│Status:max│
│optimal1.00│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Metric───────────────────────────────────────────────────────────────────────╮
││
│CPT(microseconds)347.00│
│CPT(hour:min:sec)00:00:00│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Decision─────────────────────────────────────────────────────────────────────╮
││
│x=1.0│
││
╰────────────────────────────────────────────────────────────────────────────────╯Heuristic optimizationfromfeloopyimport*definstance(X):# Define model instancem=model('heuristic','representor_model_name','feloopy',X)# Define variables for the model instancex=m.bvar(name='x',dim=0)y=m.pvar(name='y',dim=0,bound=[0,10])# Define constraints for the model instancem.con(x+y|l|1,label='c1')m.con(x-y|g|1,label='c2')# Define an objective for the model instancem.obj((x-1)**2+(y-1)**2)# Solve the model instancem.sol(['max'],'ga',{'epoch':1000,'pop_size':100})returnm[X]# Make the main modelm=make_model(instance)# Solve the modelm.sol(penalty_coefficient=10)# Report the resultsm.report()Display the output╭─FelooPyv0.2.8───────────────────────────────────────────────────────────────╮
││
│Date:2023-12-04Time:00:00:00│
│Interface:feloopySolver:ga│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Model────────────────────────────────────────────────────────────────────────╮
││
│Name:representor_model_name│
│Feature:Class:Total:│
│Positivevariable11│
│Binaryvariable11│
│Totalvariables22│
│Objective-1│
│Constraint22│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Solve────────────────────────────────────────────────────────────────────────╮
││
│Method:heuristicObjectivevalue│
│Status:max│
│feasible(constrained)1.00│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Metric───────────────────────────────────────────────────────────────────────╮
││
│CPT(microseconds)1.31e+06│
│CPT(hour:min:sec)00:00:01│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Decision─────────────────────────────────────────────────────────────────────╮
││
│x=[1.]│
││
╰────────────────────────────────────────────────────────────────────────────────╯Convex optimizationNote: Implementing this example at least requires installing thefeloopy[mini]variant.fromfeloopyimport*# Define a modelm=model('convex','convex_model_name','cvxpy')# Define variablesx=m.ftvar(name='x',shape=0)# Define constraintsm.con(x<=1,label='c1')m.con(x>=1,label='c2')# Define an objectivem.obj((x-4)**2)# Solve the modelm.sol(['min'],'ecos')# Report the resultsm.report()Display the output╭─FelooPyv0.2.8───────────────────────────────────────────────────────────────╮
││
│Date:2023-12-04Time:00:00:00│
│Interface:cvxpySolver:ecos│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Model────────────────────────────────────────────────────────────────────────╮
││
│Name:convex_model_name│
│Feature:Class:Total:│
│Freevariable11│
│Totalvariables11│
│Objective-1│
│Constraint22│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Solve────────────────────────────────────────────────────────────────────────╮
││
│Method:convexObjectivevalue│
│Status:min│
│optimal9.00│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Metric───────────────────────────────────────────────────────────────────────╮
││
│CPT(microseconds)1.06e+04│
│CPT(hour:min:sec)00:00:00│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Decision─────────────────────────────────────────────────────────────────────╮
││
│x=1.000000005186514│
││
╰────────────────────────────────────────────────────────────────────────────────╯Constraint optimizationNote: Implementing this example at least requires installing thefeloopy[mini]variant.fromfeloopyimport*# Define a modelm=model('constraint','satisfaction_model_name','ortools_cp')# Define variablesx=m.bvar(name='x',dim=0)y=m.ivar(name='y',dim=0,bound=[0,10])# Define constraintsm.con(x+y<=1,label='c1')m.con(x-y>=1,label='c2')# Define an objectivem.obj(x+y)# Solve the modelm.sol(['max'],'ortools')# Report the resultsm.report()Display the output╭─FelooPyv0.2.8───────────────────────────────────────────────────────────────╮
││
│Date:2023-12-04Time:00:00:00│
│Interface:ortools_cpSolver:ortools│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Model────────────────────────────────────────────────────────────────────────╮
││
│Name:satisfier_model_name│
│Feature:Class:Total:│
│Binaryvariable11│
│Integervariable11│
│Totalvariables22│
│Objective-1│
│Constraint22│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Solve────────────────────────────────────────────────────────────────────────╮
││
│Method:constraintObjectivevalue│
│Status:max│
│optimal1.00│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Metric───────────────────────────────────────────────────────────────────────╮
││
│CPT(microseconds)3.65e+04│
│CPT(hour:min:sec)00:00:00│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Decision─────────────────────────────────────────────────────────────────────╮
││
│x=1│
││
╰────────────────────────────────────────────────────────────────────────────────╯Multi-objective optimizationNote: Implementing this example at least requires installing thefeloopy[full]variant.fromfeloopyimport*definstance(X):# Define model instancem=model('heuristic','representor_model_name','pymoo',X)# Define variables for the model instancex=m.pvar(name='x',dim=[2],bound=[-1000,1000])# Define objectives for the model instancem.obj(x[...,0]**2+x[...,1]**2)m.obj((x[...,0]-2)**2+(x[...,1]-2)**2)# Solve the model instancem.sol(['min','min'],'ns-ga-ii',{'n_gen':100},obj_id='all')returnm[X]# Make the main modelm=make_model(instance)# Solve the modelm.sol()# Report the resultsm.report()Display the output╭─FelooPyv0.2.8───────────────────────────────────────────────────────────────╮
││
│Date:2023-12-04Time:00:00:00│
│Interface:pymooSolver:ns-ga-ii│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Model────────────────────────────────────────────────────────────────────────╮
││
│Name:representor_model_name│
│Feature:Class:Total:│
│Positivevariable12│
│Totalvariables12│
│Objective-2│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Solve────────────────────────────────────────────────────────────────────────╮
││
│Method:heuristicObjectivevalue│
│Status:minmin│
│feasible(unconstrained)0.007.83│
│feasible(unconstrained)7.940.00│
│feasible(unconstrained)0.007.70│
│feasible(unconstrained)0.086.82│
│feasible(unconstrained)2.501.57│
│feasible(unconstrained)3.530.91│
│feasible(unconstrained)0.704.01│
│feasible(unconstrained)0.305.26│
│feasible(unconstrained)2.381.72│
│feasible(unconstrained)5.170.31│
│feasible(unconstrained)2.021.99│
│feasible(unconstrained)6.780.05│
│feasible(unconstrained)0.634.18│
│feasible(unconstrained)5.630.22│
│feasible(unconstrained)3.910.72│
│feasible(unconstrained)1.282.96│
│feasible(unconstrained)1.063.46│
│feasible(unconstrained)5.420.25│
│feasible(unconstrained)2.621.50│
│feasible(unconstrained)0.584.28│
│feasible(unconstrained)6.280.11│
│feasible(unconstrained)6.140.15│
│feasible(unconstrained)0.265.39│
│feasible(unconstrained)0.365.07│
│feasible(unconstrained)3.420.98│
│feasible(unconstrained)2.961.23│
│feasible(unconstrained)1.183.19│
│feasible(unconstrained)3.690.83│
│feasible(unconstrained)1.542.53│
│feasible(unconstrained)4.490.50│
│feasible(unconstrained)1.772.25│
│feasible(unconstrained)2.151.88│
│feasible(unconstrained)0.185.85│
│feasible(unconstrained)0.205.70│
│feasible(unconstrained)3.760.79│
│feasible(unconstrained)1.472.61│
│feasible(unconstrained)4.630.46│
│feasible(unconstrained)6.450.10│
│feasible(unconstrained)6.970.04│
│feasible(unconstrained)7.350.01│
│feasible(unconstrained)3.301.03│
│feasible(unconstrained)3.061.18│
│feasible(unconstrained)0.424.80│
│feasible(unconstrained)5.300.28│
│feasible(unconstrained)5.780.21│
│feasible(unconstrained)2.301.78│
│feasible(unconstrained)0.973.72│
│feasible(unconstrained)0.853.75│
│feasible(unconstrained)4.820.42│
│feasible(unconstrained)1.832.18│
│feasible(unconstrained)7.200.02│
│feasible(unconstrained)1.143.32│
│feasible(unconstrained)5.980.17│
│feasible(unconstrained)7.730.00│
│feasible(unconstrained)2.851.32│
│feasible(unconstrained)1.622.42│
│feasible(unconstrained)0.773.91│
│feasible(unconstrained)4.240.59│
│feasible(unconstrained)4.990.38│
│feasible(unconstrained)0.494.54│
│feasible(unconstrained)5.900.19│
│feasible(unconstrained)0.116.39│
│feasible(unconstrained)0.096.75│
│feasible(unconstrained)0.096.58│
│feasible(unconstrained)0.524.44│
│feasible(unconstrained)7.080.03│
│feasible(unconstrained)1.422.73│
│feasible(unconstrained)1.672.36│
│feasible(unconstrained)0.165.98│
│feasible(unconstrained)0.126.19│
│feasible(unconstrained)3.151.11│
│feasible(unconstrained)2.201.84│
│feasible(unconstrained)1.942.07│
│feasible(unconstrained)7.510.01│
│feasible(unconstrained)0.464.65│
│feasible(unconstrained)1.352.84│
│feasible(unconstrained)4.750.44│
│feasible(unconstrained)6.600.07│
│feasible(unconstrained)7.570.01│
│feasible(unconstrained)0.773.82│
│feasible(unconstrained)3.201.08│
│feasible(unconstrained)1.912.11│
│feasible(unconstrained)0.374.96│
│feasible(unconstrained)4.980.38│
│feasible(unconstrained)2.711.40│
│feasible(unconstrained)0.116.28│
│feasible(unconstrained)0.993.56│
│feasible(unconstrained)7.840.00│
│feasible(unconstrained)0.106.51│
│feasible(unconstrained)0.235.54│
│feasible(unconstrained)2.801.35│
│feasible(unconstrained)1.292.91│
│feasible(unconstrained)0.993.60│
│feasible(unconstrained)4.040.67│
│feasible(unconstrained)0.434.72│
│feasible(unconstrained)6.590.09│
│feasible(unconstrained)4.360.55│
│feasible(unconstrained)1.402.78│
│feasible(unconstrained)4.370.54│
│feasible(unconstrained)4.120.64│
│payoff00.007.83│
│payoff17.940.00│
│max7.947.83│
│ave2.902.40│
│std2.422.20│
│min0.000.00│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Metric───────────────────────────────────────────────────────────────────────╮
││
│CPT(microseconds)1.58e+06│
│CPT(hour:min:sec)00:00:01│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Decision─────────────────────────────────────────────────────────────────────╮
││
│x[0]=[0.028609389086682313,1.9859341076320334]│
│x[1]=[0.006622432714834758,1.9993559166051682]│
││
╰────────────────────────────────────────────────────────────────────────────────╯Multi-attribute decision-makingNote: Implementing this example at least requires installing thefeloopy[mini]variant.fromfeloopyimport*# Define a modelm=madm('ahp','ahp_model','pydecision')# Define criteria pairwise comparison matrixm.add_cpcm([[1,1/3,1/5,1,1/4,1/2,3],[3,1,1/2,2,1/3,3,3],[5,2,1,4,5,6,5],[1,1/2,1/4,1,1/4,1,2],[4,3,1/5,4,1,3,2],[2,1/3,1/6,1,1/3,1,1/3],[1/3,1/3,1/5,1/2,1/2,3,1]])# Define solve methodm.sol()# Report the resultsm.report(show_tensors=True)Display the output╭─FelooPyv0.2.8───────────────────────────────────────────────────────────────╮
││
│Date:2023-12-04Time:00:00:00│
│Interface:pydecisionSolver:ahp_method│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Model────────────────────────────────────────────────────────────────────────╮
││
│Name:ahp_model│
│cpm_defined│
│Numberofcriteria:7│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Solve────────────────────────────────────────────────────────────────────────╮
││
│Method:ahp_method│
│Status:feasible(solved)│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Metric───────────────────────────────────────────────────────────────────────╮
││
│Inconsistency:0.1094│
│CPT(microseconds):228│
│CPT(hour:min:sec):00:00:00│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Decision─────────────────────────────────────────────────────────────────────╮
││
│wv=[0.072,0.1518,0.3668,0.0734,0.2064,0.0612,0.0685]│
││
╰────────────────────────────────────────────────────────────────────────────────╯Uncertain optimizationNote: Implementing this example at least requires installing thefeloopy[full]variant.fromfeloopyimport*# Define a modelm=model('uncertain','mean_varience_portfolio','rsome_ro')# Define parametersn=150i=np.arange(1,n+1)p=1.15+i*0.05/150sigma=0.05/450*(2*i*n*(n+1))**0.5phi=5Q=np.diag(sigma**2)# Define variablesx=m.ptvar('x',[n])# Define an objectivem.obj(p@x-phi*m.quad(x,Q))# Define constraintsm.con(x.sum()==1)# Solve the modelm.sol(['max'],'ecos')# Report the resultsm.report()Display the output╭─FelooPyv0.2.8───────────────────────────────────────────────────────────────╮
││
│Date:2023-12-04Time:00:00:00│
│Interface:rsome_roSolver:ecos│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Model────────────────────────────────────────────────────────────────────────╮
││
│Name:mean_varience_portfolio│
│Feature:Class:Total:│
│Positivevariable1150│
│Totalvariables1150│
│Objective-1│
│Constraint12│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Solve────────────────────────────────────────────────────────────────────────╮
││
│Method:exactObjectivevalue│
│Status:max│
│optimal*1.19│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Metric───────────────────────────────────────────────────────────────────────╮
││
│CPT(microseconds)6.67e+04│
│CPT(hour:min:sec)00:00:00│
││
╰────────────────────────────────────────────────────────────────────────────────╯
╭─Decision─────────────────────────────────────────────────────────────────────╮
││
│x[0]=2.7743755325232772e-11│
│x[1]=2.8092100079904077e-11│
│x[2]=2.844887876112531e-11│
│x[3]=2.8814401303430977e-11│
│x[4]=2.918899301047485e-11│
│x[5]=2.957299551998146e-11│
│x[6]=2.9966767842550535e-11│
│x[7]=3.0370687480921945e-11│
│x[8]=3.078515163671375e-11│
│x[9]=3.1210578513200454e-11│
│x[10]=3.164740872293794e-11│
│x[11]=3.209610681028805e-11│
│x[12]=3.255716289959618e-11│
│x[13]=3.3031094482143494e-11│
│x[14]=3.351844835467661e-11│
│x[15]=3.401980272547408e-11│
│x[16]=3.4535769504910366e-11│
│x[17]=3.5066996799521295e-11│
│x[18]=3.56141716311133e-11│
│x[19]=3.6178022905073607e-11│
│x[20]=3.675932465476433e-11│
│x[21]=3.735889959258624e-11│
│x[22]=3.797762300220891e-11│
│x[23]=3.861642701047935e-11│
│x[24]=3.927630528350411e-11│
│x[25]=3.995831819627192e-11│
│x[26]=4.066359853329355e-11│
│x[27]=4.139335778434345e-11│
│x[28]=4.214889310940747e-11│
│x[29]=4.2931595057495157e-11│
│x[30]=4.3742956136354445e-11│
│x[31]=4.4584580344059104e-11│
│x[32]=4.545819379186986e-11│
│x[33]=4.636565656614686e-11│
│x[34]=4.730897600198497e-11│
│x[35]=4.8290321568244213e-11│
│x[36]=4.9312041597312165e-11│
│x[37]=5.0376682131595416e-11│
│x[38]=5.1487008206677906e-11│
│x[39]=5.264602794597013e-11│
│x[40]=5.385701991049141e-11│
│x[41]=5.512356422858367e-11│
│x[42]=5.644957812869436e-11│
│x[43]=5.78393566196926e-11│
│x[44]=5.929761920905631e-11│
│x[45]=6.08295637309449e-11│
│x[46]=6.244092857699688e-11│
│x[47]=6.413806490058805e-11│
│x[48]=6.592802070660395e-11│
│x[49]=6.781863917117108e-11│
│x[50]=6.981867407616489e-11│
│x[51]=7.19379259316092e-11│
│x[52]=7.418740323464869e-11│
│x[53]=7.657951443926595e-11│
│x[54]=7.912829766535345e-11│
│x[55]=8.184969707238052e-11│
│x[56]=8.47618973118352e-11│
│x[57]=8.788573077302652e-11│
│x[58]=9.12451767466872e-11│
│x[59]=9.48679775894747e-11│
│x[60]=9.878640510238738e-11│
│x[61]=1.0303822156654325e-10│
│x[62]=1.0766789557802846e-10│
│x[63]=1.1272815508182758e-10│
│x[64]=1.1828199202308608e-10│
│x[65]=1.244052798588321e-10│
│x[66]=1.311902348645078e-10│
│x[67]=1.3875005793442852e-10│
│x[68]=1.47225257515537e-10│
│x[69]=1.567924144120609e-10│
│x[70]=1.6767657252930607e-10│
│x[71]=1.801691484175006e-10│
│x[72]=1.9465447734618066e-10│
│x[73]=2.1165030742284027e-10│
│x[74]=2.3187164592398663e-10│
│x[75]=2.56335359142733e-10│
│x[76]=2.8653937163816974e-10│
│x[77]=3.2478591996278845e-10│
│x[78]=3.7479878731145546e-10│
│x[79]=4.4296927756312283e-10│
│x[80]=5.409807300816127e-10│
│x[81]=6.916461389651319e-10│
│x[82]=9.492864940447693e-10│
│x[83]=1.5969233347143176e-09│
│x[84]=4.949433819670803e-09│
│x[85]=0.0004968283335643696│
│x[86]=0.0011764259492214814│
│x[87]=0.0018405992939069312│
│x[88]=0.0024897413618520515│
│x[89]=0.0031243765482852014│
│x[90]=0.003745023440277047│
│x[91]=0.004352162904818471│
│x[92]=0.004946242752043668│
│x[93]=0.005527684632444081│
│x[94]=0.0060968889078715114│
│x[95]=0.0066542377734675326│
│x[96]=0.00720009720815459│
│x[97]=0.0077348182350865735│
│x[98]=0.008258737820428677│
│x[99]=0.008772179596906758│
│x[100]=0.009275454502787923│
│x[101]=0.009768861374959598│
│x[102]=0.010252687510635725│
│x[103]=0.010727209202439966│
│x[104]=0.011192692248249404│
│x[105]=0.01164939243629286│
│x[106]=0.012097556006046329│
│x[107]=0.012537420085608268│
│x[108]=0.012969213106455858│
│x[109]=0.013393155196571777│
│x[110]=0.013809458553019398│
│x[111]=0.014218327795040875│
│x[112]=0.014619960298729076│
│x[113]=0.015014546514330065│
│x[114]=0.015402270267140387│
│x[115]=0.015783309042941812│
│x[116]=0.016157834258887647│
│x[117]=0.016526011520642342│
│x[118]=0.016888000866597877│
│x[119]=0.01724395699989295│
│x[120]=0.017594029508926672│
│x[121]=0.017938363077046653│
│x[122]=0.01827709768198845│
│x[123]=0.01861036878567794│
│x[124]=0.018938307514905547│
│x[125]=0.019261040833404748│
│x[126]=0.019578691705782456│
│x[127]=0.019891379253773885│
│x[128]=0.020199218905216167│
│x[129]=0.020502322536145638│
│x[130]=0.020800798606385958│
│x[131]=0.02109475228896583│
│x[132]=0.021384285593700505│
│x[133]=0.021669497485234675│
│x[134]=0.021950483995841062│
│x[135]=0.02222733833323745│
│x[136]=0.022500150983681487│
│x[137]=0.022769009810585366│
│x[138]=0.023034000148868413│
│x[139]=0.02329520489526858│
│x[140]=0.023552704594807523│
│x[141]=0.023806577523602854│
│x[142]=0.024056899768205388│
│x[143]=0.02430374530163019│
│x[144]=0.024547186056240292│
│x[145]=0.02478729199363727│
│x[146]=0.025024131171698008│
│x[147]=0.0252577698088989│
│x[148]=0.025488272346048852│
│x[149]=0.025715701381297428│
││
╰────────────────────────────────────────────────────────────────────────────────╯DocumentationWork in Progress!CitationTo cite or give credit to FelooPy in publications, projects, presentations, web pages, blog posts, etc. please use the following entries:LaTeX:@software{ktafakkori2022Sep,author={Keivan Tafakkori},title={{FelooPy: An integrated optimization environment for AutoOR in Python}},year={2022},month=sep,publisher={GitHub},url={https://github.com/ktafakkori/feloopy/}}APA:Tafakkori, K. (2022). FelooPy: An integrated optimization environment for AutoOR in Python [Python Library]. Retrieved from https://github.com/ktafakkori/feloopy (Original work published September 2022).In-text:Note1: Please write the version you used, the latest is v0.2.8.Note2: Using secondary interfaces or solvers might also require a citation to their projects.FelooPy (v0.2.8) was used in conjunction with [interface x] (v0.0.0) (exceptfeloopyitself) as the optimization interface and [solver y] (v0.0.0) as the optimization solver.LicenseCopyright K. Tafakkori, 2022-2024
  See the LICENSE file for copyright information.