diff --git a/docs/release_notes.md b/docs/release_notes.md index 03d0329..06b41d4 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -8,7 +8,11 @@ ### Minor Changes and Bug Fixes -* +* Write the templates that use the BundleSolver for the BundleSolver 2.0, whose master is configured by the new `MPBCfg.txt` (HiGHS) or `MPBCfg_grb.txt` (Gurobi). See [PR #116](https://github.com/SPSUnipi/pySMSpp/pull/116) + +* Add templates for the two-stage instances whose scenario is a unit commitment: the MILP (`TSSBSCfg-IP.txt`), the Lagrangian dual of the scenarios (`TSSBSCfg-LD-IP.txt`), the chain of two duals (`TSSBSCfg-LDLD.txt`), the recursive Lagrangian dual (`TSSBSCfg-LDrec.txt`) and the PrimalProximalHeur, which gives a feasible solution (`TSSBSCfg-PPH.txt`), the three duals also with a ParallelBundleSolver (`-par`), and the continuous relaxation with Gurobi (`TSSBSCfg-LP.txt`) and with PIPS-IPM++ (`TSSBSCfg-PIPS.txt`). See [PR #116](https://github.com/SPSUnipi/pySMSpp/pull/116) + +* Add the templates of the BendersDecompositionSolver for the Benders form of a two-stage problem (`TSSBSCfg-BDS.txt`, `BDSMCfg.txt`, `BDSSCfg.txt`), and of the InvestmentBlock over a TSSB or an MSSB (`TSSBSCfg-IB.txt`, `BSCfg-IB.txt`). The Solver of the block inside an InvestmentBlock is given by its OBlockConfig (`IBOCfg.txt`, `IFCfg.txt`) through the `InvestmentBlock` entry of `InnerBCfg.txt`, which `smspp_investmentblock_solver` reads by default, in `InvestmentBlock/` and in `TSSBlock/`. See [PR #116](https://github.com/SPSUnipi/pySMSpp/pull/116) ## Version v0.0.14 diff --git a/pysmspp/data/blocks/InvestmentBlock.csv b/pysmspp/data/blocks/InvestmentBlock.csv index 4c8925a..b95db65 100644 --- a/pysmspp/data/blocks/InvestmentBlock.csv +++ b/pysmspp/data/blocks/InvestmentBlock.csv @@ -10,6 +10,7 @@ InvestmentBlock,DisinvestmentCost,Variable,Variable,double,-|NumAssets,-,,requir InvestmentBlock,LowerBound,Variable,Variable,double,-|NumAssets,-,,optional,Minimum capacity of each asset InvestmentBlock,UpperBound,Variable,Variable,double,-|NumAssets,-,,optional,Maximum capacity of each asset InvestmentBlock,InstalledQuantity,Variable,Variable,double,-|NumAssets,-,,optional,Installed capacity of each asset +InvestmentBlock,Integer,Variable,Variable,int,-|NumAssets,-,,optional,Nonzero if the design of the asset is integer (e.g. the number of its modules) InvestmentBlock,Constraints_LowerBound,Variable,Variable,double,-|NumConstraints,-,,optional,Lower bound of each constraint InvestmentBlock,Constraints_UpperBound,Variable,Variable,double,-|NumConstraints,-,,optional,Upper bound of each constraint InvestmentBlock,Constraints_A,Variable,Variable,double,-|NumConstraints-NumAssets,-,,optional,Coefficients of matrix of the linear constraints diff --git a/pysmspp/data/configs/InvestmentBlock/BSCfg_grb.txt b/pysmspp/data/configs/InvestmentBlock/BSCfg_grb.txt index 792032c..d395524 100644 --- a/pysmspp/data/configs/InvestmentBlock/BSCfg_grb.txt +++ b/pysmspp/data/configs/InvestmentBlock/BSCfg_grb.txt @@ -3,13 +3,11 @@ # # Gurobi variant of BSCfg.txt: a BlockSolverConfig for the inner UCBlock-style # block of an InvestmentBlock, to be solved by GRBMILPSolver as the LP -# relaxation (intRelaxIntVars 1) of the underlying MIP. Presolve is disabled -# for reproducibility (it can transform the model and shift the optimal vertex -# on degenerate LPs), and NumericFocus is raised because the InvestmentBlock -# inner LPs are badly scaled (capacities, snapshot-weighted costs and VOLL span -# many orders of magnitude), which makes HiGHS fail on some iterates. -# -# Antonio Frangioni, Donato Meoli +# relaxation (intRelaxIntVars 1) of the underlying MIP, with the presolve and +# the numerical focus of Gurobi left at their default: the inner LP is solved +# at every evaluation of the InvestmentFunction, and with Presolve 0 and +# NumericFocus 3 each evaluation cost 2.5 times as much, which the badly +# scaled LPs that make HiGHS fail (see BSCfg.txt) do not need with Gurobi. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -33,7 +31,7 @@ ComputeConfig # exact type of the ComputeConfig object 1 # f_diff == 0 ==> all non-provided parameters are set to the default value # f_diff == 1 ==> all non-provided parameters are not changed -5 # number of integer parameters +3 # number of integer parameters # now all the integer parameters intLogVerb 0 # LogVerb, log verbosity of the MILPSolver @@ -41,8 +39,6 @@ intRelaxIntVars 1 # nonzero if the continuous relaxation is solved intCutSepPar 7 # separate user cuts + lazy constraints # All specific GUROBI parameter -Presolve 0 # disable presolve for reproducibility -NumericFocus 3 # maximum numerical precision focus 0 # number of double parameters diff --git a/pysmspp/data/configs/InvestmentBlock/BSPar-int.txt b/pysmspp/data/configs/InvestmentBlock/BSPar-int.txt new file mode 100644 index 0000000..8354f9a --- /dev/null +++ b/pysmspp/data/configs/InvestmentBlock/BSPar-int.txt @@ -0,0 +1,72 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - BSPar-int.txt - - - - - - - - - - - - - - - +# +# A BlockSolverConfig for an InvestmentBlock whose design is integer, e.g., +# the number of modules of a modular asset: the BundleSolver of BSPar.txt +# keeping it integer, with a trust region of radius 1 and a master that is a +# mixed-integer linear problem [see intIntVars]. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +BundleSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the BundleSolver + +*BundleCfg.txt + + +1 # f_diff == 1 ==> only the entries below are changed + +5 # number of integer parameters + +# now all the integer parameters +intIntVars 1 # the integer design, e.g., the modules, stay integer +intMPPrimal 1 # the primal master, where the design is the Variable +intMPV2Form 1 # raw form: the Variable of the master are the design itself +intMPStbl 4 # 4 = trust region || x - x_bar ||_inf <= t, a MILP master +intRstAlg 2 # parameter to handle the reset of the algorithm + +1 # number of double parameters + +# now all the double parameters +dbltInit 1 # radius of the trust region, in modules + +1 # number of string parameters + +# now all the string parameters +strMPBSolverCfg MPBCfg-IP.txt # the master, which keeps the integers + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of 1st ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END BSPar-int.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/InvestmentBlock/BSPar.txt b/pysmspp/data/configs/InvestmentBlock/BSPar.txt index e783924..c796987 100644 --- a/pysmspp/data/configs/InvestmentBlock/BSPar.txt +++ b/pysmspp/data/configs/InvestmentBlock/BSPar.txt @@ -1,12 +1,9 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - BSPar.txt - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - BSPar.txt - - - - - - - - - - - - - - - - # -# A txt description of a BlockSolverConfig for an InvestmentBlock to be -# solved by a BundleSolver +# A BlockSolverConfig for an InvestmentBlock to be solved by a +# BundleSolver [see BundleCfg.txt]. # -# Antonio Frangioni -# -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BlockSolverConfig # exact type of the Configuration object @@ -21,93 +18,9 @@ BundleSolver # name of Solver # now all the ComputeConfig # 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# ComputeConfig of the LagrangianDualSolver; it mostly is the -# ComputeConfig of the inner Solver, which is a [Parallel]BundleSolver - -ComputeConfig # exact type of the ComputeConfig object - -1 # f_diff == 0 ==> all non-provided parameters are set to the default value - # f_diff == 1 ==> all non-provided parameters are not changed - -23 # number of integer parameters - -# now all the integer parameters -intDoEasy 0 # do easy components for (some) LagBFunction -intMaxIter 10000 # max number of iterations for each call -intMaxThread 6 # MaxThread, max number of new tasks to spawn -intLogVerb 16 # log verbosity of main Bundle algorithm -intWZNorm 2 # which norm to use in the norm-based stopping condition -intBPar1 20 # discard items when they have been useless for iterations -intBPar2 1000 # max bundle size per component -intBPar3 1 # max n. of items to fetch from Fi() at each iteration -intBPar4 1 # min n. of items to fetch from Fi() at each iteration -intBPar6 0 # second parameter for dynamic max n. of items per iteration -intBPar7 15 # how to deal with the global pools -intMnSSC 0 # min number of consecutive SS with the same t for a t increase -intMnNSC 3 # min number of consecutive NS with the same t for a t decrease -inttSPar1 0 # long-term t-strategy (0 = none, 4 = soft, 8 = hard, 12 = balancing) -intMaxNrEvls 2 # maximum number of function evaluations at each iteration -intMPName 8 # MP solver: 0 = QPP, 7 = Cplex/Gurobi with quadratic stabilization - # + 8 = check for duplicate linearizations - -# QPPenalty's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - - - -intMPlvl 20 # log verbosity of Master Problem -intQPmp1 0 # MxAdd, how many variables can be added to the base at each - # iteration in BMinQuad (0 = at will) -intQPmp2 0 # MxRmv, how many variables can be removed from the base at each - # iteration in BMinQuad (0 = at will) - -# OSIMPSolver's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - - -intOSImp1 1 # Osi(Cpx/Grb)Solver algorithm (0 = auto (default), 1 = primal, 2 = dual, 3 = network, 4 = barrier, 5 = sifting, 6 = concurrent) -intOSImp2 1 # pre-processing (reduction) -intOSImp3 1 # threads -intRstAlg 2 # parameter to handle the reset of the algorithm - -16 # number of double parameters - -# now all the double parameters -dblRelAcc 1e-4 # relative accuracy required to solution -dblNZEps 1e-4 # stopping parameter: threshold to declare 0 the || residual || -dbltStar -100 # stopping parameter: multiplied to || residual || to estimate gap -dblBPar5 4 # first parameter for dynamic max n. of items per iteration -dblm1 -0.30 # a NS is possible if (~) Fi( Lambda1 ) >= Fi( Lambda ) + | m1 | v* -dblm2 0.90 # a SS is possible if Fi( Lambda1 ) <= Fi( Lambda ) + ( 1 - m2 ) v* -dblm3 0.99 # a NR is computed if \sigma^* < - t * m3 * || z* || -dblmxIncr 10 # max increase of t -dblmnIncr 1.5 # min increase of t (each time it is increased) -dblmxDecr 0.1 # max decrease of t -dblmnDecr 0.66 # min decrease of t (each time it is decreased) -dbltMaior 1e+6 # maximum value for t -dbltMinor 1e-10 # minimum value for t -dbltInit 1e+0 # initial value for t -dbltSPar2 1e-2 # parameter for the long-term t-strategy -dblCtOff 0.01 # cut-off factor for pricing in MinQuad - -0 # number of string parameters - -# now all the string parameters -#str_LagBF_BSCfg LPBSCfg.txt # BlockSolverConfig for the LagBFunctions -# not needed if intDoEasy >= 1 && USE_BundleSolver > 0, this is done "by hand" - -0 # number of vector-of-int parameters - -# now all the vector-of-int parameters -# [none] - -0 # number of vector-of-double parameters - -# now all the vector-of-double parameters -# [none] - -0 # number of vector-of-string parameters - -# now all the vector-of-string parameters -# [none] +# ComputeConfig of the BundleSolver -# pointer to the "extra" Configuration -* # [none] +*BundleCfg.txt # end of 1st ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/InvestmentBlock/BundleCfg.txt b/pysmspp/data/configs/InvestmentBlock/BundleCfg.txt new file mode 100644 index 0000000..94df851 --- /dev/null +++ b/pysmspp/data/configs/InvestmentBlock/BundleCfg.txt @@ -0,0 +1,82 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - BundleCfg.txt - - - - - - - - - - - - - - - +# +# The ComputeConfig of the BundleSolver that solves an InvestmentBlock, +# shared by BSPar.txt and BSPar-int.txt. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +17 # number of integer parameters + +# now all the integer parameters +intMPStbl 0 # stabilization: 0 = proximal, 1 = level, 2 = doubly +intDoEasy 0 # do easy components for (some) LagBFunction +intMaxIter 10000 # max number of iterations for each call +intMaxThread 6 # MaxThread, max number of new tasks to spawn +intLogVerb 16 # log verbosity of main Bundle algorithm +intWZNorm 2 # which norm to use in the norm-based stopping condition +intBPar1 20 # discard items when they have been useless for +intBPar2 1000 # max bundle size per component +intBPar3 1 # max n. of items to fetch from Fi() at each iteration +intBPar4 1 # min n. of items to fetch from Fi() at each iteration +intBPar6 0 # second parameter for dynamic max n. of items per +intBPar7 15 # how to deal with the global pools +intMnSSC 0 # min number of consecutive SS with the same t for a t +intMnNSC 3 # min number of consecutive NS with the same t for a t +inttSPar1 12 # long-term t-strategy (0 = none, 4 = soft, 8 = hard, 12 = +intMaxNrEvls 2 # maximum number of function evaluations at each iteration + +intRstAlg 2 # parameter to handle the reset of the algorithm + +15 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-4 # relative accuracy required to solution +dblNZEps 1e-4 # stopping parameter: threshold to declare 0 the || +dbltStar -100 # stopping parameter: multiplied to || residual || to +dblBPar5 4 # first parameter for dynamic max n. of items per iteration +dblm1 -0.30 # a NS is possible if (~) Fi( Lambda1 ) >= Fi( Lambda ) + | +dblm2 0.90 # a SS is possible if Fi( Lambda1 ) <= Fi( Lambda ) + ( 1 - +dblm3 0.99 # a NR is computed if \sigma^* < - t * m3 * || z* || +dblmxIncr 10 # max increase of t +dblmnIncr 1.5 # min increase of t (each time it is increased) +dblmxDecr 0.1 # max decrease of t +dblmnDecr 0.66 # min decrease of t (each time it is decreased) +dbltMaior 1e+6 # maximum value for t +dbltMinor 1e-10 # minimum value for t +dbltInit 1e+0 # initial value for t +dbltSPar2 1e-2 # parameter for the long-term t-strategy + +1 # number of string parameters + +# now all the string parameters +#str_LagBF_BSCfg LPBSCfg.txt # BlockSolverConfig for the LagBFunctions +# not needed if intDoEasy >= 1 && USE_BundleSolver > 0, this is done "by +strMPBSolverCfg MPBCfg.txt # BlockSolverConfig for the MasterProblemBlock's + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END BundleCfg.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/InvestmentBlock/IBOCfg.txt b/pysmspp/data/configs/InvestmentBlock/IBOCfg.txt new file mode 100644 index 0000000..9012f9b --- /dev/null +++ b/pysmspp/data/configs/InvestmentBlock/IBOCfg.txt @@ -0,0 +1,54 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - IBOCfg.txt - - - - - - - - - - - - - - - - +# +# The OBlockConfig of an InvestmentBlock: it reformulates the bounds on the +# investment, and gives the InvestmentFunction its ComputeConfig [see +# IFCfg.txt], which holds the BlockSolverConfig of the inner Block. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +OBlockConfig # exact type of the Configuration object + +1 # the BlockConfig is a "differential" one + +2 # version of the BlockConfig format + +# the Configuration for the structure, i.e., the tree of sub-Block +* # [none] + +# static_constraints: the bounds l <= x <= u on the investment are +# reformulated as 0 <= x <= u - l, the only form BundleSolver handles +SimpleConfiguration +1 + +# dynamic_constraints +* # [none] + +# static_variables +* # [none] + +# dynamic_variables +* # [none] + +# objective +* # [none] + +# is_feasible +* # [none] + +# is_optimal +* # [none] + +# solution +* # [none] + +# extra +* # [none] + +# the ComputeConfig of the Objective, i.e., of the InvestmentFunction +*IFCfg.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END IBOCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/InvestmentBlock/IFCfg.txt b/pysmspp/data/configs/InvestmentBlock/IFCfg.txt new file mode 100644 index 0000000..2f5bbc1 --- /dev/null +++ b/pysmspp/data/configs/InvestmentBlock/IFCfg.txt @@ -0,0 +1,37 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - IFCfg.txt - - - - - - - - - - - - - - - - - +# +# The ComputeConfig of the InvestmentFunction, which the OBlockConfig of the +# InvestmentBlock gives to its Objective [see IBOCfg.txt]: in the extra +# Configuration, the BlockSolverConfig of the inner Block, here a UCBlock (or +# a TwoStageStochasticBlock of UCBlock). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 1 ==> all non-provided parameters are not changed + +0 # number of integer parameters + +0 # number of double parameters + +0 # number of string parameters: no strOutputFilename, so the investments + # and the values of the Function are not written to a file + +0 # number of vector-of-int parameters + +0 # number of vector-of-double parameters + +0 # number of vector-of-string parameters + +# pointer to the "extra" Configuration: the BlockSolverConfig of the inner +# Block of the InvestmentFunction +SimpleConfiguration> +1 # the number of elements in the map +BlockSolverConfig *BSCfg.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END IFCfg.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/InvestmentBlock/InnerBCfg.txt b/pysmspp/data/configs/InvestmentBlock/InnerBCfg.txt new file mode 100644 index 0000000..d7436db --- /dev/null +++ b/pysmspp/data/configs/InvestmentBlock/InnerBCfg.txt @@ -0,0 +1,18 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - InnerBCfg.txt - - - - - - - - - - - - - - - - +# +# A map from classname to BlockConfig, which smspp_investmentblock_solver +# reads by default (-B InnerBCfg.txt): the InvestmentBlock gets IBOCfg.txt, +# which gives the Solver of its inner Block (IFCfg.txt, BSCfg.txt). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +SimpleConfiguration> + +1 # the number of elements in the map +InvestmentBlock *IBOCfg.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END InnerBCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/InvestmentBlock/MPBCfg-IP.txt b/pysmspp/data/configs/InvestmentBlock/MPBCfg-IP.txt new file mode 100644 index 0000000..32536d0 --- /dev/null +++ b/pysmspp/data/configs/InvestmentBlock/MPBCfg-IP.txt @@ -0,0 +1,73 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - MPBCfg-IP.txt - - - - - - - - - - - - - - - +# +# A BlockSolverConfig for the :MILPSolver of the MasterProblemBlock of +# BSPar-int.txt, which keeps the integer Variable integer [see MPCfg.txt]. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +#GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +*MPCfg.txt + + +1 # f_diff == 1 ==> only the entries below are changed + +2 # number of integer parameters + +# now all the integer parameters +intRelaxIntVars 0 # the integer design stays integer +intCutSepPar 0 # no Block separates cuts in the master + +1 # number of double parameters + +# now all the double parameters +mip_feasibility_tolerance 1e-10 + # integrality as tight as HiGHS allows: the bundle + # rounds the point of the master before evaluating it + +0 # number of string parameters + +# now all the string parameters +# [none] + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END MPBCfg-IP.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/InvestmentBlock/MPBCfg.txt b/pysmspp/data/configs/InvestmentBlock/MPBCfg.txt new file mode 100644 index 0000000..036b14d --- /dev/null +++ b/pysmspp/data/configs/InvestmentBlock/MPBCfg.txt @@ -0,0 +1,35 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - MPBCfg.txt - - - - - - - - - - - - - - - - +# +# A BlockSolverConfig for the inner :MILPSolver of the MasterProblemBlock +# used by the BundleSolver [see MPCfg.txt]. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +#GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +*MPCfg.txt + +# end of ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END MPBCfg.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/InvestmentBlock/MPBCfg_grb.txt b/pysmspp/data/configs/InvestmentBlock/MPBCfg_grb.txt new file mode 100644 index 0000000..08ba68a --- /dev/null +++ b/pysmspp/data/configs/InvestmentBlock/MPBCfg_grb.txt @@ -0,0 +1,120 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - MPBCfg_grb.txt - - - - - - - - - - - - - - - - +# +# A txt description of a BlockSolverConfig for the inner :MILPSolver of the +# MasterProblemBlock used by the BundleSolver +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +#HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +6 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 1 # nonzero if the continuous relaxation is solved +intCutSepPar 7 # separate user cuts + lazy constraints +intMaxThread 1 # single-threaded for deterministic master reproducibility + +# All specific CPLEX parameter (uncomment based on Solver) +#CPXPARAM_LPMethod 1 # 0 = auto, 1 = primal, 2 = dual, 4 = barrier +#CPXPARAM_Emphasis_Numerical 1 # numerical precision emphasis + +# All specific GUROBI parameter (uncomment based on Solver) +Method 1 # 0 = primal, 1 = dual simplex, 2 = barrier: the multipliers + # of the master ARE the algorithm, and an interior point has + # them only to about 1e-7 relative, which the stopping test + # of the bundle cannot survive; besides, the barrier cannot + # restart from the previous basis, so it re-solves the master + # from scratch at every call, while the simplex re-optimises + # after the new columns for a fraction of the iterations +NumericFocus 1 # 0 = auto, 1..3 = increasing precision focus: the master + # is small and re-solved thousands of times, so whatever + # extra care is asked is paid at every one of them, and 3 + # costs a factor two. 0 is not an option: with it the + # Lagrangian dual answers Unfeas on a hydrothermal instance + # that has a solution, so this is the least care that + # answers right +#Presolve 0 # 0 = off, 1 = conservative, 2 = aggressive (default -1): + # left off deliberately, a master the presolve reduces is + # declared infeasible on tolerance when the model is badly + # scaled, and the bundle reads that as a numerical error + +5 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-08 # relative accuracy required to solution +dblAAccSol 1e-08 # absolute accuracy required to solution +dblRAccSol 1e-08 # relative accuracy of the solution pool + +# The master has to satisfy its own rows *tighter* than the oracle satisfies +# its own feasibility, or the loop cannot end: a step that violates a +# vertical row by less than the default 1e-6 is feasible for the master and +# infeasible for the subproblem, which answers with the very cut that is +# already there, and the same iteration repeats forever. +FeasibilityTol 1e-09 # how much a row of the master may be violated +OptimalityTol 1e-09 # how much a reduced cost of the master may be off + +# All specific HiGHS parameter (uncomment based on Solver) +#primal_feasibility_tolerance 1e-9 +#dual_feasibility_tolerance 1e-9 + +0 # number of string parameters + +# now all the string parameters +# [none] + +#strOutputFile master.lp + +# All specific HiGHS parameter (uncomment based on Solver) +#presolve off # disable presolve for reproducibility +#solver ipm # interior point: converges to analytic center (unique x*) + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END MPBCfg_grb.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/InvestmentBlock/MPCfg.txt b/pysmspp/data/configs/InvestmentBlock/MPCfg.txt new file mode 100644 index 0000000..c95a5c8 --- /dev/null +++ b/pysmspp/data/configs/InvestmentBlock/MPCfg.txt @@ -0,0 +1,97 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - MPCfg.txt - - - - - - - - - - - - - - - - +# +# The ComputeConfig of the :MILPSolver of the MasterProblemBlock used by +# the BundleSolver, shared by MPBCfg.txt and MPBCfg-IP.txt. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +4 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 1 # nonzero if the continuous relaxation is solved +intCutSepPar 7 # separate user cuts + lazy constraints +intMaxThread 1 # single-threaded for deterministic master reproducibility + +# All specific CPLEX parameter (uncomment based on Solver) +# CPXPARAM_LPMethod 1 # 0 = auto, 1 = primal, 2 = dual, 4 = barrier +#CPXPARAM_Emphasis_Numerical 1 # numerical precision emphasis + +# All specific GUROBI parameter (uncomment based on Solver) +# Method 1 # 0 = primal, 1 = dual simplex, 2 = barrier: the multipliers + # of the master ARE the algorithm, and an interior point + # them only to about 1e-7 relative, which the stopping test + # of the bundle cannot survive; besides, the barrier cannot + # restart from the previous basis, so it re-solves the + # from scratch at every call, while the simplex + # after the new columns for a fraction of the iterations +#NumericFocus 1 # 0 = auto, 1..3 = increasing precision focus: the master + # is small and re-solved thousands of times, so whatever + # extra care is asked is paid at every one of them, and 3 + # costs a factor two. 0 is not an option: with it the + # Lagrangian dual answers Unfeas on a hydrothermal instance + # that has a solution, so this is the least care that + # answers right +#Presolve 0 # 0 = off, 1 = conservative, 2 = aggressive (default -1): + # left off deliberately, a master the presolve reduces is + # declared infeasible on tolerance when the model is badly + # scaled, and the bundle reads that as a numerical error + +3 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-08 # relative accuracy required to solution +dblAAccSol 1e-08 # absolute accuracy required to solution +dblRAccSol 1e-08 # relative accuracy of the solution pool + +# The master has to satisfy its own rows *tighter* than the oracle satisfies +# its own feasibility, or the loop cannot end: a step that violates a +# vertical row by less than the default 1e-6 is feasible for the master and +# infeasible for the subproblem, which answers with the very cut that is +# already there, and the same iteration repeats forever. +#FeasibilityTol 1e-09 # how much a row of the master may be violated +#OptimalityTol 1e-09 # how much a reduced cost of the master may be off + +# All specific HiGHS parameter (uncomment based on Solver) +# (not tighter: at 1e-9 the QP solver of HiGHS fails on the master) +#primal_feasibility_tolerance 1e-9 +#dual_feasibility_tolerance 1e-9 + +0 # number of string parameters + +# now all the string parameters +# [none] + +#strOutputFile master.lp + +# All specific HiGHS parameter (uncomment based on Solver) +#presolve off # disable presolve for reproducibility +#solver ipm # interior point: converges to analytic center (unique x*) + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END MPCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/README.md b/pysmspp/data/configs/README.md index d996971..517d283 100644 --- a/pysmspp/data/configs/README.md +++ b/pysmspp/data/configs/README.md @@ -1,7 +1,7 @@ # Description of available configuration files - UCBlock/{uc_solverconfig.txt, OSolCfg.txt} copied from smspp-project/tools/ucblock_solver. -- InvestmentBlock/{BSPar.txt, uc_solverconfig.txt}, copied from smspp-project/InvestmentBlock/test/config. +- InvestmentBlock/{BSPar.txt, BSPar-int.txt, uc_solverconfig.txt}, copied from smspp-project/InvestmentBlock/test/config. - TSSBlock/* copied from smspp-project/tools/tssb_solver. - SVMBlock/* copied from smspp-project/tests/SVMBlock and smspp-project/tools/svm_solver. @@ -9,3 +9,12 @@ For SVMBlock, SVMCfg.txt and SVMCfg-primal.txt are BlockConfig, which is what ch For uc_solverconfig in both folders, the version using Gurobi is also provided under name uc_solverconfig_grb. The template configuration option for OSolCfg.txt allows to extract the most information from tools. + +TSSBlock/TSSBSCfg-IP.txt, TSSBSCfg-LD-IP.txt, TSSBSCfg-LDLD.txt and TSSBSCfg-LDrec.txt solve a two-stage problem whose scenario is a unit commitment with a :MILPSolver, with the Lagrangian dual of the scenarios, with a chain of two duals down to the units and with the recursive Lagrangian dual, respectively; TSSBSCfg-PPH.txt adds to the dual of the scenarios the PrimalProximalHeur, which gives a feasible solution by fixing the design to its mean over the scenarios. They need the BlockConfig InnerBCfg.txt (option -B, i.e., `B="InnerBCfg.txt"` of TSSBSolver); the duals give a bound, and TSSBSCfg-PPH.txt gives a feasible solution with its gap, recovered by the PrimalProximalHeur with the BlockSolverConfig of its strRecoveryBSC, while ISCfg-PPH.txt (its str_LDSlv_ISCfg) sets the iterations and the accuracy of the Lagrangian dual at each proximal step. TSSBSCfg-LD-IP-par.txt, TSSBSCfg-LDLD-par.txt and TSSBSCfg-LDrec-par.txt are the same three duals with a ParallelBundleSolver, which evaluates the components of an iteration in 8 threads. TSSBSCfg-LP.txt solves the continuous relaxation with a :MILPSolver, and TSSBSCfg-PIPS.txt (with PIPSCfg.txt) the same linear program with PIPS-IPM++, under mpirun. + +TSSBlock/TSSBSCfg-BDS.txt attaches a BendersDecompositionSolver, configured by BDSCfg.txt (whose master and subproblems are those of BDSMCfg.txt and BDSSCfg.txt), to the Benders form of a two-stage problem, which smspp_tssb_solver assembles when given -k (`k=None` of TSSBSolver), also around a MultiStageStochasticBlock, whose leaves are then the subproblems. TSSBSCfg-BDS-LD.txt is the same with the subproblems solved by the recursive Lagrangian dual of TSSBSCfg-LDrec.txt and a feasible solution recovered at the design of the master (strRecoveryBSC in BDSCfg-LD.txt, each subproblem a MILP of BSCfg1-IP.txt), and TSSBSCfg-BDS-CVX-LD.txt the latter with the master solved by the BundleSolver of BDSMCfg-CVX.txt (the convex regime), which recovers the feasible solution at the best point of its bundle. TSSBlock/TSSBSCfg-IB.txt is the ad hoc Benders decomposition of the same problem: a BundleSolver on an InvestmentBlock over the TSSB or the MSSB (the `investment_outside` form of pypsa2smspp), whose inner Block is solved whole at every evaluation by BSCfg-IB.txt; with the BlockConfig InnerBCfg-LD.txt instead of InnerBCfg.txt the inner Block is solved by the recursive Lagrangian dual (IBOCfg-LD.txt, IFCfg-LD.txt). + +InvestmentBlock/BSPar-int.txt solves an InvestmentBlock whose design is integer, e.g., the number of modules of a modular asset (the `Integer` variable of the InvestmentBlock), with the BundleSolver of BSPar.txt keeping the design integer (`intIntVars`), a trust region of radius 1 and a master that is a mixed-integer linear problem (MPBCfg-IP.txt), which HiGHS solves; BSPar.txt and BSPar-int.txt share the ComputeConfig of the BundleSolver (BundleCfg.txt), and MPBCfg.txt and MPBCfg-IP.txt that of the master (MPCfg.txt). TSSBlock/TSSBSCfg-BDS-CVX-int.txt does the same for the Benders form of a two-stage problem whose design is integer: the BendersDecompositionSolver of TSSBSCfg-BDS.txt in the convex regime (BDSCfg-CVX-int.txt), whose master is solved by the BundleSolver of BDSMCfg-CVX-int.txt, which keeps the design integer in the same way (the ComputeConfig BDSMBundleCfg.txt being shared with BDSMCfg-CVX.txt, and MPCfg.txt with MPBCfg.txt), and gives the same value as the MILP regime of TSSBSCfg-BDS.txt. + +The templates that use the BundleSolver are written for the BundleSolver 2.0: `strMPBSolverCfg` names MPBCfg.txt, the BlockSolverConfig of the Solver of its master, and they do not load with an SMS++ whose bundle is the 1.0. MPBCfg.txt solves the master with HiGHS, which needs an SMS++ whose HiGHSMILPSolver regularizes the QP of the master (the one of HiGHS 1.15 may otherwise call it non-convex), and the version using Gurobi is provided under name MPBCfg_grb.txt, to be named by `strMPBSolverCfg` in its place. + diff --git a/pysmspp/data/configs/SDDPBlock/ACBCfg.txt b/pysmspp/data/configs/SDDPBlock/ACBCfg.txt index 3137c92..02e42d6 100644 --- a/pysmspp/data/configs/SDDPBlock/ACBCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/ACBCfg.txt @@ -1,10 +1,8 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - ACBCfg.txt- - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - ACBCfg.txt - - - - - - - - - - - - - - - - # # A txt description of a BlockConfig for all the NetworkBlock of a UCBlock # -# Antonio Frangioni -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -12,7 +10,9 @@ BlockConfig 1 # the BlockConfig is differential + 2 # version of the BlockConfig format + # the Configuration for the structure, i.e., the tree of sub-Block * # [none] @@ -52,5 +52,5 @@ SimpleConfiguration> * # none # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - END ACBCfg.txt- - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END ACBCfg.txt - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/BCfg.txt b/pysmspp/data/configs/SDDPBlock/BCfg.txt index 476706a..c25d3f5 100644 --- a/pysmspp/data/configs/SDDPBlock/BCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/BCfg.txt @@ -1,19 +1,19 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - -BCfg.txt - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - BCfg.txt - - - - - - - - - - - - - - - - # # A txt description of the default BlockConfig for any Block of the inner # Block of each stage of the SDDPBlock for which SDDPBCfg[-LD].txt has no # class-specific entry: it only sets the is_feasible() tolerances. # -# Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BlockConfig # exact type of the Configuration object 1 # the BlockConfig is a "differential" one + 2 # version of the BlockConfig format + # the Configuration for the structure, i.e., the tree of sub-Block * # [none] @@ -46,5 +46,5 @@ SimpleConfiguration> * # [none] # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - END BCfg.txt- - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - END BCfg.txt - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/BSCfg-sim.txt b/pysmspp/data/configs/SDDPBlock/BSCfg-sim.txt index c8e0b1b..88252d4 100644 --- a/pysmspp/data/configs/SDDPBlock/BSCfg-sim.txt +++ b/pysmspp/data/configs/SDDPBlock/BSCfg-sim.txt @@ -1,5 +1,5 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - BSCfg-sim.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - BSCfg-sim.txt - - - - - - - - - - - - - - - # # A txt description of a BlockSolverConfig for a SDDPGreedySolver to be used # to simulate the SDDPBlock instances in this directory: the inner Block of @@ -7,8 +7,6 @@ # solved, so that the callback of sddp_solver can still update the data # linking two consecutive stages (e.g. ThermalUnitBlock init up/down time). # -# Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -35,7 +33,8 @@ ComputeConfig # exact type of the ComputeConfig object # now all the integer parameters intLogVerb 1 # log verbosity -intUnregisterSolver 1 # unregister the Solver of the inner Block after solving it +intUnregisterSolver 1 # unregister the Solver of the inner Block after + # solving it 0 # number of double parameters @@ -45,7 +44,7 @@ intUnregisterSolver 1 # unregister the Solver of the inner Block after solving i 1 # number of string parameters # now all the string parameters -strInnerBSC config/UCBSCfg.txt # BlockSolverConfig for the UCBlock +strInnerBSC UCBSCfg.txt # BlockSolverConfig for the UCBlock 0 # number of vector-of-int parameters @@ -70,5 +69,5 @@ strInnerBSC config/UCBSCfg.txt # BlockSolverConfig for the UCBlock # end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - END BSCfg-sim.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END BSCfg-sim.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/BSPar-LD.txt b/pysmspp/data/configs/SDDPBlock/BSPar-LD.txt index 4f5f74d..e17e9ed 100644 --- a/pysmspp/data/configs/SDDPBlock/BSPar-LD.txt +++ b/pysmspp/data/configs/SDDPBlock/BSPar-LD.txt @@ -1,11 +1,9 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - BSPar-LD.txt- - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - BSPar-LD.txt - - - - - - - - - - - - - - - # # A txt description of a BlockSolverConfig for a UCBlock to be solved by a # LagrangianDualSolver using a BundleSolver as the inner Solver # -# Enrico Gorgone, Antonio Frangioni, Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -61,53 +59,49 @@ ComputeConfig # exact type of the ComputeConfig object 1 # f_diff == 0 ==> all non-provided parameters are set to the default value # f_diff == 1 ==> all non-provided parameters are not changed -24 # number of integer parameters +18 # number of integer parameters # now all the integer parameters +intMPStbl 0 # stabilization: 0 = proximal, 1 = level, 2 = doubly + # stabilized intDoEasy 15 # do easy components for (some) LagBFunction intMaxIter 200 # max number of iterations for each call intMaxThread 1 # MaxThread, max number of new tasks to spawn intLogVerb 15 # log verbosity of main Bundle algorithm intFrcLstSS 2 intWZNorm 10 # which norm to use in the norm-based stopping condition -intBPar1 20 # discard items when they have been useless for iterations +intBPar1 20 # discard items when they have been useless for + # iterations intBPar2 1000 # max bundle size per component intBPar3 1 # max n. of items to fetch from Fi() at each iteration intBPar4 1 # min n. of items to fetch from Fi() at each iteration -intBPar6 0 # second parameter for dynamic max n. of items per iteration +intBPar6 0 # second parameter for dynamic max n. of items per + # iteration intBPar7 15 # how to deal with the global pools -intMnSSC 0 # min number of consecutive SS with the same t for a t increase -intMnNSC 1 # min number of consecutive NS with the same t for a t decrease -inttSPar1 12 # long-term t-strategy (0 = none, 4 = soft, 8 = hard, 12 = balancing) +intMnSSC 0 # min number of consecutive SS with the same t for a t + # increase +intMnNSC 1 # min number of consecutive NS with the same t for a t + # decrease +inttSPar1 12 # long-term t-strategy (0 = none, 4 = soft, 8 = hard, 12 = + # balancing) intMaxNrEvls 2 # maximum number of function evaluations at each iteration -intMPName 15 # MP solver: 0 = QPP, 7 = Cplex/Gurobi with quadratic stabilization - # + 8 = check for duplicate linearizations - -# QPPenalty's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - - -intMPlvl 2 # log verbosity of Master Problem -intQPmp1 0 # MxAdd, how many variables can be added to the base at each - # iteration in BMinQuad (0 = at will) -intQPmp2 0 # MxRmv, how many variables can be removed from the base at each - # iteration in BMinQuad (0 = at will) # OSiMPSolver's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - -intOSImp1 4 # Osi(Cpx/Grb)Solver algorithm (0 = auto (default), - # 1 = primal, 2 = dual, 3 = network, 4 = barrier, - # 5 = sifting, 6 = concurrent) -intOSImp2 1 # pre-processing (reduction) -intOSImp3 1 # threads intRstAlg 2 # parameter to handle the reset of the algorithm -#int_InnerS_WVarSCfg 0 # set by sddp_solver with the -z (hydro-easy) option -16 # number of double parameters +15 # number of double parameters # now all the double parameters dblRelAcc 1e-8 # relative accuracy required to solution -dblNZEps 1e-8 # stopping parameter: threshold to declare 0 the || residual || -dbltStar 1e3 # stopping parameter: multiplied to || residual || to estimate gap +dblNZEps 1e-8 # stopping parameter: threshold to declare 0 the || + # residual || +dbltStar 1e3 # stopping parameter: multiplied to || residual || to + # estimate gap dblBPar5 4 # first parameter for dynamic max n. of items per iteration -dblm1 -0.30 # a NS is possible if (~) Fi( Lambda1 ) >= Fi( Lambda ) + | m1 | v* -dblm2 0.90 # a SS is possible if Fi( Lambda1 ) <= Fi( Lambda ) + ( 1 - m2 ) v* +dblm1 -0.30 # a NS is possible if (~) Fi( Lambda1 ) >= Fi( Lambda ) + | + # m1 | v* +dblm2 0.90 # a SS is possible if Fi( Lambda1 ) <= Fi( Lambda ) + ( 1 - + # m2 ) v* dblm3 0.99 # a NR is computed if \sigma^* < - t * m3 * || z* || dblmxIncr 10 # max increase of t dblmnIncr 1.5 # min increase of t (each time it is increased) @@ -117,15 +111,19 @@ dbltMaior 1e+6 # maximum value for t dbltMinor 1e-10 # minimum value for t dbltInit 1e-5 # initial value for t dbltSPar2 1e-2 # parameter for the long-term t-strategy -dblCtOff 0.01 # cut-off factor for pricing in MinQuad -2 # number of string parameters +3 # number of string parameters # now all the string parameters -str_LDSlv_ISName ParallelBundleSolver # the inner Solver used by LagrangianDualSolver -#str_LDSlv_ISName BundleSolver # the inner Solver used by LagrangianDualSolver -str_LagBF_BSCfg config/InnerBSCfg.txt # meta BlockSolverConfig for the LagBFunctions, - # dispatched by inner Block classname() +str_LDSlv_ISName ParallelBundleSolver # the inner Solver used by + # LagrangianDualSolver +#str_LDSlv_ISName BundleSolver # the inner Solver used by + # LagrangianDualSolver +str_LagBF_BSCfg InnerBSCfg.txt # meta BlockSolverConfig for the + # LagBFunctions, dispatched by inner + # Block classname() +strMPBSolverCfg MPBCfg.txt # BlockSolverConfig for the MasterProblemBlock's + # Solver 0 # number of vector-of-int parameters @@ -137,10 +135,15 @@ str_LagBF_BSCfg config/InnerBSCfg.txt # meta BlockSolverConfig for the LagBFunc # now all the vector-of-double parameters # [none] -0 # number of vector-of-string parameters +1 # number of vector-of-string parameters # now all the vector-of-string parameters -# [none] +# the components that the inner BundleSolver never treats as "easy": the +# ThermalUnitBlock, which have their own Solver, and the +# HydroSystemUnitBlock, whose primal solution (the final volume of the +# reservoirs) the SDDPSolver needs and which is not provided for the easy +# components +vstrNoEasy 2 ThermalUnitBlock HydroSystemUnitBlock # pointer to the "extra" Configuration * # [none] @@ -150,5 +153,5 @@ str_LagBF_BSCfg config/InnerBSCfg.txt # meta BlockSolverConfig for the LagBFunc # end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - -END BSPar-LD.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END BSPar-LD.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/BSPar-greedy-LD.txt b/pysmspp/data/configs/SDDPBlock/BSPar-greedy-LD.txt index 54ac734..48e0b13 100644 --- a/pysmspp/data/configs/SDDPBlock/BSPar-greedy-LD.txt +++ b/pysmspp/data/configs/SDDPBlock/BSPar-greedy-LD.txt @@ -4,8 +4,6 @@ # A txt description of a BlockSolverConfig for a UCBlock to be solved by a # LagrangianDualSolver using a BundleSolver as the inner Solver # -# Enrico Gorgone, Antonio Frangioni, Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -29,52 +27,49 @@ ComputeConfig # exact type of the ComputeConfig object 1 # f_diff == 0 ==> all non-provided parameters are set to the default value # f_diff == 1 ==> all non-provided parameters are not changed -23 # number of integer parameters +17 # number of integer parameters # now all the integer parameters +intMPStbl 0 # stabilization: 0 = proximal, 1 = level, 2 = doubly + # stabilized intDoEasy 15 # do easy components for (some) LagBFunction intMaxIter 10000 # max number of iterations for each call intMaxThread 36 # MaxThread, max number of new tasks to spawn intLogVerb 2 # log verbosity of main Bundle algorithm intWZNorm 2 # which norm to use in the norm-based stopping condition -intBPar1 20 # discard items when they have been useless for iterations +intBPar1 20 # discard items when they have been useless for + # iterations intBPar2 1000 # max bundle size per component intBPar3 1 # max n. of items to fetch from Fi() at each iteration intBPar4 1 # min n. of items to fetch from Fi() at each iteration -intBPar6 0 # second parameter for dynamic max n. of items per iteration +intBPar6 0 # second parameter for dynamic max n. of items per + # iteration intBPar7 11 # how to deal with the global pools -intMnSSC 0 # min number of consecutive SS with the same t for a t increase -intMnNSC 1 # min number of consecutive NS with the same t for a t decrease -inttSPar1 12 # long-term t-strategy (0 = none, 4 = soft, 8 = hard, 12 = balancing) +intMnSSC 0 # min number of consecutive SS with the same t for a t + # increase +intMnNSC 1 # min number of consecutive NS with the same t for a t + # decrease +inttSPar1 12 # long-term t-strategy (0 = none, 4 = soft, 8 = hard, 12 = + # balancing) intMaxNrEvls 2 # maximum number of function evaluations at each iteration -intMPName 15 # MP solver: 0 = QPP, 7 = Cplex/Gurobi with quadratic stabilization - # + 8 = check for duplicate linearizations - -# QPPenalty's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - - -intMPlvl 2 # log verbosity of Master Problem -intQPmp1 0 # MxAdd, how many variables can be added to the base at each - # iteration in BMinQuad (0 = at will) -intQPmp2 0 # MxRmv, how many variables can be removed from the base at each - # iteration in BMinQuad (0 = at will) # OSiMPSolver's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - -intOSImp1 4 # Osi(Cpx/Grb)Solver algorithm (0 = auto (default), - # 1 = primal, 2 = dual, 3 = network, 4 = barrier, - # 5 = sifting, 6 = concurrent) -intOSImp2 1 # pre-processing (reduction) -intOSImp3 1 # threads intRstAlg 2 # parameter to handle the reset of the algorithm -16 # number of double parameters +15 # number of double parameters # now all the double parameters dblRelAcc 1e-4 # relative accuracy required to solution -dblNZEps 1e+4 # stopping parameter: threshold to declare 0 the || residual || -dbltStar -100 # stopping parameter: multiplied to || residual || to estimate gap +dblNZEps 1e+4 # stopping parameter: threshold to declare 0 the || + # residual || +dbltStar -100 # stopping parameter: multiplied to || residual || to + # estimate gap dblBPar5 4 # first parameter for dynamic max n. of items per iteration -dblm1 -0.30 # a NS is possible if (~) Fi( Lambda1 ) >= Fi( Lambda ) + | m1 | v* -dblm2 0.90 # a SS is possible if Fi( Lambda1 ) <= Fi( Lambda ) + ( 1 - m2 ) v* +dblm1 -0.30 # a NS is possible if (~) Fi( Lambda1 ) >= Fi( Lambda ) + | + # m1 | v* +dblm2 0.90 # a SS is possible if Fi( Lambda1 ) <= Fi( Lambda ) + ( 1 - + # m2 ) v* dblm3 0.99 # a NR is computed if \sigma^* < - t * m3 * || z* || dblmxIncr 10 # max increase of t dblmnIncr 1.5 # min increase of t (each time it is increased) @@ -85,15 +80,18 @@ dbltMinor 1e-10 # minimum value for t dbltInit 1e+0 # initial value for t dbltSPar2 1e-2 # parameter for the long-term t-strategy -dblCtOff 0.01 # cut-off factor for pricing in MinQuad - -2 # number of string parameters +3 # number of string parameters # now all the string parameters -str_LDSlv_ISName ParallelBundleSolver # the inner Solver used by LagrangianDualSolver -#str_LDSlv_ISName BundleSolver # the inner Solver used by LagrangianDualSolver -str_LagBF_BSCfg config/InnerBSCfg-sim.txt # meta BlockSolverConfig for the LagBFunctions, - # dispatched by inner Block classname() +str_LDSlv_ISName ParallelBundleSolver # the inner Solver used by + # LagrangianDualSolver +#str_LDSlv_ISName BundleSolver # the inner Solver used by + # LagrangianDualSolver +str_LagBF_BSCfg InnerBSCfg-sim.txt # meta BlockSolverConfig for the + # LagBFunctions, dispatched by + # inner Block classname() +strMPBSolverCfg MPBCfg.txt # BlockSolverConfig for the MasterProblemBlock's + # Solver 0 # number of vector-of-int parameters @@ -105,10 +103,17 @@ str_LagBF_BSCfg config/InnerBSCfg-sim.txt # meta BlockSolverConfig for the LagB # now all the vector-of-double parameters # [none] -0 # number of vector-of-string parameters +1 # number of vector-of-string parameters # now all the vector-of-string parameters -# [none] +# the components that the inner BundleSolver never treats as "easy": the +# ThermalUnitBlock, which have their own Solver, and all those whose primal +# solution the simulation needs, since it is not provided for the easy +# components: the units that link two consecutive stages, and the +# NetworkBlock, part of the output +vstrNoEasy 9 ThermalUnitBlock HydroSystemUnitBlock BatteryUnitBlock + IntermittentUnitBlock DCNetworkBlock ACNetworkBlock + ECNetworkBlock OTSNetworkBlock DesignNetworkBlock # pointer to the "extra" Configuration * # [none] @@ -118,5 +123,5 @@ str_LagBF_BSCfg config/InnerBSCfg-sim.txt # meta BlockSolverConfig for the LagB # end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - -END BSPar-greedy-LD.txt- - - - - - - - - - - - - +# - - - - - - - - - - - - - END BSPar-greedy-LD.txt - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/BUBCfg.txt b/pysmspp/data/configs/SDDPBlock/BUBCfg.txt index 6b84c38..ba3d154 100644 --- a/pysmspp/data/configs/SDDPBlock/BUBCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/BUBCfg.txt @@ -1,20 +1,20 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - BUBCfg.txt- - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - BUBCfg.txt - - - - - - - - - - - - - - - - # # A txt description of the BlockConfig for a BatteryUnitBlock: no negative # prices (static variables Configuration == 0), bound constraints generated # as OneVarConstraints (static constraints Configuration == 1), plus the # is_feasible() tolerances. # -# Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BlockConfig # exact type of the Configuration object 1 # the BlockConfig is a "differential" one + 2 # version of the BlockConfig format + # the Configuration for the structure, i.e., the tree of sub-Block * # [none] @@ -49,5 +49,5 @@ SimpleConfiguration> * # [none] # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - END BUBCfg.txt- - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END BUBCfg.txt - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/DCNBCfg.txt b/pysmspp/data/configs/SDDPBlock/DCNBCfg.txt index 1f206b5..c200d76 100644 --- a/pysmspp/data/configs/SDDPBlock/DCNBCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/DCNBCfg.txt @@ -1,18 +1,19 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - - DCNBCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - DCNBCfg.txt - - - - - - - - - - - - - - - - # # A txt description of a BlockConfig for all the DCNetworkBlock of a UCBlock, -# selecting the network formulation (read by DCNetworkBlock::generate_abstract_ -# variables). A no-op on instances without a DCNetworkBlock. -# -# Donato Meoli +# selecting the network formulation (read by +# DCNetworkBlock::generate_abstract_ variables). A no-op on instances without +# a DCNetworkBlock. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BlockConfig # exact type of the Configuration object 1 # the BlockConfig is a "differential" one + 2 # version of the BlockConfig format + # the Configuration for the structure, i.e., the tree of sub-Block * # [none] @@ -46,5 +47,5 @@ SimpleConfiguration * # [none] # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - END DCNBCfg.txt - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file +# - - - - - - - - - - - - - - - END DCNBCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/HSUBSCfg.txt b/pysmspp/data/configs/SDDPBlock/HSUBSCfg.txt index 3652bc4..cff9e5d 100644 --- a/pysmspp/data/configs/SDDPBlock/HSUBSCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/HSUBSCfg.txt @@ -1,11 +1,11 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - HSUBSCfg.txt- - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - HSUBSCfg.txt - - - - - - - - - - - - - - - # # A txt description of the BlockSolverConfig for a HydroSystemUnitBlock # inside the Lagrangian decomposition of the UCBlock of each stage of the -# SDDPBlock: the hydro subproblem is solved as an LP by CPXMILPSolver. -# -# Rafael Durbano Lobato, Donato Meoli +# SDDPBlock: the hydro subproblem is solved as an LP by CPXMILPSolver, +# with the ComputeConfig of the shared MILPCfg-LP.txt, of which only +# CPXPARAM_Parallel is overridden here. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -24,36 +24,20 @@ CPXMILPSolver # name of 1st Solver # 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ComputeConfig of the CPXMILPSolver -ComputeConfig # exact type of the ComputeConfig object +*MILPCfg-LP.txt + -1 # f_diff == 0 ==> all non-provided parameters are set to the default value - # f_diff == 1 ==> all non-provided parameters are not changed +1 # f_diff == 1 ==> only the entries below are changed -7 # number of integer parameters +1 # number of integer parameters # now all the integer parameters -intLogVerb 0 # log verbosity CPXPARAM_Parallel 0 # parallel mode -CPXPARAM_Threads 1 # number of threads -CPXPARAM_LPMethod 2 # dual simplex -CPXPARAM_Read_Scale 1 # aggressive scaling -CPX_PARAM_NUMERICALEMPHASIS 1 # numerical emphasis -CPXPARAM_SolutionType 2 # basic solution -#CPXPARAM_Preprocessing_Presolve 0 -#intThrowReducedCostException 1 - -1 # number of double parameters +#strOutputFile hydro.lp -# now all the double parameters -CPXPARAM_Simplex_Tolerances_Optimality 1e-9 # optimality tolerance -#dblAAccSol 1e-04 -#dblMaxTime 20000 +0 # number of double parameters 0 # number of string parameters -# now all the string parameters -#strOutputFile hydro.lp - 0 # number of vector-of-int parameters # now all the vector-of-int parameters @@ -69,13 +53,13 @@ CPXPARAM_Simplex_Tolerances_Optimality 1e-9 # optimality tolerance # now all the vector-of-string parameters # [none] -# pointer to the "extra" Configuration -* # [none] +# the "extra" Configuration slot is left out on purpose: an override block +# that ends here keeps the one of the base # end of 1st ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - END HSUBSCfg.txt- - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END HSUBSCfg.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/IUBCfg-LD.txt b/pysmspp/data/configs/SDDPBlock/IUBCfg-LD.txt index 8f5553e..ea8a1d0 100644 --- a/pysmspp/data/configs/SDDPBlock/IUBCfg-LD.txt +++ b/pysmspp/data/configs/SDDPBlock/IUBCfg-LD.txt @@ -1,20 +1,20 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - IUBCfg-LD.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - IUBCfg-LD.txt - - - - - - - - - - - - - - - # # A txt description of the BlockConfig for an IntermittentUnitBlock when the # SDDPBlock is solved via LagrangianDualSolver: any zero value that the # maximum power may assume is replaced by the (tiny) value given by the # extra Configuration, plus the is_feasible() tolerances. # -# Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BlockConfig # exact type of the Configuration object 1 # the BlockConfig is a "differential" one + 2 # version of the BlockConfig format + # the Configuration for the structure, i.e., the tree of sub-Block * # [none] @@ -48,5 +48,5 @@ SimpleConfiguration 1e-16 # replaces any zero value of the maximum power # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - END IUBCfg-LD.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END IUBCfg-LD.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/InnerBSCfg-sim.txt b/pysmspp/data/configs/SDDPBlock/InnerBSCfg-sim.txt index 3aa83f5..1d2e0b0 100644 --- a/pysmspp/data/configs/SDDPBlock/InnerBSCfg-sim.txt +++ b/pysmspp/data/configs/SDDPBlock/InnerBSCfg-sim.txt @@ -1,5 +1,5 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - InnerBSCfg-sim.txt- - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - InnerBSCfg-sim.txt - - - - - - - - - - - - - - # # A "meta" BlockSolverConfig for the LagrangianDualSolver (str_LagBF_BSCfg): # a map from the classname() of the inner Block of each LagBFunction to the @@ -14,8 +14,6 @@ # All filenames are resolved against the directory the tool is run from # (the root of the tools/sddp_solver directory), as in the other tools. # -# Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,12 +21,13 @@ SimpleConfiguration> 5 # the number of elements in the map -ThermalUnitBlock *config/TUBSCfg-DP.txt # specialized DP solver -HydroSystemUnitBlock *config/HSUBSCfg.txt # hard component (primal solution needed) -BatteryUnitBlock *config/OUBSCfg.txt # hard component (links two stages) -IntermittentUnitBlock *config/OUBSCfg.txt # hard component (links two stages) -* *config/LPBSCfg.txt # everything else +ThermalUnitBlock *TUBSCfg-DP.txt # specialized DP solver +HydroSystemUnitBlock *HSUBSCfg.txt # hard component (primal solution + # needed) +BatteryUnitBlock *OUBSCfg.txt # hard component (links two stages) +IntermittentUnitBlock *OUBSCfg.txt # hard component (links two stages) +* *LPBSCfg.txt # everything else # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - END InnerBSCfg-sim.txt- - - - - - - - - - - - - - +# - - - - - - - - - - - - - END InnerBSCfg-sim.txt - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/InnerBSCfg.txt b/pysmspp/data/configs/SDDPBlock/InnerBSCfg.txt index ed91918..bdf6a5d 100644 --- a/pysmspp/data/configs/SDDPBlock/InnerBSCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/InnerBSCfg.txt @@ -1,5 +1,5 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - InnerBSCfg.txt- - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - InnerBSCfg.txt - - - - - - - - - - - - - - - # # A "meta" BlockSolverConfig for the LagrangianDualSolver (str_LagBF_BSCfg): # a map from the classname() of the inner Block of each LagBFunction to the @@ -12,8 +12,6 @@ # All filenames are resolved against the directory the tool is run from # (the root of the tools/sddp_solver directory), as in the other tools. # -# Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -21,10 +19,11 @@ SimpleConfiguration> 3 # the number of elements in the map -ThermalUnitBlock *config/TUBSCfg-DP.txt # specialized DP solver -HydroSystemUnitBlock *config/HSUBSCfg.txt # hard component (primal solution needed) -* *config/LPBSCfg.txt # everything else +ThermalUnitBlock *TUBSCfg-DP.txt # specialized DP solver +HydroSystemUnitBlock *HSUBSCfg.txt # hard component (primal solution + # needed) +* *LPBSCfg.txt # everything else # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - END InnerBSCfg.txt- - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END InnerBSCfg.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/LPBSCfg.txt b/pysmspp/data/configs/SDDPBlock/LPBSCfg.txt index 0a8fccf..434e77e 100644 --- a/pysmspp/data/configs/SDDPBlock/LPBSCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/LPBSCfg.txt @@ -4,9 +4,8 @@ # A txt description of the default BlockSolverConfig for any other Block # (e.g., a PolyhedralFunctionBlock, a NetworkBlock) inside the Lagrangian # decomposition of the UCBlock of each stage of the SDDPBlock: the -# subproblem is solved as an LP by HiGHSMILPSolver. -# -# Rafael Durbano Lobato, Donato Meoli +# subproblem is solved as an LP by CPXMILPSolver, with the ComputeConfig +# of the shared MILPCfg-LP.txt. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -17,60 +16,15 @@ BlockSolverConfig # exact type of the Configuration object 1 # number of (the names of) Solver in this BlockSolverConfig # now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - -HiGHSMILPSolver # name of 1st Solver +CPXMILPSolver # name of 1st Solver 1 # number of ComputeConfig in this BlockSolverConfig # now all the ComputeConfig # 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# ComputeConfig of the HiGHSMILPSolver - -ComputeConfig # exact type of the ComputeConfig object - -1 # f_diff == 0 ==> all non-provided parameters are set to the default value - # f_diff == 1 ==> all non-provided parameters are not changed - -0 # number of integer parameters - -# now all the integer parameters -intLogVerb 0 # log verbosity -#CPXPARAM_Threads 1 # number of threads -#CPXPARAM_LPMethod 2 # dual simplex -#CPXPARAM_Read_Scale 1 # aggressive scaling -#CPX_PARAM_NUMERICALEMPHASIS 1 # numerical emphasis -#CPXPARAM_SolutionType 2 # basic solution -#CPXPARAM_Preprocessing_Presolve 0 -#intThrowReducedCostException 1 - -0 # number of double parameters - -# now all the double parameters -#CPXPARAM_Simplex_Tolerances_Optimality 1e-9 # optimality tolerance -#dblAAccSol 1e-04 -#dblMaxTime 20000 - -0 # number of string parameters - -# now all the string parameters -#strOutputFile lp.lp - -0 # number of vector-of-int parameters - -# now all the vector-of-int parameters -# [none] - -0 # number of vector-of-double parameters - -# now all the vector-of-double parameters -# [none] - -0 # number of vector-of-string parameters - -# now all the vector-of-string parameters -# [none] +# ComputeConfig of the CPXMILPSolver -# pointer to the "extra" Configuration -* # [none] +*MILPCfg-LP.txt # end of 1st ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/MILPCfg-LP.txt b/pysmspp/data/configs/SDDPBlock/MILPCfg-LP.txt new file mode 100644 index 0000000..99cbad8 --- /dev/null +++ b/pysmspp/data/configs/SDDPBlock/MILPCfg-LP.txt @@ -0,0 +1,65 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - MILPCfg-LP.txt - - - - - - - - - - - - - - - +# +# A txt description of the ComputeConfig of the CPXMILPSolver that solves, +# as an LP, the subproblems of the Lagrangian decomposition of the UCBlock +# of each stage of the SDDPBlock. It is the same for every subproblem, so +# the BlockSolverConfig that register that Solver include this file rather +# than repeating it: LPBSCfg.txt and OUBSCfg.txt take it as it is, while +# HSUBSCfg.txt takes it and overrides the one entry it needs on top. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +6 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity +CPXPARAM_Threads 1 # number of threads +CPXPARAM_LPMethod 2 # dual simplex +CPXPARAM_Read_Scale 1 # aggressive scaling +CPX_PARAM_NUMERICALEMPHASIS 1 # numerical emphasis +CPXPARAM_SolutionType 2 # basic solution +#CPXPARAM_Preprocessing_Presolve 0 +#intThrowReducedCostException 1 + +1 # number of double parameters + +# now all the double parameters +CPXPARAM_Simplex_Tolerances_Optimality 1e-9 # optimality tolerance +#dblAAccSol 1e-04 +#dblMaxTime 20000 + +0 # number of string parameters + +# now all the string parameters +#strOutputFile lp.lp + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END MILPCfg-LP.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/MPBCfg.txt b/pysmspp/data/configs/SDDPBlock/MPBCfg.txt new file mode 100644 index 0000000..46b9f02 --- /dev/null +++ b/pysmspp/data/configs/SDDPBlock/MPBCfg.txt @@ -0,0 +1,123 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - MPBCfg.txt- - - - - - - - - - - - - - - - - +# +# A txt description of a BlockSolverConfig for the inner :MILPSolver of the +# MasterProblemBlock used by the BundleSolver +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +#GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +4 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 1 # nonzero if the continuous relaxation is solved +intCutSepPar 7 # separate user cuts + lazy constraints +intMaxThread 1 # single-threaded for deterministic master reproducibility + +# All specific CPLEX parameter (uncomment based on Solver) +#CPXPARAM_LPMethod 1 # 0 = auto, 1 = primal, 2 = dual, 4 = + # barrier +#CPXPARAM_Emphasis_Numerical 1 # numerical precision emphasis + +# All specific GUROBI parameter (uncomment based on Solver) +#Method 1 # 0 = primal, 1 = dual simplex, 2 = barrier: the + # multipliers of the master ARE the algorithm, and an + # interior point has them only to about 1e-7 relative, + # which the stopping test of the bundle cannot survive; + # besides, the barrier cannot restart from the previous + # basis, so it re-solves the master from scratch at every + # call, while the simplex re-optimises after the new + # columns for a fraction of the iterations +#NumericFocus 1 # 0 = auto, 1..3 = increasing precision focus: the master + # is small and re-solved thousands of times, so whatever + # extra care is asked is paid at every one of them, and 3 + # costs a factor two. 0 is not an option: with it the + # Lagrangian dual answers Unfeas on a hydrothermal instance + # that has a solution, so this is the least care that + # answers right +#Presolve 0 # 0 = off, 1 = conservative, 2 = aggressive (default -1): + # left off deliberately, a master the presolve reduces is + # declared infeasible on tolerance when the model is badly + # scaled, and the bundle reads that as a numerical error + +3 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-08 # relative accuracy required to solution +dblAAccSol 1e-08 # absolute accuracy required to solution +dblRAccSol 1e-08 # relative accuracy of the solution pool + +# The master has to satisfy its own rows *tighter* than the oracle satisfies +# its own feasibility, or the loop cannot end: a step that violates a +# vertical row by less than the default 1e-6 is feasible for the master and +# infeasible for the subproblem, which answers with the very cut that is +# already there, and the same iteration repeats forever. +#FeasibilityTol 1e-09 # how much a row of the master may be violated +#OptimalityTol 1e-09 # how much a reduced cost of the master may be off + +# All specific HiGHS parameter (uncomment based on Solver) +# (not tighter: at 1e-9 the QP solver of HiGHS fails on the master) +#primal_feasibility_tolerance 1e-9 +#dual_feasibility_tolerance 1e-9 + +0 # number of string parameters + +# now all the string parameters +# [none] + +#strOutputFile master.lp + +# All specific HiGHS parameter (uncomment based on Solver) +#presolve off # disable presolve for reproducibility +#solver ipm # interior point: converges to analytic center (unique x*) + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END MPBCfg.txt- - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/MPBCfg_grb.txt b/pysmspp/data/configs/SDDPBlock/MPBCfg_grb.txt new file mode 100644 index 0000000..08ba68a --- /dev/null +++ b/pysmspp/data/configs/SDDPBlock/MPBCfg_grb.txt @@ -0,0 +1,120 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - MPBCfg_grb.txt - - - - - - - - - - - - - - - - +# +# A txt description of a BlockSolverConfig for the inner :MILPSolver of the +# MasterProblemBlock used by the BundleSolver +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +#HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +6 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 1 # nonzero if the continuous relaxation is solved +intCutSepPar 7 # separate user cuts + lazy constraints +intMaxThread 1 # single-threaded for deterministic master reproducibility + +# All specific CPLEX parameter (uncomment based on Solver) +#CPXPARAM_LPMethod 1 # 0 = auto, 1 = primal, 2 = dual, 4 = barrier +#CPXPARAM_Emphasis_Numerical 1 # numerical precision emphasis + +# All specific GUROBI parameter (uncomment based on Solver) +Method 1 # 0 = primal, 1 = dual simplex, 2 = barrier: the multipliers + # of the master ARE the algorithm, and an interior point has + # them only to about 1e-7 relative, which the stopping test + # of the bundle cannot survive; besides, the barrier cannot + # restart from the previous basis, so it re-solves the master + # from scratch at every call, while the simplex re-optimises + # after the new columns for a fraction of the iterations +NumericFocus 1 # 0 = auto, 1..3 = increasing precision focus: the master + # is small and re-solved thousands of times, so whatever + # extra care is asked is paid at every one of them, and 3 + # costs a factor two. 0 is not an option: with it the + # Lagrangian dual answers Unfeas on a hydrothermal instance + # that has a solution, so this is the least care that + # answers right +#Presolve 0 # 0 = off, 1 = conservative, 2 = aggressive (default -1): + # left off deliberately, a master the presolve reduces is + # declared infeasible on tolerance when the model is badly + # scaled, and the bundle reads that as a numerical error + +5 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-08 # relative accuracy required to solution +dblAAccSol 1e-08 # absolute accuracy required to solution +dblRAccSol 1e-08 # relative accuracy of the solution pool + +# The master has to satisfy its own rows *tighter* than the oracle satisfies +# its own feasibility, or the loop cannot end: a step that violates a +# vertical row by less than the default 1e-6 is feasible for the master and +# infeasible for the subproblem, which answers with the very cut that is +# already there, and the same iteration repeats forever. +FeasibilityTol 1e-09 # how much a row of the master may be violated +OptimalityTol 1e-09 # how much a reduced cost of the master may be off + +# All specific HiGHS parameter (uncomment based on Solver) +#primal_feasibility_tolerance 1e-9 +#dual_feasibility_tolerance 1e-9 + +0 # number of string parameters + +# now all the string parameters +# [none] + +#strOutputFile master.lp + +# All specific HiGHS parameter (uncomment based on Solver) +#presolve off # disable presolve for reproducibility +#solver ipm # interior point: converges to analytic center (unique x*) + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END MPBCfg_grb.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/OUBSCfg.txt b/pysmspp/data/configs/SDDPBlock/OUBSCfg.txt index 1fcbcba..a22564f 100644 --- a/pysmspp/data/configs/SDDPBlock/OUBSCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/OUBSCfg.txt @@ -4,9 +4,8 @@ # A txt description of the BlockSolverConfig for any other UnitBlock (e.g., # BatteryUnitBlock, IntermittentUnitBlock) inside the Lagrangian # decomposition of the UCBlock of each stage of the SDDPBlock: the -# subproblem is solved as an LP by HiGHSMILPSolver. -# -# Rafael Durbano Lobato, Donato Meoli +# subproblem is solved as an LP by CPXMILPSolver, with the ComputeConfig +# of the shared MILPCfg-LP.txt. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -17,60 +16,15 @@ BlockSolverConfig # exact type of the Configuration object 1 # number of (the names of) Solver in this BlockSolverConfig # now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - -HiGHSMILPSolver # name of 1st Solver +CPXMILPSolver # name of 1st Solver 1 # number of ComputeConfig in this BlockSolverConfig # now all the ComputeConfig # 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# ComputeConfig of the HiGHSMILPSolver - -ComputeConfig # exact type of the ComputeConfig object - -1 # f_diff == 0 ==> all non-provided parameters are set to the default value - # f_diff == 1 ==> all non-provided parameters are not changed - -0 # number of integer parameters - -# now all the integer parameters -intLogVerb 0 # log verbosity -#CPXPARAM_Threads 1 # number of threads -#CPXPARAM_LPMethod 2 # dual simplex -#CPXPARAM_Read_Scale 1 # aggressive scaling -#CPX_PARAM_NUMERICALEMPHASIS 1 # numerical emphasis -#CPXPARAM_SolutionType 2 # basic solution -#CPXPARAM_Preprocessing_Presolve 0 -#intThrowReducedCostException 1 - -0 # number of double parameters - -# now all the double parameters -#CPXPARAM_Simplex_Tolerances_Optimality 1e-9 # optimality tolerance -#dblAAccSol 1e-04 -#dblMaxTime 20000 - -0 # number of string parameters - -# now all the string parameters -#strOutputFile other.lp - -0 # number of vector-of-int parameters - -# now all the vector-of-int parameters -# [none] - -0 # number of vector-of-double parameters - -# now all the vector-of-double parameters -# [none] - -0 # number of vector-of-string parameters - -# now all the vector-of-string parameters -# [none] +# ComputeConfig of the CPXMILPSolver -# pointer to the "extra" Configuration -* # [none] +*MILPCfg-LP.txt # end of 1st ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/PFBCfg.txt b/pysmspp/data/configs/SDDPBlock/PFBCfg.txt index 4cdb26c..17feaeb 100644 --- a/pysmspp/data/configs/SDDPBlock/PFBCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/PFBCfg.txt @@ -1,11 +1,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - PFBCfg.txt- - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - PFBCfg.txt - - - - - - - - - - - - - - - - # # A txt description of the BlockConfig for a PolyhedralFunctionBlock: the # "linearized" representation of the PolyhedralFunction is used (static -# variables Configuration == 1), plus the is_feasible() tolerances. -# -# Donato Meoli +# variables Configuration == 1), the is_feasible() tolerances, and the +# cut-processing tolerances of remove_redundant_rows() (extra Configuration). # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -13,7 +12,9 @@ BlockConfig # exact type of the Configuration object 1 # the BlockConfig is a "differential" one + 2 # version of the BlockConfig format + # the Configuration for the structure, i.e., the tree of sub-Block * # [none] @@ -43,9 +44,14 @@ SimpleConfiguration> # solution * # [none] -# extra -* # [none] +# extra: the four tolerances of remove_redundant_rows() +SimpleConfiguration> +4 # the number of elements in the vector +0.0 # parallel abs tolerance +0.0 # parallel rel tolerance +0.0 # optimization abs tolerance +0.0 # optimization rel tolerance # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - END PFBCfg.txt- - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END PFBCfg.txt - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/SDDPBCfg-LD.txt b/pysmspp/data/configs/SDDPBlock/SDDPBCfg-LD.txt index 980bddf..d37117f 100644 --- a/pysmspp/data/configs/SDDPBlock/SDDPBCfg-LD.txt +++ b/pysmspp/data/configs/SDDPBlock/SDDPBCfg-LD.txt @@ -1,16 +1,12 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - SDDPBCfg-LD.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - SDDPBCfg-LD.txt - - - - - - - - - - - - - - - # # The default "meta" BlockConfig for the inner Block of each stage of the # SDDPBlock when it is solved via LagrangianDualSolver: like SDDPBCfg.txt, # except that the ThermalUnitBlock gets the reserve variables in the # Objective (the reserve demand constraints are dualized) and the -# IntermittentUnitBlock gets the zero-max-power replacement. -# -# All filenames are resolved against the directory the tool is run from -# (the root of the tools/sddp_solver directory), as in the other tools. -# -# Donato Meoli +# IntermittentUnitBlock gets the zero-max-power replacement; also used in +# the simulation (-s -S SDDPSCfg-greedy-LD.txt). # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -19,15 +15,17 @@ SimpleConfiguration> 8 # the number of elements in the map -PolyhedralFunctionBlock *config/PFBCfg.txt # linearized representation -SlackUnitBlock *config/SUBCfg.txt # OneVarConstraints -BatteryUnitBlock *config/BUBCfg.txt # OneVarConstraints, no negative prices -ThermalUnitBlock *config/TUBCfg-LD.txt # OneVarConstraints + reserves in Objective -IntermittentUnitBlock *config/IUBCfg-LD.txt # zero-max-power replacement -DCNetworkBlock *config/DCNBCfg.txt # network formulation (KIRCHHOFF) -ACNetworkBlock *config/ACBCfg.txt # AC Network scaling factors -* *config/BCfg.txt # everything else (is_feasible only) +PolyhedralFunctionBlock *PFBCfg.txt # linearized representation +SlackUnitBlock *SUBCfg.txt # OneVarConstraints +BatteryUnitBlock *BUBCfg.txt # OneVarConstraints, no negative + # prices +ThermalUnitBlock *TUBCfg-LD.txt # OneVarConstraints + reserves in + # Objective +IntermittentUnitBlock *IUBCfg-LD.txt # zero-max-power replacement +DCNetworkBlock *DCNBCfg.txt # network formulation (KIRCHHOFF) +ACNetworkBlock *ACBCfg.txt # AC Network scaling factors +* *BCfg.txt # everything else (is_feasible only) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - END SDDPBCfg-LD.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END SDDPBCfg-LD.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/SDDPBCfg.txt b/pysmspp/data/configs/SDDPBlock/SDDPBCfg.txt index 1c5ec6e..a3aaedc 100644 --- a/pysmspp/data/configs/SDDPBlock/SDDPBCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/SDDPBCfg.txt @@ -1,5 +1,5 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - SDDPBCfg.txt- - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - SDDPBCfg.txt - - - - - - - - - - - - - - - # # The default "meta" BlockConfig for the inner Block of each stage of the # SDDPBlock: a map from Block classname() to the BlockConfig to be applied @@ -10,8 +10,6 @@ # All filenames are resolved against the directory the tool is run from # (the root of the tools/sddp_solver directory), as in the other tools. # -# Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -19,14 +17,14 @@ SimpleConfiguration> 7 # the number of elements in the map -PolyhedralFunctionBlock *PFBCfg.txt # linearized representation -SlackUnitBlock *SUBCfg.txt # OneVarConstraints -BatteryUnitBlock *BUBCfg.txt # OneVarConstraints, no negative prices -ThermalUnitBlock *TUBCfg-OVC.txt # OneVarConstraints -DCNetworkBlock *DCNBCfg.txt # network formulation (KIRCHHOFF) -ACNetworkBlock *ACBCfg.txt # AC Network scaling factors -* *BCfg.txt # everything else (is_feasible only) +PolyhedralFunctionBlock *PFBCfg.txt # linearized representation +SlackUnitBlock *SUBCfg.txt # OneVarConstraints +BatteryUnitBlock *BUBCfg.txt # OneVarConstraints, no negative prices +ThermalUnitBlock *TUBCfg-OVC.txt # OneVarConstraints +DCNetworkBlock *DCNBCfg.txt # network formulation (KIRCHHOFF) +ACNetworkBlock *ACBCfg.txt # AC Network scaling factors +* *BCfg.txt # everything else (is_feasible only) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - END SDDPBCfg.txt- - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END SDDPBCfg.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/SDDPSCfg-LD.txt b/pysmspp/data/configs/SDDPBlock/SDDPSCfg-LD.txt index 9c4fa33..db0a648 100644 --- a/pysmspp/data/configs/SDDPBlock/SDDPSCfg-LD.txt +++ b/pysmspp/data/configs/SDDPBlock/SDDPSCfg-LD.txt @@ -1,9 +1,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - -SDDPSCfg-LD.txt- - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - SDDPSCfg-LD.txt - - - - - - - - - - - - - - - # -# A txt description of a BlockSolverConfig for a SDDPSolver -# -# Rafael Durbano Lobato +# The BlockSolverConfig of the SDDPBlock whose inner Block of each stage is +# solved via LagrangianDualSolver [see BSPar-LD.txt], to be used with +# -B SDDPBCfg-LD.txt. The extra Configuration tells the LagrangianDualSolver +# which components have their primal and dual solution written. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -33,10 +34,14 @@ ComputeConfig # exact type of the ComputeConfig object intMaxIter 5 intLogVerb 0 # log verbosity intNStepConv 5 # Frequency at which the convergence is checked -intPrintTime 1 # Indicates whether computational time should be displayed -intNbSimulCheckForConv 5 # Number of simulations considered when checking convergence -intNbSimulForward 5 # Number of simulations considered in the forward pass -intNbSimulBackward 5 # Number of simulations considered in the backward pass +intPrintTime 1 # Indicates whether computational time should be + # displayed +intNbSimulCheckForConv 5 # Number of simulations considered when checking + # convergence +intNbSimulForward 5 # Number of simulations considered in the forward + # pass +intNbSimulBackward 5 # Number of simulations considered in the backward + # pass intOutputFrequency 1 intBackwardSolverIndex 1 intForwardSolverIndex 0 @@ -50,8 +55,8 @@ dblAccuracy 0 # Relative accuracy for declaring a solution optimal 3 # number of string parameters # now all the string parameters -#strInnerBSC config/UCBSCfg.txt # BlockSolverConfig for the UCBlock -strInnerBSC config/BSPar-LD.txt # BlockSolverConfig for the UCBlock +#strInnerBSC UCBSCfg.txt # BlockSolverConfig for the UCBlock +strInnerBSC BSPar-LD.txt # BlockSolverConfig for the UCBlock #strInnerBC uc_blockconfig.txt # BlockConfig for the UCBlock strSubSolverLogFilePrefix sub-log- strOutputFile cuts.txt @@ -71,13 +76,37 @@ strOutputFile cuts.txt # now all the vector-of-string parameters # [none] -# pointer to the "extra" Configuration -* # [none] +# pointer to the "extra" Configuration: the Configurations of the inner +# Block of each stage +SimpleConfiguration> +4 # number of elements in this vector + +# the BlockConfig of the inner Block +* # [none] + +# the BlockSolverConfig of the inner Block: none here, it is strInnerBSC +* # [none] + +# the Configuration of get_var_solution(): the only component whose primal +# solution the SDDPSolver needs, by class, is the HydroSystemUnitBlock (the +# final volume of the reservoirs) +SimpleConfiguration> +1 # the number of elements in the map +HydroSystemUnitBlock * # all of its solution + +# the Configuration of get_dual_solution(), which the BendersBFunction of +# each stage passes on: the duals it needs are those of the constraints of +# the HydroSystemUnitBlock (the volume of the reservoirs) and those of the +# relaxed constraints (key "relaxed"), the other components are skipped +SimpleConfiguration> +2 # the number of elements in the map +HydroSystemUnitBlock * # all of its dual solution +relaxed * # the duals of the relaxed constraints # end of 1st ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - -END SDDPSCfg-LD.txt- - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END SDDPSCfg-LD.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/SDDPSCfg-greedy-LD.txt b/pysmspp/data/configs/SDDPBlock/SDDPSCfg-greedy-LD.txt index 0fe2086..003ef3c 100644 --- a/pysmspp/data/configs/SDDPBlock/SDDPSCfg-greedy-LD.txt +++ b/pysmspp/data/configs/SDDPBlock/SDDPSCfg-greedy-LD.txt @@ -1,9 +1,9 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - SDDPSCfg-greedy-LD.txt- - - - - - - - - - - - - - +# - - - - - - - - - - - - - SDDPSCfg-greedy-LD.txt - - - - - - - - - - - - - # -# A txt description of a BlockSolverConfig for a SDDPGreedySolver -# -# Rafael Durbano Lobato +# The BlockSolverConfig of the SDDPBlock for the simulation (-s), with the +# inner Block of each stage solved via LagrangianDualSolver [see +# BSPar-greedy-LD.txt], to be used with -B SDDPBCfg-LD.txt. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -33,17 +33,17 @@ ComputeConfig # exact type of the ComputeConfig object # now all the integer parameters intLogVerb 1 # log verbosity # intScenarioId 0 # index of the scenario to be considered -intUnregisterSolver 1 # unregister the Solver of the inner Block after solving it +intUnregisterSolver 1 # unregister the Solver of the inner Block after + # solving it 0 # number of double parameters # now all the double parameters -1 # number of string parameters +0 # number of string parameters # now all the string parameters -strInnerBSC config/BSPar-greedy-LD.txt # BlockSolverConfig for the UCBlock -#strInnerBC uc_blockconfig.txt # BlockConfig for the UCBlock +# [none] 0 # number of vector-of-int parameters @@ -60,13 +60,43 @@ strInnerBSC config/BSPar-greedy-LD.txt # BlockSolverConfig for the UCBloc # now all the vector-of-string parameters # [none] -# pointer to the "extra" Configuration -* # [none] +# pointer to the "extra" Configuration: the Configurations of the inner +# Block of each stage +SimpleConfiguration> +4 # number of elements in this vector + +# the BlockConfig of the inner Block +* # [none] + +# the BlockSolverConfig of the inner Block +*BSPar-greedy-LD.txt + +# the Configuration of get_var_solution(): the components whose primal +# solution the simulation needs, by class, which are the hard ones of +# BSPar-greedy-LD.txt +SimpleConfiguration> +9 # the number of elements in the map +ThermalUnitBlock * # all of its solution +HydroSystemUnitBlock * # all of its solution +BatteryUnitBlock * # all of its solution +IntermittentUnitBlock * # all of its solution +DCNetworkBlock * # all of its solution +ACNetworkBlock * # all of its solution +ECNetworkBlock * # all of its solution +OTSNetworkBlock * # all of its solution +DesignNetworkBlock * # all of its solution + +# the Configuration of get_dual_solution(): only the dual solution of the +# linking constraints of the UCBlock (the -1 not being any sub-Block), those +# of its sub-Blocks are not needed +SimpleConfiguration>> +1 # number of elements in this vector +-1 -1 # end of 1st ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - END SDDPSCfg-greedy-LD.txt- - - - - - - - - - - - - +# - - - - - - - - - - - - END SDDPSCfg-greedy-LD.txt - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/SDDPSCfg.txt b/pysmspp/data/configs/SDDPBlock/SDDPSCfg.txt index 880a003..86ead4a 100644 --- a/pysmspp/data/configs/SDDPBlock/SDDPSCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/SDDPSCfg.txt @@ -1,10 +1,8 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - SDDPSCfg.txt- - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - SDDPSCfg.txt - - - - - - - - - - - - - - - # # A txt description of a BlockSolverConfig for a SDDPSolver # -# Rafael Durbano Lobato -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -33,10 +31,14 @@ ComputeConfig # exact type of the ComputeConfig object intMaxIter 10 intLogVerb 1 # log verbosity intNStepConv 5 # Frequency at which the convergence is checked -intPrintTime 1 # Indicates whether computational time should be displayed -intNbSimulCheckForConv 5 # Number of simulations considered when checking convergence -intNbSimulForward 1 # Number of simulations considered in the forward pass -intNbSimulBackward 5 # Number of simulations considered in the backward pass +intPrintTime 1 # Indicates whether computational time should be + # displayed +intNbSimulCheckForConv 5 # Number of simulations considered when checking + # convergence +intNbSimulForward 1 # Number of simulations considered in the forward + # pass +intNbSimulBackward 5 # Number of simulations considered in the backward + # pass intOutputFrequency 1 1 # number of double parameters @@ -80,5 +82,5 @@ strFilenameSuffix .0 # end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - END SDDPSCfg.txt- - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END SDDPSCfg.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/SUBCfg.txt b/pysmspp/data/configs/SDDPBlock/SUBCfg.txt index 296ffd1..775fd2f 100644 --- a/pysmspp/data/configs/SDDPBlock/SUBCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/SUBCfg.txt @@ -1,19 +1,19 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - SUBCfg.txt- - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - SUBCfg.txt - - - - - - - - - - - - - - - - # # A txt description of the BlockConfig for a SlackUnitBlock: bound # constraints are generated as OneVarConstraints (static constraints # Configuration == 1), plus the is_feasible() tolerances. # -# Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BlockConfig # exact type of the Configuration object 1 # the BlockConfig is a "differential" one + 2 # version of the BlockConfig format + # the Configuration for the structure, i.e., the tree of sub-Block * # [none] @@ -47,5 +47,5 @@ SimpleConfiguration> * # [none] # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - END SUBCfg.txt- - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END SUBCfg.txt - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/TUBCfg-LD.txt b/pysmspp/data/configs/SDDPBlock/TUBCfg-LD.txt index 8093327..0d09190 100644 --- a/pysmspp/data/configs/SDDPBlock/TUBCfg-LD.txt +++ b/pysmspp/data/configs/SDDPBlock/TUBCfg-LD.txt @@ -1,5 +1,5 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - TUBCfg-LD.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - TUBCfg-LD.txt - - - - - - - - - - - - - - - # # A txt description of the BlockConfig for a ThermalUnitBlock when the # SDDPBlock is solved via LagrangianDualSolver: besides what TUBCfg-OVC.txt @@ -7,15 +7,15 @@ # the Objective (objective Configuration == 3), since the reserve demand # constraints of the UCBlock are dualized. # -# Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BlockConfig # exact type of the Configuration object 1 # the BlockConfig is a "differential" one + 2 # version of the BlockConfig format + # the Configuration for the structure, i.e., the tree of sub-Block * # [none] @@ -50,5 +50,5 @@ SimpleConfiguration> * # [none] # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - END TUBCfg-LD.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END TUBCfg-LD.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/TUBCfg-OVC.txt b/pysmspp/data/configs/SDDPBlock/TUBCfg-OVC.txt index 12886b4..2b1f946 100644 --- a/pysmspp/data/configs/SDDPBlock/TUBCfg-OVC.txt +++ b/pysmspp/data/configs/SDDPBlock/TUBCfg-OVC.txt @@ -1,19 +1,19 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - TUBCfg-OVC.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - TUBCfg-OVC.txt - - - - - - - - - - - - - - - # # A txt description of the BlockConfig for a ThermalUnitBlock: bound # constraints are generated as OneVarConstraints (static constraints # Configuration == 1), plus the is_feasible() tolerances. # -# Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BlockConfig # exact type of the Configuration object 1 # the BlockConfig is a "differential" one + 2 # version of the BlockConfig format + # the Configuration for the structure, i.e., the tree of sub-Block * # [none] @@ -47,5 +47,5 @@ SimpleConfiguration> * # [none] # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - END TUBCfg-OVC.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END TUBCfg-OVC.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/TUBSCfg-DP.txt b/pysmspp/data/configs/SDDPBlock/TUBSCfg-DP.txt index db4273b..d20e7e4 100644 --- a/pysmspp/data/configs/SDDPBlock/TUBSCfg-DP.txt +++ b/pysmspp/data/configs/SDDPBlock/TUBSCfg-DP.txt @@ -1,13 +1,11 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - TUBSCfg-DP.txt- - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - TUBSCfg-DP.txt - - - - - - - - - - - - - - - # # A txt description of the BlockSolverConfig for a ThermalUnitBlock inside # the Lagrangian decomposition of the UCBlock of each stage of the # SDDPBlock: each thermal unit subproblem is solved by the specialized # ThermalUnitExtDPSolver. # -# Rafael Durbano Lobato, Donato Meoli -# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -68,5 +66,5 @@ intLogVerb 0 # log verbosity # end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - END TUBSCfg-DP.txt- - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END TUBSCfg-DP.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/UCBSCfg.txt b/pysmspp/data/configs/SDDPBlock/UCBSCfg.txt index 4f88843..6ae0b97 100644 --- a/pysmspp/data/configs/SDDPBlock/UCBSCfg.txt +++ b/pysmspp/data/configs/SDDPBlock/UCBSCfg.txt @@ -3,9 +3,7 @@ # # A txt description of the BlockSolverConfig for the inner Block (a UCBlock) # of each stage of the SDDPBlock: the continuous relaxation is solved as a -# whole by CPXMILPSolver. -# -# Rafael Durbano Lobato, Donato Meoli +# whole by a :MILPSolver. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -16,13 +14,15 @@ BlockSolverConfig # exact type of the Configuration object 1 # number of (the names of) Solver in this BlockSolverConfig # now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - -HiGHSMILPSolver # name of 1st Solver +#CPXMILPSolver # name of 1st Solver +#GRBMILPSolver # name of 1st Solver +HiGHSMILPSolver # name of 1st Solver 1 # number of ComputeConfig in this BlockSolverConfig # now all the ComputeConfig # 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# ComputeConfig of the CPXMILPSolver +# ComputeConfig of the :MILPSolver ComputeConfig # exact type of the ComputeConfig object @@ -34,7 +34,8 @@ ComputeConfig # exact type of the ComputeConfig object # now all the integer parameters intLogVerb 0 # log verbosity intRelaxIntVars 1 # relax the integrality constraints -# CPXPARAM_Threads 1 # number of threads +# All specific CPLEX parameter (uncomment based on Solver) +#CPXPARAM_Threads 1 # number of threads 0 # number of double parameters diff --git a/pysmspp/data/configs/SDDPBlock/get_var_solution_bundle.txt b/pysmspp/data/configs/SDDPBlock/get_var_solution_bundle.txt deleted file mode 100644 index 931ab74..0000000 --- a/pysmspp/data/configs/SDDPBlock/get_var_solution_bundle.txt +++ /dev/null @@ -1,26 +0,0 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - get_var_solution_bundle.txt - - - - - - - - - - - - -# -# A txt description of the Configuration to be passed to get_var_solution() -# of the [Parallel]BundleSolver when the HydroSystemUnitBlock is treated as -# an easy component (see the -z option of sddp_solver): the primal solution -# of the easy component, which lives in the master problem, is recovered for -# the component with the given index. -# -# Note: the component index below assumes that the HydroSystemUnitBlock is -# the first (index 0) sub-Block of the UCBlock of each stage. -# -# Rafael Durbano Lobato, Donato Meoli -# -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SimpleConfiguration>> - -1 # number of elements in this vector - -0 1 # component index, get duals - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - END get_var_solution_bundle.txt - - - - - - - - - - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SVMBlock/LDCfg.txt b/pysmspp/data/configs/SVMBlock/LDCfg.txt index 0e149fc..5f7e272 100644 --- a/pysmspp/data/configs/SVMBlock/LDCfg.txt +++ b/pysmspp/data/configs/SVMBlock/LDCfg.txt @@ -15,10 +15,11 @@ ComputeConfig # exact type of the ComputeConfig object 1 # f_diff == 0 ==> all non-provided parameters are set to the default value # f_diff == 1 ==> all non-provided parameters are not changed -28 # number of integer parameters +22 # number of integer parameters # now all the integer parameters # first those of LagrangianDualSolver proper +intMPStbl 0 # stabilization: 0 = proximal, 1 = level, 2 = doubly stabilized int_LDSlv_iBCopy 0 # 1 if sub-Block must be R3B-copied int_LDSlv_NNMult 0 # the consensus constraints are equalities, hence # their multipliers are free @@ -53,28 +54,9 @@ intTrgtMng 0 # bit-wise encoding targets and accuracies management: # MPSolver parameters : - - - - - - - - - - - - - - - - - - - - - - - - - - - -intMPName 15 # MP solver: 0 = QPP, 7 = Cplex/Gurobi with quadratic stabilization - # + 8 = check for duplicate linearizations - -# QPPenalty's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - - - -intMPlvl 4 # log verbosity of Master Problem - -intQPmp1 0 # MxAdd, how many variables can be added to the base at each - # iteration in BMinQuad (0 = at will) -intQPmp2 0 # MxRmv, how many variables can be removed from the base at each - # iteration in BMinQuad (0 = at will) - -# OSIMPSolver's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - - -intOSImp1 1 # Osi(Cpx/Grb)Solver algorithm (0 = auto (default), - # 1 = primal, 2 = dual, 3 = network, 4 = barrier, - # 5 = sifting, 6 = concurrent) -intOSImp2 3 # pre-processing (reduction) -intOSImp3 1 # threads intRstAlg 2 # parameter to handle the reset of the algorithm -17 # number of double parameters +16 # number of double parameters # now all the double parameters dblRelAcc 1e-7 # relative accuracy required to solution @@ -100,9 +82,8 @@ dbltMinor 1e-4 # minimum value for t dbltInit 1e-2 # initial value for t dbltSPar2 0.001 # parameter for the long-term t-strategy dbltSPar3 0 # parameter for small heuristic t adjustments -dblCtOff 0.01 # cut-off factor for pricing in MinQuad -2 # number of string parameters +3 # number of string parameters # now all the string parameters # first those of LagrangianDualSolver proper @@ -111,6 +92,7 @@ str_LagBF_BSCfg LPBSCfg.txt # the BlockSolverConfig for inner Block # then those of BundleSolver as its inner Solver # [none] +strMPBSolverCfg MPBCfg.txt # BlockSolverConfig for the MasterProblemBlock's Solver 0 # number of vector-of-int parameters diff --git a/pysmspp/data/configs/SVMBlock/MPBCfg.txt b/pysmspp/data/configs/SVMBlock/MPBCfg.txt new file mode 100644 index 0000000..6090990 --- /dev/null +++ b/pysmspp/data/configs/SVMBlock/MPBCfg.txt @@ -0,0 +1,117 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - MPBCfg.txt - - - - - - - - - - - - - - - - - +# +# A txt description of a BlockSolverConfig for the inner :MILPSolver of +# the MasterProblemBlock used by the BundleSolver +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +#GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +4 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 1 # nonzero if the continuous relaxation is solved +intCutSepPar 7 # separate user cuts + lazy constraints +intMaxThread 1 # single-threaded for deterministic master reproducibility + +# All specific CPLEX parameter (uncomment based on Solver) +#CPXPARAM_LPMethod 4 # 0 = auto, 1 = primal, 2 = dual, 4 = barrier, 6 = concurrent +#CPXPARAM_Preprocessing_Presolve 0 # disable presolve for reproducibility +#CPXPARAM_Emphasis_Numerical 1 # numerical precision emphasis + +# All specific GUROBI parameter (uncomment based on Solver) +#Method 1 # 0 = primal, 1 = dual simplex, 2 = barrier: the multipliers + # of the master ARE the algorithm, and an interior point has + # them only to about 1e-7 relative, which the stopping test + # of the bundle cannot survive; besides, the barrier cannot + # restart from the previous basis, so it re-solves the master + # from scratch at every call, while the simplex re-optimises + # after the new columns for a fraction of the iterations +#Presolve 0 # 0 = off, 1 = conservative, 2 = aggressive (default -1) +#NumericFocus 1 # 0 = auto, 1..3 = increasing precision focus: the master + # is small and re-solved thousands of times, so whatever + # extra care is asked is paid at every one of them, and 3 + # costs a factor two. 0 is not an option: with it the + # Lagrangian dual answers Unfeas on a hydrothermal instance + # that has a solution, so this is the least care that + # answers right + +3 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-08 # relative accuracy required to solution +dblAAccSol 1e-08 # absolute accuracy required to solution +dblRAccSol 1e-08 # relative accuracy of the solution pool + +# The master has to satisfy its own rows *tighter* than the oracle satisfies +# its own feasibility, or the loop cannot end: a step that violates a +# vertical row by less than the default 1e-6 is feasible for the master and +# infeasible for the subproblem, which answers with the very cut that is +# already there, and the same iteration repeats forever. +#FeasibilityTol 1e-09 # how much a row of the master may be violated +#OptimalityTol 1e-09 # how much a reduced cost of the master may be off + +# All specific HiGHS parameter (uncomment based on Solver) +# (not tighter: at 1e-9 the QP solver of HiGHS fails on the master) +#primal_feasibility_tolerance 1e-9 +#dual_feasibility_tolerance 1e-9 + +1 # number of string parameters + +# now all the string parameters +#strOutputFile master.lp + +# All specific HiGHS parameter (uncomment based on Solver) +presolve off # as Presolve 0 in MPBCfg_grb.txt +#solver ipm # interior point: converges to analytic center (unique x*) + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END MPBCfg.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SVMBlock/MPBCfg_grb.txt b/pysmspp/data/configs/SVMBlock/MPBCfg_grb.txt new file mode 100644 index 0000000..246975a --- /dev/null +++ b/pysmspp/data/configs/SVMBlock/MPBCfg_grb.txt @@ -0,0 +1,116 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - MPBCfg_grb.txt - - - - - - - - - - - - - - - - +# +# A txt description of a BlockSolverConfig for the inner :MILPSolver of +# the MasterProblemBlock used by the BundleSolver +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +#HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +7 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 1 # nonzero if the continuous relaxation is solved +intCutSepPar 7 # separate user cuts + lazy constraints +intMaxThread 1 # single-threaded for deterministic master reproducibility + +# All specific CPLEX parameter (uncomment based on Solver) +#CPXPARAM_LPMethod 4 # 0 = auto, 1 = primal, 2 = dual, 4 = barrier, 6 = concurrent +#CPXPARAM_Preprocessing_Presolve 0 # disable presolve for reproducibility +#CPXPARAM_Emphasis_Numerical 1 # numerical precision emphasis + +# All specific GUROBI parameter (uncomment based on Solver) +Method 1 # 0 = primal, 1 = dual simplex, 2 = barrier: the multipliers + # of the master ARE the algorithm, and an interior point has + # them only to about 1e-7 relative, which the stopping test + # of the bundle cannot survive; besides, the barrier cannot + # restart from the previous basis, so it re-solves the master + # from scratch at every call, while the simplex re-optimises + # after the new columns for a fraction of the iterations +Presolve 0 # 0 = off, 1 = conservative, 2 = aggressive (default -1) +NumericFocus 1 # 0 = auto, 1..3 = increasing precision focus: the master + # is small and re-solved thousands of times, so whatever + # extra care is asked is paid at every one of them, and 3 + # costs a factor two. 0 is not an option: with it the + # Lagrangian dual answers Unfeas on a hydrothermal instance + # that has a solution, so this is the least care that + # answers right + +5 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-08 # relative accuracy required to solution +dblAAccSol 1e-08 # absolute accuracy required to solution +dblRAccSol 1e-08 # relative accuracy of the solution pool + +# The master has to satisfy its own rows *tighter* than the oracle satisfies +# its own feasibility, or the loop cannot end: a step that violates a +# vertical row by less than the default 1e-6 is feasible for the master and +# infeasible for the subproblem, which answers with the very cut that is +# already there, and the same iteration repeats forever. +FeasibilityTol 1e-09 # how much a row of the master may be violated +OptimalityTol 1e-09 # how much a reduced cost of the master may be off + +# All specific HiGHS parameter (uncomment based on Solver) +#primal_feasibility_tolerance 1e-9 +#dual_feasibility_tolerance 1e-9 + +0 # number of string parameters + +# now all the string parameters +#strOutputFile master.lp + +# All specific HiGHS parameter (uncomment based on Solver) +#presolve off # disable presolve for reproducibility +#solver ipm # interior point: converges to analytic center (unique x*) + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END MPBCfg_grb.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/ACBCfg.txt b/pysmspp/data/configs/TSSBlock/ACBCfg.txt new file mode 100644 index 0000000..45c7742 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/ACBCfg.txt @@ -0,0 +1,55 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - ACBCfg.txt - - - - - - - - - - - - - - - - - +# +# The BlockConfig of an ACNetworkBlock: its scaling factors. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockConfig + +1 # the BlockConfig is differential + +2 # version of the BlockConfig format + +# the Configuration for the structure, i.e., the tree of sub-Block +* # [none] + +# static constraints Configuration +# a SimpleConfiguration< std::vector< double > > to set +# the scaling constants in ACNetworkBlock +# exact type of the Configuration object +SimpleConfiguration> +4 # the number of elements in the vector +1.0 # C_v_scal +0.0 # f_ACvS +1.0 # f_scale +16 # f_digits + +# dynamic constraints Configuration +* # none + +# static variables Configuration +* # none + +# dynamic variables Configuration +* # none + +# objective Configuration +* # none + +# is_feasible Configuration +* # none + +# is_optimal Configuration +* # none + +# solution Configuration +* # none + +# extra Configuration +* # none + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END ACBCfg.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/BDSCfg-CVX-LD.txt b/pysmspp/data/configs/TSSBlock/BDSCfg-CVX-LD.txt new file mode 100644 index 0000000..4b50b1b --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/BDSCfg-CVX-LD.txt @@ -0,0 +1,38 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - BDSCfg-CVX-LD.txt - - - - - - - - - - - - - - - +# +# The ComputeConfig of BDSCfg-LD.txt in the convex regime: the master is +# solved by the BundleSolver of BDSMCfg-CVX.txt, the value functions of the +# subproblems being components of its Objective. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +*BDSCfg-LD.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +1 # number of integer parameters + +# now all the integer parameters +int_BDSlv_Regime 0 # 0 = convex master, 1 = MILP master + +0 # number of double parameters + +1 # number of string parameters + +# now all the string parameters +str_Mstr_BSCfg BDSMCfg-CVX.txt # BlockSolverConfig of the master + +0 # number of vector-of-int parameters + +0 # number of vector-of-double parameters + +0 # number of vector-of-string parameters + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END BDSCfg-CVX-LD.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/BDSCfg-CVX-int.txt b/pysmspp/data/configs/TSSBlock/BDSCfg-CVX-int.txt new file mode 100644 index 0000000..09f1973 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/BDSCfg-CVX-int.txt @@ -0,0 +1,39 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - BDSCfg-CVX-int.txt - - - - - - - - - - - - - - +# +# The ComputeConfig of BDSCfg.txt in the convex regime when the design is +# integer: the master is solved by the BundleSolver of BDSMCfg-CVX-int.txt, +# which keeps the design integer, the value functions of the subproblems +# being components of its Objective. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +*BDSCfg.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +1 # number of integer parameters + +# now all the integer parameters +int_BDSlv_Regime 0 # 0 = convex master, 1 = MILP master + +0 # number of double parameters + +1 # number of string parameters + +# now all the string parameters +str_Mstr_BSCfg BDSMCfg-CVX-int.txt # BlockSolverConfig of the master + +0 # number of vector-of-int parameters + +0 # number of vector-of-double parameters + +0 # number of vector-of-string parameters + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END BDSCfg-CVX-int.txt - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/BDSCfg-LD.txt b/pysmspp/data/configs/TSSBlock/BDSCfg-LD.txt new file mode 100644 index 0000000..315ba6f --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/BDSCfg-LD.txt @@ -0,0 +1,41 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - BDSCfg-LD.txt - - - - - - - - - - - - - - - - +# +# The ComputeConfig of the BendersDecompositionSolver whose subproblems are +# solved by the recursive Lagrangian dual of TSSBSCfg-LDrec.txt: that of +# BDSCfg.txt, the Solver of the subproblems apart, and with the recovery of +# a feasible solution at the design of the master (BSCfg1-IP.txt), which +# gives the upper bound in both regimes (in the convex one, at the best +# point of the bundle). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +*BDSCfg.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +0 # number of integer parameters + +0 # number of double parameters + +2 # number of string parameters + +# now all the string parameters +str_Bsub_BSCfg TSSBSCfg-LDrec.txt # BlockSolverConfig of the subproblems +strRecoveryBSC BSCfg1-IP.txt # the recovery of a feasible solution: + # each subproblem solved as a MILP at the + # design of the master + +0 # number of vector-of-int parameters + +0 # number of vector-of-double parameters + +0 # number of vector-of-string parameters + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END BDSCfg-LD.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/BDSCfg.txt b/pysmspp/data/configs/TSSBlock/BDSCfg.txt new file mode 100644 index 0000000..b6c7610 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/BDSCfg.txt @@ -0,0 +1,56 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - BDSCfg.txt - - - - - - - - - - - - - - - - +# +# The ComputeConfig of the BendersDecompositionSolver of TSSBSCfg-BDS.txt: +# the MILP regime, one cut per scenario, the scenarios of a round evaluated +# by 8 threads, the master of BDSMCfg.txt and the subproblems of BDSSCfg.txt. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +0 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +2 # number of integer parameters + +# now all the integer parameters +int_BDSlv_Regime 1 # 0 = convex master, 1 = MILP master +intMaxThread 8 # threads evaluating the subproblems of a round, at + # most the cores of the machine; the run is the same + # for every value, only faster, and 1 evaluates them + # one after the other + +0 # number of double parameters + +# now all the double parameters +# [none] + +2 # number of string parameters + +# now all the string parameters +str_Bsub_BSCfg BDSSCfg.txt # BlockSolverConfig of the subproblems +str_Mstr_BSCfg BDSMCfg.txt # BlockSolverConfig of the master + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END BDSCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/BDSMBundleCfg.txt b/pysmspp/data/configs/TSSBlock/BDSMBundleCfg.txt new file mode 100644 index 0000000..04f7b1f --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/BDSMBundleCfg.txt @@ -0,0 +1,99 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - BDSMBundleCfg.txt - - - - - - - - - - - - - - +# +# The ComputeConfig of the BundleSolver on the master problem of +# BendersDecompositionSolver in the convex regime, shared by +# BDSMCfg-CVX.txt and BDSMCfg-CVX-int.txt. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +13 # number of integer parameters + +# now all the integer parameters +intMPStbl 0 # stabilization: 0 = proximal, 1 = level, + # 2 = doubly stabilized +intMaxIter 100000 # MaxIter, max number of iterations for each call +intLogVerb 0 # LogVerb, log verbosity of main Bundle algorithm +intBPar1 20 # discard items when they have been useless for + # iterations +intBPar2 400 # max bundle size per component +intBPar3 1 # max n. of items to fetch from Fi() at each iteration +intBPar4 1 # min n. of items to fetch from Fi() at each iteration +intBPar6 0 # second parameter for dynamic max n. of items per + # iteration +intBPar7 11 # how to deal with the global pools +intMnSSC 0 # min number of consecutive SS with the same t for a t + # increase +intMnNSC 1 # min number of consecutive NS with the same t for a t + # decrease +inttSPar1 12 # long-term t-strategy (0 = none, 4 = soft, 8 = hard, + # 12 = balancing): the master knows nothing of the scale + # of the design Variable, and letting it balance the + # stabilization against the model is what finds it +intMaxNrEvls 2 # maximum number of function evaluations per iteration + +15 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-8 # relative accuracy required to solution: with 1e-6 + # the bundle may stop short of it where the scenarios + # differ the most, and give an upper bound instead of + # a value +dblNZEps 1e-4 # stopping parameter: threshold to declare 0 the + # || residual ||, below which the lower bound is + # certified: the linearizations of subproblems solved + # by a Lagrangian dual are accurate to its dblRelAcc + # (1e-5 in TSSBSCfg-LDrec.txt), and with a smaller + # threshold the Solver reports the optimum without a + # bound +dbltStar 1e+4 # stopping parameter: multiplied to || residual || to + # estimate gap +dblBPar5 4 # first parameter for dynamic max n. of items per + # iteration +dblm1 -0.01 # a NS is possible if (~) Fi( Lambda1 ) >= Fi( Lambda ) + # + | m1 | v* +dblm2 0.99 # a SS is possible if Fi( Lambda1 ) <= Fi( Lambda ) + # + ( 1 - m2 ) v* +dblm3 0.99 # a NR is computed if \sigma^* < - t * m3 * || z* || +dblmxIncr 10 # max increase of t +dblmnIncr 1.5 # min increase of t (each time it is increased) +dblmxDecr 0.1 # max decrease of t +dblmnDecr 0.66 # min decrease of t (each time it is decreased) +dbltMaior 1e+6 # maximum value for t +dbltMinor 1e-4 # minimum value for t +dbltInit 1e+3 # initial value for t, at the scale of a design in MW: + # with 1e+5 the bundle may stop before the optimum +dbltSPar2 0.001 # parameter for the long-term t-strategy + +1 # number of string parameters + +# now all the string parameters +strMPBSolverCfg MPBCfg.txt # BlockSolverConfig of the + # MasterProblemBlock Solver + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END BDSMBundleCfg.txt - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/BDSMCfg-CVX-int.txt b/pysmspp/data/configs/TSSBlock/BDSMCfg-CVX-int.txt new file mode 100644 index 0000000..bc76182 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/BDSMCfg-CVX-int.txt @@ -0,0 +1,70 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - BDSMCfg-CVX-int.txt - - - - - - - - - - - - - - +# +# The BlockSolverConfig of the master problem of BendersDecompositionSolver +# in the convex regime when the design is integer, e.g., the number of +# modules of a modular asset: the BundleSolver of BDSMCfg-CVX.txt keeping +# it integer, with a trust region of radius 1 and a master that is a +# mixed-integer linear problem [see intIntVars]. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +0 # the BlockSolverConfig is not a "differential" one: values are being set + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +BundleSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +*BDSMBundleCfg.txt + + +1 # f_diff == 1 ==> only the entries below are changed + +4 # number of integer parameters + +# now all the integer parameters +intIntVars 1 # the integer design, e.g., the modules, stay integer +intMPPrimal 1 # the primal master, where the design is the Variable +intMPV2Form 1 # raw form: the Variable of the master are the design itself +intMPStbl 4 # 4 = trust region || x - x_bar ||_inf <= t, a MILP master + +1 # number of double parameters + +# now all the double parameters +dbltInit 1 # radius of the trust region, in modules + +1 # number of string parameters + +# now all the string parameters +strMPBSolverCfg MPBCfg-IP.txt # the master, which keeps the integers + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END BDSMCfg-CVX-int.txt - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/BDSMCfg-CVX.txt b/pysmspp/data/configs/TSSBlock/BDSMCfg-CVX.txt new file mode 100644 index 0000000..b6ae701 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/BDSMCfg-CVX.txt @@ -0,0 +1,32 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - BDSMCfg-CVX.txt - - - - - - - - - - - - - - - +# +# The BlockSolverConfig of the master problem of BendersDecompositionSolver +# in the convex regime (BDSCfg-CVX-LD.txt): a BundleSolver, which drives the +# stabilized cutting-plane loop, the value functions of the subproblems +# being components of its Objective; its master problem is solved by the +# Solver of MPBCfg.txt. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +0 # the BlockSolverConfig is not a "differential" one: values are being set + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +BundleSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +*BDSMBundleCfg.txt + +# end 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END BDSMCfg-CVX.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/BDSMCfg.txt b/pysmspp/data/configs/TSSBlock/BDSMCfg.txt new file mode 100644 index 0000000..c6b8bfa --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/BDSMCfg.txt @@ -0,0 +1,71 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - BDSMCfg.txt - - - - - - - - - - - - - - - - +# +# The master of TSSBSCfg-BDS.txt: a :MILPSolver. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +0 # the BlockSolverConfig is not a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +GRBMILPSolver # name of Solver +#CPXMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +#HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +0 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +2 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # LogVerb, log verbosity of the MILPSolver +Threads 1 # one thread, so that the time is that of a sequential + # algorithm, as every other one here is + +1 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-9 # relative accuracy required to solution + +0 # number of string parameters + +# now all the string parameters +# [none] + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END BDSMCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/BDSSCfg.txt b/pysmspp/data/configs/TSSBlock/BDSSCfg.txt new file mode 100644 index 0000000..01d6b7d --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/BDSSCfg.txt @@ -0,0 +1,92 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - BDSSCfg.txt - - - - - - - - - - - - - - - - +# +# The subproblems of TSSBSCfg-BDS.txt: a :MILPSolver on the linear +# program of a scenario, with the presolve off, which a Farkas +# certificate needs. +# +# - the duals of an optimal solution, which give the optimality cut: any +# optimal dual solution does, basic or not, an interior-point one included; +# +# - the unbounded dual direction of an infeasible one, i.e., a Farkas +# certificate, which gives the feasibility cut: it is a ray of the dual +# polyhedron, hence any method can produce it, but the presolve cannot, it +# detecting the infeasibility on the reduced problem and leaving no +# certificate for the original one. +# +# With Gurobi nothing else is needed, the InfUnbdInfo parameter being set by +# GRBMILPSolver itself; the equivalent configurations are +# +# CPXMILPSolver: CPXPARAM_Preprocessing_Presolve 0 +# HiGHSMILPSolver: presolve off +# +# while SCIPMILPSolver has no Farkas certificate at all: with it, only +# subproblems that are always feasible can be dealt with. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +0 # the BlockSolverConfig is not a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +GRBMILPSolver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - +ComputeConfig # exact type of the ComputeConfig object + +0 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +6 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # LogVerb, log verbosity of the MILPSolver +Threads 1 # one thread, so that the time is that of a sequential + # algorithm, as every other one here is +intRelaxIntVars 1 # solve the continuous (LP) relaxation +Method 1 # dual simplex: asked for reproducibility of the duals, + # any optimal ones giving a valid optimality cut +Presolve 0 # off, or an infeasible subproblem leaves no Farkas + # certificate and no feasibility cut can be generated +intThrowReducedCostException 0 # a Variable whose bounds are those of its + # type, as a relaxed binary of a leaf, has no + # OneVarConstraint to take its reduced cost, which the + # cut, read off the coupling rows, does not need + +1 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-9 # relative accuracy required to solution + +0 # number of string parameters + +# now all the string parameters +# [none] + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END BDSSCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/SDDPBlock/BendersBSCfg.txt b/pysmspp/data/configs/TSSBlock/BSCfg-IB.txt similarity index 67% rename from pysmspp/data/configs/SDDPBlock/BendersBSCfg.txt rename to pysmspp/data/configs/TSSBlock/BSCfg-IB.txt index 4c0fd58..088c4b1 100644 --- a/pysmspp/data/configs/SDDPBlock/BendersBSCfg.txt +++ b/pysmspp/data/configs/TSSBlock/BSCfg-IB.txt @@ -1,14 +1,9 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - BendersBSCfg.txt- - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - BSCfg-IB.txt - - - - - - - - - - - - - - - # -# A txt description of the default BlockSolverConfig for the inner Block of -# each BendersBFunction of the SDDPBlock, used by build_BlockConfig() of -# sddp_solver when no BlockConfig (-B) and no BlockSolverConfig (-S) are -# provided: the continuous relaxation is solved by CPXMILPSolver with -# presolve disabled, throwing an exception if reduced costs are not -# available. -# -# Donato Meoli +# The :MILPSolver of the stochastic Block inside an InvestmentBlock +# (TSSBSCfg-IB.txt), on the continuous relaxation, with the cuts of the +# InvestmentFunction as lazy constraints. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -19,26 +14,29 @@ BlockSolverConfig # exact type of the Configuration object 1 # number of (the names of) Solver in this BlockSolverConfig # now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - -CPXMILPSolver # name of 1st Solver +GRBMILPSolver # name of Solver 1 # number of ComputeConfig in this BlockSolverConfig # now all the ComputeConfig # 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# ComputeConfig of the CPXMILPSolver ComputeConfig # exact type of the ComputeConfig object 1 # f_diff == 0 ==> all non-provided parameters are set to the default value # f_diff == 1 ==> all non-provided parameters are not changed -2 # number of integer parameters +4 # number of integer parameters # now all the integer parameters -CPXPARAM_Preprocessing_Presolve 0 # disable presolve -intThrowReducedCostException 1 # throw if reduced costs are unavailable +intLogVerb 0 # LogVerb, log verbosity of the MILPSolver +intRelaxIntVars 1 # nonzero if the continuous relaxation is solved +intCutSepPar 7 # separate user cuts + lazy constraints +intHomogeneousDirection 1 # the multipliers of an unbounded dual direction are + # - A' y and not c - A' y, the Objective having no part in a + # certificate of infeasibility -0 # number of double parameters +0 # number of double parameters # now all the double parameters # [none] @@ -71,5 +69,5 @@ intThrowReducedCostException 1 # throw if reduced costs are unavailable # end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - END BendersBSCfg.txt- - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END BSCfg-IB.txt - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/BSCfg1-IP.txt b/pysmspp/data/configs/TSSBlock/BSCfg1-IP.txt new file mode 100644 index 0000000..4810830 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/BSCfg1-IP.txt @@ -0,0 +1,77 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - BSCfg1-IP.txt - - - - - - - - - - - - - - - - +# +# A Block solved by a :MILPSolver with its integer Variable. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +#HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +2 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 0 # nonzero if the continuous relaxation is solved + +# All specific CPLEX parameter (uncomment based on Solver) +#CPXPARAM_Preprocessing_Presolve 0 # 0 = off, 1 = on (default) + # disable presolve for reproducibility +#CPXPARAM_Emphasis_Numerical 1 # 0 = off (default), 1 = extreme numerical caution + +# All specific GUROBI parameter (uncomment based on Solver) +#Presolve 0 # 0 = off, 1 = conservative, 2 = aggressive (default -1) + # the scenario MILP keeps the presolve it is given: switching + # it off is a handicap, and this Solver is a competitor here +#NumericFocus 3 # 0 = auto (default), 1..3 = increasing precision focus + +1 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-8 # relative accuracy required to solution + +0 # number of string parameters + +# now all the string parameters +#strOutputFile uc.lp # filename for .lp file +#strLogFileName uc-milp.log # filename for the Solver log + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END BSCfg1-IP.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/BSCfg1.txt b/pysmspp/data/configs/TSSBlock/BSCfg1.txt new file mode 100644 index 0000000..74bd44f --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/BSCfg1.txt @@ -0,0 +1,75 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - BSCfg1.txt - - - - - - - - - - - - - - - - - +# +# A Block solved by a :MILPSolver as a continuous relaxation. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +#HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +4 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 1 # nonzero if the continuous relaxation is solved + +# All specific CPLEX parameter (uncomment based on Solver) +#CPXPARAM_Preprocessing_Presolve 0 # 0 = off, 1 = on (default) + # disable presolve for reproducibility +#CPXPARAM_Emphasis_Numerical 1 # 0 = off (default), 1 = extreme numerical caution + +# All specific GUROBI parameter (uncomment based on Solver) +Presolve 0 # 0 = off, 1 = conservative, 2 = aggressive (default -1) +NumericFocus 3 # 0 = auto (default), 1..3 = increasing precision focus + +1 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-8 # relative accuracy required to solution + +0 # number of string parameters + +# now all the string parameters +#strOutputFile uc.lp # filename for .lp file +#strLogFileName uc-milp.log # filename for the Solver log + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END BSCfg1.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/DCNBCfg.txt b/pysmspp/data/configs/TSSBlock/DCNBCfg.txt new file mode 100644 index 0000000..2e816d5 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/DCNBCfg.txt @@ -0,0 +1,49 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - DCNBCfg.txt - - - - - - - - - - - - - - - - - +# +# The BlockConfig of a DCNetworkBlock: its formulation. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockConfig # exact type of the Configuration object + +1 # the BlockConfig is a "differential" one + +2 # version of the BlockConfig format + +# the Configuration for the structure, i.e., the tree of sub-Block +* # [none] + +# static constraints Configuration +* # [none] + +# dynamic constraints Configuration +* # [none] + +# static variables Configuration +# a SimpleConfiguration< int > selecting the network formulation +SimpleConfiguration +2 # 0 = PTDF, 1 = CYCLE, 2 = KIRCHHOFF + +# dynamic variables Configuration +* # [none] + +# objective Configuration +* # [none] + +# is_feasible Configuration +* # [none] + +# is_optimal Configuration +* # [none] + +# solution Configuration +* # [none] + +# extra Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END DCNBCfg.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/IBOCfg-LD.txt b/pysmspp/data/configs/TSSBlock/IBOCfg-LD.txt new file mode 100644 index 0000000..e07749a --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/IBOCfg-LD.txt @@ -0,0 +1,54 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - IBOCfg-LD.txt - - - - - - - - - - - - - - - - +# +# The OBlockConfig of IBOCfg.txt, which gives the InvestmentFunction the +# ComputeConfig of IFCfg-LD.txt, i.e., the inner Block solved by the +# recursive Lagrangian dual. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +OBlockConfig # exact type of the Configuration object + +1 # the BlockConfig is a "differential" one + +2 # version of the BlockConfig format + +# the Configuration for the structure, i.e., the tree of sub-Block +* # [none] + +# static_constraints: the bounds l <= x <= u on the investment are +# reformulated as 0 <= x <= u - l, the only form BundleSolver handles +SimpleConfiguration +1 + +# dynamic_constraints +* # [none] + +# static_variables +* # [none] + +# dynamic_variables +* # [none] + +# objective +* # [none] + +# is_feasible +* # [none] + +# is_optimal +* # [none] + +# solution +* # [none] + +# extra +* # [none] + +# the ComputeConfig of the Objective, i.e., of the InvestmentFunction +*IFCfg-LD.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END IBOCfg-LD.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/IBOCfg.txt b/pysmspp/data/configs/TSSBlock/IBOCfg.txt new file mode 100644 index 0000000..9012f9b --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/IBOCfg.txt @@ -0,0 +1,54 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - IBOCfg.txt - - - - - - - - - - - - - - - - +# +# The OBlockConfig of an InvestmentBlock: it reformulates the bounds on the +# investment, and gives the InvestmentFunction its ComputeConfig [see +# IFCfg.txt], which holds the BlockSolverConfig of the inner Block. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +OBlockConfig # exact type of the Configuration object + +1 # the BlockConfig is a "differential" one + +2 # version of the BlockConfig format + +# the Configuration for the structure, i.e., the tree of sub-Block +* # [none] + +# static_constraints: the bounds l <= x <= u on the investment are +# reformulated as 0 <= x <= u - l, the only form BundleSolver handles +SimpleConfiguration +1 + +# dynamic_constraints +* # [none] + +# static_variables +* # [none] + +# dynamic_variables +* # [none] + +# objective +* # [none] + +# is_feasible +* # [none] + +# is_optimal +* # [none] + +# solution +* # [none] + +# extra +* # [none] + +# the ComputeConfig of the Objective, i.e., of the InvestmentFunction +*IFCfg.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END IBOCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/IFCfg-LD.txt b/pysmspp/data/configs/TSSBlock/IFCfg-LD.txt new file mode 100644 index 0000000..5035dd7 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/IFCfg-LD.txt @@ -0,0 +1,36 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - IFCfg-LD.txt - - - - - - - - - - - - - - - - +# +# The ComputeConfig of the InvestmentFunction of IFCfg.txt, whose inner +# Block is solved by the recursive Lagrangian dual of TSSBSCfg-LDrec.txt +# instead of the linear program of BSCfg-IB.txt: only the extra +# Configuration changes. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +*IFCfg.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +0 # number of integer parameters + +0 # number of double parameters + +0 # number of string parameters + +0 # number of vector-of-int parameters + +0 # number of vector-of-double parameters + +0 # number of vector-of-string parameters + +# pointer to the "extra" Configuration: the BlockSolverConfig of the inner +# Block of the InvestmentFunction +SimpleConfiguration> +1 # the number of elements in the map +BlockSolverConfig *TSSBSCfg-LDrec.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END IFCfg-LD.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/IFCfg.txt b/pysmspp/data/configs/TSSBlock/IFCfg.txt new file mode 100644 index 0000000..5c4c27f --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/IFCfg.txt @@ -0,0 +1,37 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - IFCfg.txt - - - - - - - - - - - - - - - - - +# +# The ComputeConfig of the InvestmentFunction, which the OBlockConfig of the +# InvestmentBlock gives to its Objective [see IBOCfg.txt]: in the extra +# Configuration, the BlockSolverConfig of the inner Block, here a TSSB, an +# MSSB or a UCBlock, whose continuous relaxation Gurobi solves whole. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 1 ==> all non-provided parameters are not changed + +0 # number of integer parameters + +0 # number of double parameters + +0 # number of string parameters: no strOutputFilename, so the investments + # and the values of the Function are not written to a file + +0 # number of vector-of-int parameters + +0 # number of vector-of-double parameters + +0 # number of vector-of-string parameters + +# pointer to the "extra" Configuration: the BlockSolverConfig of the inner +# Block of the InvestmentFunction +SimpleConfiguration> +1 # the number of elements in the map +BlockSolverConfig *BSCfg-IB.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END IFCfg.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/InnerBCfg-LD.txt b/pysmspp/data/configs/TSSBlock/InnerBCfg-LD.txt new file mode 100644 index 0000000..31eb39c --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/InnerBCfg-LD.txt @@ -0,0 +1,22 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - InnerBCfg-LD.txt - - - - - - - - - - - - - - - +# +# The map of InnerBCfg.txt, the InvestmentBlock being configured by +# IBOCfg-LD.txt, whose inner Block is solved by the recursive Lagrangian dual +# (IFCfg-LD.txt, TSSBSCfg-LDrec.txt). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +SimpleConfiguration> + +5 # the number of elements in the map +InvestmentBlock *IBOCfg-LD.txt +ThermalUnitBlock *TUBCfg.txt +DCNetworkBlock *DCNBCfg.txt +ACNetworkBlock *ACBCfg.txt +PolyhedralFunctionBlock *PFBCfg.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END InnerBCfg-LD.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/InnerBCfg.txt b/pysmspp/data/configs/TSSBlock/InnerBCfg.txt new file mode 100644 index 0000000..9137526 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/InnerBCfg.txt @@ -0,0 +1,23 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - InnerBCfg.txt - - - - - - - - - - - - - - - - +# +# A map from classname to BlockConfig: the InvestmentBlock over a TSSB, an +# MSSB or a UCBlock (IBOCfg.txt, which gives the Solver of the inner Block), +# and the units and the networks of a UCBlock (TUBCfg.txt, DCNBCfg.txt, +# ACBCfg.txt, PFBCfg.txt). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +SimpleConfiguration> + +5 # the number of elements in the map +InvestmentBlock *IBOCfg.txt +ThermalUnitBlock *TUBCfg.txt +DCNetworkBlock *DCNBCfg.txt +ACNetworkBlock *ACBCfg.txt +PolyhedralFunctionBlock *PFBCfg.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END InnerBCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/InnerBSCfg-IP.txt b/pysmspp/data/configs/TSSBlock/InnerBSCfg-IP.txt new file mode 100644 index 0000000..d79f8f0 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/InnerBSCfg-IP.txt @@ -0,0 +1,19 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - InnerBSCfg-IP.txt - - - - - - - - - - - - - - - +# +# A map from classname to BlockSolverConfig: ThermalUnitBlock to +# TUBSCfg-DP.txt, every other Block to BSCfg1-IP.txt. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +SimpleConfiguration> + +2 # the number of elements in the map + +ThermalUnitBlock *TUBSCfg-DP.txt +* *BSCfg1-IP.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END InnerBSCfg-IP.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/InnerBSCfg.txt b/pysmspp/data/configs/TSSBlock/InnerBSCfg.txt new file mode 100644 index 0000000..00a888b --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/InnerBSCfg.txt @@ -0,0 +1,19 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - InnerBSCfg.txt - - - - - - - - - - - - - - - - +# +# A map from classname to BlockSolverConfig: ThermalUnitBlock to +# TUBSCfg-DP.txt, every other Block to BSCfg1.txt. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +SimpleConfiguration> + +2 # the number of elements in the map + +ThermalUnitBlock *TUBSCfg-DP.txt +* *BSCfg1.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END InnerBSCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/LDCfg.txt b/pysmspp/data/configs/TSSBlock/LDCfg.txt new file mode 100644 index 0000000..763d4fb --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/LDCfg.txt @@ -0,0 +1,83 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - LDCfg.txt - - - - - - - - - - - - - - - - - +# +# The ComputeConfig of a LagrangianDualSolver with a BundleSolver 2.0, +# which the templates above load and change (*LDCfg.txt +). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +16 # number of integer parameters + +# now all the integer parameters +intPushCostToOwner 1 # whether sub-Block Objective are changed +intDoEasy 0 # do easy components for (some) LagBFunction +intMaxIter 10000 # max number of iterations for each call +intMaxThread 1 # MaxThread, max number of new tasks to spawn +intLogVerb 4 # log verbosity of main Bundle algorithm +intWZNorm 2 # which norm to use in the norm-based stopping condition +intBPar1 20 # discard items when they have been useless for iterations +intBPar2 100 # max bundle size per component +intBPar3 1 # max n. of items to fetch from Fi() at each iteration +intBPar4 1 # min n. of items to fetch from Fi() at each iteration +intBPar6 0 # second parameter for dynamic max n. of items per iteration +intBPar7 11 # how to deal with the global pools +intMnSSC 0 # min number of consecutive SS with the same t for a t increase +intMnNSC 1 # min number of consecutive NS with the same t for a t decrease +inttSPar1 12 # long-term t-strategy (0 = none, 4 = soft, 8 = hard, 12 = balancing) +intMaxNrEvls 2 # maximum number of function evaluations at each iteration + +15 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-6 # relative accuracy required to solution +dblNZEps 1e-2 # stopping parameter: threshold to declare 0 the || residual || +dbltStar -1e+3 # stopping parameter: multiplied to || residual || to estimate gap +dblBPar5 4 # first parameter for dynamic max n. of items per iteration +dblm1 -0.30 # a NS is possible if (~) Fi( Lambda1 ) >= Fi( Lambda ) + | m1 | v* +dblm2 0.90 # a SS is possible if Fi( Lambda1 ) <= Fi( Lambda ) + ( 1 - m2 ) v* +dblm3 0.99 # a NR is computed if \sigma^* < - t * m3 * || z* || +dblmxIncr 10 # max increase of t +dblmnIncr 1.5 # min increase of t (each time it is increased) +dblmxDecr 0.1 # max decrease of t +dblmnDecr 0.66 # min decrease of t (each time it is decreased) +dbltMaior 1e+6 # maximum value for t +dbltMinor 1e-10 # minimum value for t +dbltInit 1e+1 # initial value for t +dbltSPar2 1e-2 # parameter for the long-term t-strategy + +3 # number of string parameters + +# now all the string parameters +str_LDSlv_ISName BundleSolver # the inner Solver used by LagrangianDualSolver +str_LagBF_BSCfg InnerBSCfg.txt # BlockSolverConfig for the LagBFunctions +strMPBSolverCfg MPBCfg.txt # BlockSolverConfig for the MasterProblemBlock's Solver + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END LDCfg.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/LPBSCfg-LD.txt b/pysmspp/data/configs/TSSBlock/LPBSCfg-LD.txt index 976bf61..60d07e0 100644 --- a/pysmspp/data/configs/TSSBlock/LPBSCfg-LD.txt +++ b/pysmspp/data/configs/TSSBlock/LPBSCfg-LD.txt @@ -30,9 +30,10 @@ ComputeConfig # exact type of the ComputeConfig object 1 # f_diff == 0 ==> all non-provided parameters are set to the default value # f_diff == 1 ==> all non-provided parameters are not changed -24 # number of integer parameters +18 # number of integer parameters # now all the integer parameters +intMPStbl 0 # stabilization: 0 = proximal, 1 = level, 2 = doubly stabilized intPushCostToOwner 1 # whether sub-Block Objective are changed intDoEasy 0 # do easy components for (some) LagBFunction intMaxIter 10000 # max number of iterations for each call @@ -49,25 +50,10 @@ intMnSSC 0 # min number of consecutive SS with the same t for a t increas intMnNSC 1 # min number of consecutive NS with the same t for a t decrease inttSPar1 12 # long-term t-strategy (0 = none, 4 = soft, 8 = hard, 12 = balancing) intMaxNrEvls 2 # maximum number of function evaluations at each iteration -intMPName 15 # MP solver: 0 = QPP, 7 = Cplex/Gurobi with quadratic stabilization - # + 8 = check for duplicate linearizations -# QPPenalty's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - - - -intMPlvl 7 # log verbosity of Master Problem -intQPmp1 0 # MxAdd, how many variables can be added to the base at each - # iteration in BMinQuad (0 = at will) -intQPmp2 0 # MxRmv, how many variables can be removed from the base at each - # iteration in BMinQuad (0 = at will) - -# OSIMPSolver's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - - -intOSImp1 0 # Osi(Cpx/Grb)Solver algorithm (0 = auto (default), 1 = primal, 2 = dual, 3 = network, 4 = barrier, 5 = sifting, 6 = concurrent) -intOSImp2 0 # pre-processing (reduction) -intOSImp3 1 # threads intRstAlg 2 # parameter to handle the reset of the algorithm -16 # number of double parameters +15 # number of double parameters # now all the double parameters dblRelAcc 1e-6 # relative accuracy required to solution @@ -85,15 +71,15 @@ dbltMaior 1e+6 # maximum value for t dbltMinor 1e-10 # minimum value for t dbltInit 1e+1 # initial value for t dbltSPar2 1e-2 # parameter for the long-term t-strategy -dblCtOff 0.01 # cut-off factor for pricing in MinQuad -3 # number of string parameters +4 # number of string parameters # now all the string parameters strLogFileName unit-ld.log # filename for the Solver log #str_LDSlv_ISName ParallelBundleSolver # the inner Solver used by LagrangianDualSolver str_LDSlv_ISName BundleSolver # the inner Solver used by LagrangianDualSolver str_LagBF_BSCfg BSCfg.txt # BlockSolverConfig for the LagBFunctions +strMPBSolverCfg MPBCfg.txt # BlockSolverConfig for the MasterProblemBlock's Solver 0 # number of vector-of-int parameters diff --git a/pysmspp/data/configs/TSSBlock/LPBSCfg-LDLD.txt b/pysmspp/data/configs/TSSBlock/LPBSCfg-LDLD.txt new file mode 100644 index 0000000..967f82b --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/LPBSCfg-LDLD.txt @@ -0,0 +1,75 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - LPBSCfg-LDLD.txt - - - - - - - - - - - - - - - +# +# The Lagrangian dual of the units of a scenario, each thermal unit +# solved by its dynamic programming (InnerBSCfg.txt). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +LagrangianDualSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the LagrangianDualSolver; it mostly is the +# ComputeConfig of the inner Solver, which is a [Parallel]BundleSolver + +*LDCfg.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +3 # number of integer parameters + +# now all the integer parameters +intDoEasy 3 # do easy components for (some) LagBFunction + # (bit 0 + bit 1 = enable easy + ChgCosts) +intMaxIter 1000 # max number of iterations for each call: the cap is not + # binding, the inner dual stops on its own criteria first, + # and it must not be lowered to go faster. The 100 of + # LPBSCfg-LD.txt is tuned on a 24 to 48 period horizon: on + # 40 units over 96 periods it stops the inner duals far + # from their optimum and the bound of the nested dual falls + # to -0.482% of the optimum, against -0.075% with 1000, + # which is 7.4 seconds against 20.5 +intLogVerb 0 # log verbosity of main Bundle algorithm + +2 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-4 # relative accuracy required to solution +dbltInit 1e+0 # initial value for t + +1 # number of string parameters + +# now all the string parameters +str_LagBF_BSCfg InnerBSCfg.txt # BlockSolverConfig for the LagBFunctions + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END LPBSCfg-LDLD.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/MILPCfg-IP.txt b/pysmspp/data/configs/TSSBlock/MILPCfg-IP.txt new file mode 100644 index 0000000..548f5d3 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/MILPCfg-IP.txt @@ -0,0 +1,51 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - MILPCfg-IP.txt - - - - - - - - - - - - - - - - +# +# A :MILPSolver with integer Variable, relative gap 1e-6, one hour. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +3 # number of integer parameters + +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 0 # nonzero if the continuous relaxation is solved +intCutSepPar 7 # separate user cuts + lazy constraints: no Block here + # separates, but the callback that comes with them makes + # Gurobi faster on these MILPs (1.4 to 5.4 times than 0) + +2 # number of double parameters + +dblRelAcc 1e-6 # relative accuracy required to solution +dblMaxTime 3600 # maximum time for a call + +0 # number of string parameters + +# now all the string parameters +# [none] + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END MILPCfg-IP.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/MILPCfg-LP.txt b/pysmspp/data/configs/TSSBlock/MILPCfg-LP.txt new file mode 100644 index 0000000..b2e5d2b --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/MILPCfg-LP.txt @@ -0,0 +1,49 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - MILPCfg-LP.txt - - - - - - - - - - - - - - - +# +# A :MILPSolver on the continuous relaxation, one hour. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +3 # number of integer parameters + +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 1 # nonzero if the continuous relaxation is solved +intCutSepPar 7 # separate user cuts + lazy constraints + +2 # number of double parameters + +dblRelAcc 1e-6 # relative accuracy required to solution +dblMaxTime 3600 # maximum time for a call + +0 # number of string parameters + +# now all the string parameters +# [none] + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END MILPCfg-LP.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/MPBCfg-IP.txt b/pysmspp/data/configs/TSSBlock/MPBCfg-IP.txt new file mode 100644 index 0000000..f722a9d --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/MPBCfg-IP.txt @@ -0,0 +1,74 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - MPBCfg-IP.txt - - - - - - - - - - - - - - - +# +# A BlockSolverConfig for the :MILPSolver of the MasterProblemBlock of +# BDSMCfg-CVX-int.txt, which keeps the integer Variable integer [see +# MPCfg.txt]. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +#GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +*MPCfg.txt + + +1 # f_diff == 1 ==> only the entries below are changed + +2 # number of integer parameters + +# now all the integer parameters +intRelaxIntVars 0 # the integer design stays integer +intCutSepPar 0 # no Block separates cuts in the master + +1 # number of double parameters + +# now all the double parameters +mip_feasibility_tolerance 1e-10 + # integrality as tight as HiGHS allows: the bundle + # rounds the point of the master before evaluating it + +0 # number of string parameters + +# now all the string parameters +# [none] + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END MPBCfg-IP.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/MPBCfg.txt b/pysmspp/data/configs/TSSBlock/MPBCfg.txt new file mode 100644 index 0000000..dd3804b --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/MPBCfg.txt @@ -0,0 +1,37 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - MPBCfg.txt - - - - - - - - - - - - - - - - - +# +# A txt description of a BlockSolverConfig for the inner :MILPSolver of the +# MasterProblemBlock used by the BundleSolver [see MPCfg.txt] +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +#GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +*MPCfg.txt + +# end of ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END MPBCfg.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/MPBCfg_grb.txt b/pysmspp/data/configs/TSSBlock/MPBCfg_grb.txt new file mode 100644 index 0000000..08ba68a --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/MPBCfg_grb.txt @@ -0,0 +1,120 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - MPBCfg_grb.txt - - - - - - - - - - - - - - - - +# +# A txt description of a BlockSolverConfig for the inner :MILPSolver of the +# MasterProblemBlock used by the BundleSolver +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of Solver +GRBMILPSolver # name of Solver +#SCIPMILPSolver # name of Solver +#HiGHSMILPSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +6 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 1 # nonzero if the continuous relaxation is solved +intCutSepPar 7 # separate user cuts + lazy constraints +intMaxThread 1 # single-threaded for deterministic master reproducibility + +# All specific CPLEX parameter (uncomment based on Solver) +#CPXPARAM_LPMethod 1 # 0 = auto, 1 = primal, 2 = dual, 4 = barrier +#CPXPARAM_Emphasis_Numerical 1 # numerical precision emphasis + +# All specific GUROBI parameter (uncomment based on Solver) +Method 1 # 0 = primal, 1 = dual simplex, 2 = barrier: the multipliers + # of the master ARE the algorithm, and an interior point has + # them only to about 1e-7 relative, which the stopping test + # of the bundle cannot survive; besides, the barrier cannot + # restart from the previous basis, so it re-solves the master + # from scratch at every call, while the simplex re-optimises + # after the new columns for a fraction of the iterations +NumericFocus 1 # 0 = auto, 1..3 = increasing precision focus: the master + # is small and re-solved thousands of times, so whatever + # extra care is asked is paid at every one of them, and 3 + # costs a factor two. 0 is not an option: with it the + # Lagrangian dual answers Unfeas on a hydrothermal instance + # that has a solution, so this is the least care that + # answers right +#Presolve 0 # 0 = off, 1 = conservative, 2 = aggressive (default -1): + # left off deliberately, a master the presolve reduces is + # declared infeasible on tolerance when the model is badly + # scaled, and the bundle reads that as a numerical error + +5 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-08 # relative accuracy required to solution +dblAAccSol 1e-08 # absolute accuracy required to solution +dblRAccSol 1e-08 # relative accuracy of the solution pool + +# The master has to satisfy its own rows *tighter* than the oracle satisfies +# its own feasibility, or the loop cannot end: a step that violates a +# vertical row by less than the default 1e-6 is feasible for the master and +# infeasible for the subproblem, which answers with the very cut that is +# already there, and the same iteration repeats forever. +FeasibilityTol 1e-09 # how much a row of the master may be violated +OptimalityTol 1e-09 # how much a reduced cost of the master may be off + +# All specific HiGHS parameter (uncomment based on Solver) +#primal_feasibility_tolerance 1e-9 +#dual_feasibility_tolerance 1e-9 + +0 # number of string parameters + +# now all the string parameters +# [none] + +#strOutputFile master.lp + +# All specific HiGHS parameter (uncomment based on Solver) +#presolve off # disable presolve for reproducibility +#solver ipm # interior point: converges to analytic center (unique x*) + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END MPBCfg_grb.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/MPCfg.txt b/pysmspp/data/configs/TSSBlock/MPCfg.txt new file mode 100644 index 0000000..0a4c2f7 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/MPCfg.txt @@ -0,0 +1,99 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - MPCfg.txt - - - - - - - - - - - - - - - - +# +# The ComputeConfig of the :MILPSolver of the MasterProblemBlock used by +# the BundleSolver, shared by MPBCfg.txt and MPBCfg-IP.txt. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +4 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity of the MILPSolver +intRelaxIntVars 1 # nonzero if the continuous relaxation is solved +intCutSepPar 7 # separate user cuts + lazy constraints +intMaxThread 1 # single-threaded for deterministic master reproducibility + +# All specific CPLEX parameter (uncomment based on Solver) +#CPXPARAM_LPMethod 1 # 0 = auto, 1 = primal, 2 = dual, 4 = + # barrier +#CPXPARAM_Emphasis_Numerical 1 # numerical precision emphasis + +# All specific GUROBI parameter (uncomment based on Solver) +#Method 1 # 0 = primal, 1 = dual simplex, 2 = barrier: the + # multipliers of the master ARE the algorithm, and an + # interior point has them only to about 1e-7 relative, + # which the stopping test of the bundle cannot survive; + # besides, the barrier cannot restart from the previous + # basis, so it re-solves the master from scratch at every + # call, while the simplex re-optimises after the new + # columns for a fraction of the iterations +#NumericFocus 1 # 0 = auto, 1..3 = increasing precision focus: the master + # is small and re-solved thousands of times, so whatever + # extra care is asked is paid at every one of them, and 3 + # costs a factor two. 0 is not an option: with it the + # Lagrangian dual answers Unfeas on a hydrothermal instance + # that has a solution, so this is the least care that + # answers right +#Presolve 0 # 0 = off, 1 = conservative, 2 = aggressive (default -1): + # left off deliberately, a master the presolve reduces is + # declared infeasible on tolerance when the model is badly + # scaled, and the bundle reads that as a numerical error + +3 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-08 # relative accuracy required to solution +dblAAccSol 1e-08 # absolute accuracy required to solution +dblRAccSol 1e-08 # relative accuracy of the solution pool + +# The master has to satisfy its own rows *tighter* than the oracle satisfies +# its own feasibility, or the loop cannot end: a step that violates a +# vertical row by less than the default 1e-6 is feasible for the master and +# infeasible for the subproblem, which answers with the very cut that is +# already there, and the same iteration repeats forever. +#FeasibilityTol 1e-09 # how much a row of the master may be violated +#OptimalityTol 1e-09 # how much a reduced cost of the master may be off + +# All specific HiGHS parameter (uncomment based on Solver) +# (not tighter: at 1e-9 the QP solver of HiGHS fails on the master) +#primal_feasibility_tolerance 1e-9 +#dual_feasibility_tolerance 1e-9 + +0 # number of string parameters + +# now all the string parameters +# [none] + +#strOutputFile master.lp + +# All specific HiGHS parameter (uncomment based on Solver) +#presolve off # disable presolve for reproducibility +#solver ipm # interior point: converges to analytic center (unique x*) + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END MPCfg.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/PFBCfg.txt b/pysmspp/data/configs/TSSBlock/PFBCfg.txt new file mode 100644 index 0000000..48b86c9 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/PFBCfg.txt @@ -0,0 +1,49 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - PFBCfg.txt - - - - - - - - - - - - - - - - - +# +# The BlockConfig of a PolyhedralFunctionBlock: its linearized form. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockConfig # exact type of the Configuration object + +1 # the BlockConfig is a "differential" one + +2 # version of the BlockConfig format + +# the Configuration for the structure, i.e., the tree of sub-Block +* # [none] + +# static_constraints +* # [none] + +# dynamic_constraints +* # [none] + +# static_variables +SimpleConfiguration +1 # use the "linearized" representation of the PolyhedralFunction + +# dynamic_variables +* # [none] + +# objective +* # [none] + +# is_feasible +SimpleConfiguration> +1e-6 1 # feasibility tolerance, relative violation + +# is_optimal +* # [none] + +# solution +* # [none] + +# extra +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END PFBCfg.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/PIPSCfg.txt b/pysmspp/data/configs/TSSBlock/PIPSCfg.txt new file mode 100644 index 0000000..71b85cb --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/PIPSCfg.txt @@ -0,0 +1,57 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - PIPSCfg.txt - - - - - - - - - - - - - - - +# +# The ComputeConfig of the PIPSMILPSolver of TSSBSCfg-PIPS.txt: the +# continuous relaxation, equilibrium scaling, no presolve of PIPS-IPM++, the +# linear solvers of the build (MUMPS; PARDISO at the root hangs in the +# factorization of the Schur complement with 25 or more processes). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +3 # number of integer parameters + +# now all the integer parameters +intLogVerb 0 # log verbosity of the PIPSMILPSolver +intRelaxIntVars 1 # the continuous relaxation: PIPS-IPM++ solves LPs +PRESOLVE 0 # presolve of PIPS-IPM++ off + +1 # number of double parameters + +# now all the double parameters +IPM_TIMELIMIT 3600 # maximum time of the interior point method + +1 # number of string parameters + +# now all the string parameters +SCALER equilibrium # scaling of the problem: with curtisreid the interior + # point stops at its iteration limit on unit commitment + # relaxations, and equilibrium is also 7 to 14% faster + # where both converge + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - END PIPSCfg.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS-CVX-LD.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS-CVX-LD.txt new file mode 100644 index 0000000..d9dcf0b --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS-CVX-LD.txt @@ -0,0 +1,32 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - TSSBSCfg-BDS-CVX-LD.txt - - - - - - - - - - - - - - +# +# The BendersDecompositionSolver of TSSBSCfg-BDS-LD.txt in the convex +# regime (BDSCfg-CVX-LD.txt): a BundleSolver on the master, the subproblems +# solved by the recursive Lagrangian dual. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +0 # the BlockSolverConfig is not a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +BendersDecompositionSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +*BDSCfg-CVX-LD.txt + +# end of 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - END TSSBSCfg-BDS-CVX-LD.txt - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS-CVX-int.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS-CVX-int.txt new file mode 100644 index 0000000..a6542a6 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS-CVX-int.txt @@ -0,0 +1,33 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - TSSBSCfg-BDS-CVX-int.txt - - - - - - - - - - - - - +# +# The BendersDecompositionSolver of TSSBSCfg-BDS.txt in the convex regime +# when the design is integer (BDSCfg-CVX-int.txt): a BundleSolver on the +# master that keeps the design integer, the subproblems those of +# BDSSCfg.txt. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +0 # the BlockSolverConfig is not a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +BendersDecompositionSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +*BDSCfg-CVX-int.txt + +# end of 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - END TSSBSCfg-BDS-CVX-int.txt - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS-LD.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS-LD.txt new file mode 100644 index 0000000..f24b781 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS-LD.txt @@ -0,0 +1,32 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - TSSBSCfg-BDS-LD.txt - - - - - - - - - - - - - - - +# +# The BendersDecompositionSolver of TSSBSCfg-BDS.txt whose subproblems are +# solved by the recursive Lagrangian dual (BDSCfg-LD.txt): the value and the +# cut of a scenario come from the dual over its units. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +0 # the BlockSolverConfig is not a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +BendersDecompositionSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +*BDSCfg-LD.txt + +# end of 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - END TSSBSCfg-BDS-LD.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS.txt new file mode 100644 index 0000000..5a86b14 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-BDS.txt @@ -0,0 +1,33 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - TSSBSCfg-BDS.txt - - - - - - - - - - - - - - - - +# +# A BendersDecompositionSolver in the MILP regime, one cut per scenario, +# the scenarios of a round evaluated by 8 threads, on the Benders form +# smspp_tssb_solver -k assembles (BDSCfg.txt, whose master and subproblems +# are those of BDSMCfg.txt and BDSSCfg.txt). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +0 # the BlockSolverConfig is not a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +BendersDecompositionSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +*BDSCfg.txt + +# end of 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - END TSSBSCfg-BDS.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-IB.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-IB.txt new file mode 100644 index 0000000..7374928 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-IB.txt @@ -0,0 +1,111 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - TSSBSCfg-IB.txt - - - - - - - - - - - - - - - - +# +# The BundleSolver of InvestmentBlock/BSPar.txt on an InvestmentBlock over a +# TSSB or an MSSB (the investment_outside form of pypsa2smspp), whose inner +# stochastic Block is solved whole at every evaluation by BSCfg-IB.txt. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +BundleSolver # name of Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the LagrangianDualSolver; it mostly is the +# ComputeConfig of the inner Solver, which is a [Parallel]BundleSolver + +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +17 # number of integer parameters + +# now all the integer parameters +intMPStbl 0 # stabilization: 0 = proximal, 1 = level, 2 = doubly stabilized +intDoEasy 0 # do easy components for (some) LagBFunction +intMaxIter 10000 # max number of iterations for each call +intMaxThread 6 # MaxThread, max number of new tasks to spawn +intLogVerb 16 # log verbosity of main Bundle algorithm +intWZNorm 10 # which norm to use in the norm-based stopping condition: + # the 2-norm, dblNZEps being relative to that of the first + # full subgradient; taken as absolute, 1e-4 is below what + # the aggregated subgradient reaches on a design in MW, + # and the bundle goes on long after the optimum +intBPar1 20 # discard items when they have been useless for iterations +intBPar2 1000 # max bundle size per component +intBPar3 1 # max n. of items to fetch from Fi() at each iteration +intBPar4 1 # min n. of items to fetch from Fi() at each iteration +intBPar6 0 # second parameter for dynamic max n. of items per iteration +intBPar7 15 # how to deal with the global pools +intMnSSC 0 # min number of consecutive SS with the same t for a t increase +intMnNSC 3 # min number of consecutive NS with the same t for a t decrease +inttSPar1 0 # long-term t-strategy (0 = none, 4 = soft, 8 = hard, 12 = balancing) +intMaxNrEvls 2 # maximum number of function evaluations at each iteration + +intRstAlg 2 # parameter to handle the reset of the algorithm + +15 # number of double parameters + +# now all the double parameters +dblRelAcc 1e-6 # relative accuracy required to solution +dblNZEps 1e-9 # stopping parameter: threshold to declare 0 the || residual ||, + # relative to the first full subgradient (intWZNorm 10), + # which at a design of 0 is millions: with 1e-4 the bundle + # stops where the residual is still a few units, far from + # the optimum (2.9% above it on a TSSB of 9 scenarios) +dbltStar -100 # stopping parameter: multiplied to || residual || to estimate gap +dblBPar5 4 # first parameter for dynamic max n. of items per iteration +dblm1 -0.30 # a NS is possible if (~) Fi( Lambda1 ) >= Fi( Lambda ) + | m1 | v* +dblm2 0.90 # a SS is possible if Fi( Lambda1 ) <= Fi( Lambda ) + ( 1 - m2 ) v* +dblm3 0.99 # a NR is computed if \sigma^* < - t * m3 * || z* || +dblmxIncr 10 # max increase of t +dblmnIncr 1.5 # min increase of t (each time it is increased) +dblmxDecr 0.1 # max decrease of t +dblmnDecr 0.66 # min decrease of t (each time it is decreased) +dbltMaior 1e+6 # maximum value for t +dbltMinor 1e-10 # minimum value for t +dbltInit 1e+0 # initial value for t +dbltSPar2 1e-2 # parameter for the long-term t-strategy + +1 # number of string parameters + +# now all the string parameters +#str_LagBF_BSCfg LPBSCfg.txt # BlockSolverConfig for the LagBFunctions +# not needed if intDoEasy >= 1 && USE_BundleSolver > 0, this is done "by hand" +strMPBSolverCfg MPBCfg.txt # BlockSolverConfig for the MasterProblemBlock's Solver + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# end of 1st ComputeConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - END BSPar.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-IP.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-IP.txt new file mode 100644 index 0000000..725c568 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-IP.txt @@ -0,0 +1,32 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - TSSBSCfg-IP.txt - - - - - - - - - - - - - - - - +# +# A TSSBlock solved whole by a :MILPSolver with its integer Variable. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of 1st Solver +GRBMILPSolver # name of 1st Solver +#SCIPMILPSolver # name of 1st Solver +#HiGHSMILPSolver # name of 1st Solver +# [no second Solver: this configuration times the :MILPSolver alone] + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +*MILPCfg-IP.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END TSSBSCfg-IP.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-LD-IP-par.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LD-IP-par.txt new file mode 100644 index 0000000..e3e6092 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LD-IP-par.txt @@ -0,0 +1,74 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - TSSBSCfg-LD-IP-par.txt - - - - - - - - - - - - - +# +# TSSBSCfg-LD-IP.txt with a ParallelBundleSolver as its bundle: the +# components of an iteration are evaluated by 8 threads and consumed in +# a fixed order (intParFrm 1), so that the run does not depend on the +# order the threads finish in. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +LagrangianDualSolver # name of the Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# the ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the LagrangianDualSolver; it mostly is the +# ComputeConfig of the inner Solver, which is a [Parallel]BundleSolver + +*LDCfg.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +5 # number of integer parameters + +intMaxThread 8 # threads evaluating the components of an iteration +intParFrm 1 # futures consumed in a fixed order: deterministic + +int_LDSlv_iBCopy 0 # 1 if sub-Block must be R3B-copied +intLogVerb 1 # log verbosity of main Bundle algorithm +intTrgtMng 0 # bit-wise encoding targets and accuracies management: + # bit 0: if lower/upper target is set to each convex/concave component + # bit 1: if upper/lower target is set to each convex/concave component + # bit 2-3: if accuracy is set (2 = upper - lower, 3 = using EpsU) + # bit 4: if Lipschitz constant is used to compute the upper model + +3 # number of double parameters + +dblMaxTime 3600 # maximum time for a call, so that the nested dual is + # given the same budget as the MILP it is compared with + +dbltStar -1e+0 # stopping parameter: multiplied to || residual || to estimate gap +dbltInit 1e-3 # initial value for t + +2 # number of string parameters + +str_LDSlv_ISName ParallelBundleSolver # the inner Solver of the LagrangianDualSolver + +str_LagBF_BSCfg InnerBSCfg-IP.txt # BlockSolverConfig for the LagBFunctions + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - END TSSBSCfg-LD-IP-par.txt - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-LD-IP.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LD-IP.txt new file mode 100644 index 0000000..1853ab2 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LD-IP.txt @@ -0,0 +1,67 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - TSSBSCfg-LD-IP.txt - - - - - - - - - - - - - - - +# +# A TSSBlock solved by the Lagrangian dual of its scenarios, each one +# solved whole by a :MILPSolver (InnerBSCfg-IP.txt). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +LagrangianDualSolver # name of the Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# the ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the LagrangianDualSolver; it mostly is the +# ComputeConfig of the inner Solver, which is a [Parallel]BundleSolver + +*LDCfg.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +3 # number of integer parameters + +int_LDSlv_iBCopy 0 # 1 if sub-Block must be R3B-copied +intLogVerb 1 # log verbosity of main Bundle algorithm +intTrgtMng 0 # bit-wise encoding targets and accuracies management: + # bit 0: if lower/upper target is set to each convex/concave component + # bit 1: if upper/lower target is set to each convex/concave component + # bit 2-3: if accuracy is set (2 = upper - lower, 3 = using EpsU) + # bit 4: if Lipschitz constant is used to compute the upper model + +3 # number of double parameters + +dblMaxTime 3600 # maximum time for a call, so that the nested dual is + # given the same budget as the MILP it is compared with + +dbltStar -1e+0 # stopping parameter: multiplied to || residual || to estimate gap +dbltInit 1e-3 # initial value for t + +1 # number of string parameters + +str_LagBF_BSCfg InnerBSCfg-IP.txt # BlockSolverConfig for the LagBFunctions + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - END TSSBSCfg-LD-IP.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-LD.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LD.txt index 08055a6..b952684 100644 --- a/pysmspp/data/configs/TSSBlock/TSSBSCfg-LD.txt +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LD.txt @@ -29,9 +29,10 @@ ComputeConfig # exact type of the ComputeConfig object 1 # f_diff == 0 ==> all non-provided parameters are set to the default value # f_diff == 1 ==> all non-provided parameters are not changed -25 # number of integer parameters +19 # number of integer parameters # now all the integer parameters +intMPStbl 0 # stabilization: 0 = proximal, 1 = level, 2 = doubly stabilized intPushCostToOwner 1 # whether sub-Block Objective are changed intDoEasy 0 # do easy components for (some) LagBFunction intMaxIter 10000 # max number of iterations for each call @@ -48,30 +49,15 @@ intMnSSC 0 # min number of consecutive SS with the same t for a t increas intMnNSC 1 # min number of consecutive NS with the same t for a t decrease inttSPar1 12 # long-term t-strategy (0 = none, 4 = soft, 8 = hard, 12 = balancing) intMaxNrEvls 2 # maximum number of function evaluations at each iteration -intMPName 15 # MP solver: 0 = QPP, 7 = Cplex/Gurobi with quadratic stabilization - # + 8 = check for duplicate linearizations intTrgtMng 31 # bit-wise encoding targets and accuracies management: # bit 0: if lower/upper target is set to each convex/concave component # bit 1: if upper/lower target is set to each convex/concave component # bit 2-3: if accuracy is set (2 = upper - lower, 3 = using EpsU) # bit 4: if Lipschitz constant is used to compute the upper model -# QPPenalty's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - - - -intMPlvl 7 # log verbosity of Master Problem -intQPmp1 0 # MxAdd, how many variables can be added to the base at each - # iteration in BMinQuad (0 = at will) -intQPmp2 0 # MxRmv, how many variables can be removed from the base at each - # iteration in BMinQuad (0 = at will) - -# OSIMPSolver's parameters :- - - - - - - - - - - - - - - - - - - - - - - - - - -intOSImp1 0 # Osi(Cpx/Grb)Solver algorithm (0 = auto (default), 1 = primal, 2 = dual, 3 = network, 4 = barrier, 5 = sifting, 6 = concurrent) -intOSImp2 0 # pre-processing (reduction) -intOSImp3 1 # threads intRstAlg 2 # parameter to handle the reset of the algorithm -16 # number of double parameters +15 # number of double parameters # now all the double parameters dblRelAcc 1e-6 # relative accuracy required to solution @@ -89,9 +75,8 @@ dbltMaior 1e+6 # maximum value for t dbltMinor 1e-10 # minimum value for t dbltInit 1e-3 # initial value for t dbltSPar2 1e-2 # parameter for the long-term t-strategy -dblCtOff 0.01 # cut-off factor for pricing in MinQuad -2 # number of string parameters +3 # number of string parameters # now all the string parameters #strLogFileName tssb.log # filename for the Solver log @@ -99,6 +84,7 @@ dblCtOff 0.01 # cut-off factor for pricing in MinQuad str_LDSlv_ISName BundleSolver # the inner Solver used by LagrangianDualSolver #str_LagBF_BSCfg LPBSCfg-LD.txt # BlockSolverConfig for the LagBFunctions str_LagBF_BSCfg BSCfg.txt # BlockSolverConfig for the LagBFunctions +strMPBSolverCfg MPBCfg.txt # BlockSolverConfig for the MasterProblemBlock's Solver 0 # number of vector-of-int parameters diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDLD-par.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDLD-par.txt new file mode 100644 index 0000000..a545595 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDLD-par.txt @@ -0,0 +1,83 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - TSSBSCfg-LDLD-par.txt - - - - - - - - - - - - - +# +# TSSBSCfg-LDLD.txt with a ParallelBundleSolver as its bundle: the +# components of an iteration are evaluated by 8 threads and consumed in +# a fixed order (intParFrm 1), so that the run does not depend on the +# order the threads finish in. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +LagrangianDualSolver # name of the Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# the ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the LagrangianDualSolver; it mostly is the +# ComputeConfig of the inner Solver, which is a [Parallel]BundleSolver + +*LDCfg.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +5 # number of integer parameters + +intMaxThread 8 # threads evaluating the components of an iteration +intParFrm 1 # futures consumed in a fixed order: deterministic + +int_LDSlv_iBCopy 0 # 1 if sub-Block must be R3B-copied +intLogVerb 1 # log verbosity of main Bundle algorithm +intTrgtMng 31 # bit-wise encoding targets and accuracies management: + # bit 0: if lower/upper target is set to each convex/concave component + # bit 1: if upper/lower target is set to each convex/concave component + # bit 2-3: if accuracy is set (2 = upper - lower, 3 = using EpsU) + # bit 4: if Lipschitz constant is used to compute the upper model + +7 # number of double parameters + +dblMaxTime 3600 # maximum time for a call, so that the nested dual is + # given the same budget as the MILP it is compared with + +dblMinNrEvls -1 # every component is evaluated at each iteration: a + # component here is an entire inner LagrangianDualSolver, + # so an iteration made on one of the three alone buys + # little and costs a master problem anyway; on the NC + # instances the evaluations go from 865 and 1705 down + # to 132 and 168 +dblRelAcc 1e-5 # relative accuracy required to solution +dbltStar -1e+0 # stopping parameter: multiplied to || residual || to estimate gap +dblmxIncr 2 # max increase of t +dbltMaior 1e+9 # maximum value for t +dbltInit 1e-3 # initial value for t + +2 # number of string parameters + +str_LDSlv_ISName ParallelBundleSolver # the inner Solver of the LagrangianDualSolver + +str_LagBF_BSCfg LPBSCfg-LDLD.txt # BlockSolverConfig for the LagBFunctions + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - END TSSBSCfg-LDLD-par.txt - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDLD.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDLD.txt new file mode 100644 index 0000000..0fcd088 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDLD.txt @@ -0,0 +1,76 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - TSSBSCfg-LDLD.txt - - - - - - - - - - - - - - - +# +# A TSSBlock solved by the Lagrangian dual of its scenarios, each one +# solved by the Lagrangian dual of its units (LPBSCfg-LDLD.txt). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +LagrangianDualSolver # name of the Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# the ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the LagrangianDualSolver; it mostly is the +# ComputeConfig of the inner Solver, which is a [Parallel]BundleSolver + +*LDCfg.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +3 # number of integer parameters + +int_LDSlv_iBCopy 0 # 1 if sub-Block must be R3B-copied +intLogVerb 1 # log verbosity of main Bundle algorithm +intTrgtMng 31 # bit-wise encoding targets and accuracies management: + # bit 0: if lower/upper target is set to each convex/concave component + # bit 1: if upper/lower target is set to each convex/concave component + # bit 2-3: if accuracy is set (2 = upper - lower, 3 = using EpsU) + # bit 4: if Lipschitz constant is used to compute the upper model + +7 # number of double parameters + +dblMaxTime 3600 # maximum time for a call, so that the nested dual is + # given the same budget as the MILP it is compared with + +dblMinNrEvls -1 # every component is evaluated at each iteration: a + # component here is an entire inner LagrangianDualSolver, + # so an iteration made on one of the three alone buys + # little and costs a master problem anyway; on the NC + # instances the evaluations go from 865 and 1705 down + # to 132 and 168 +dblRelAcc 1e-5 # relative accuracy required to solution +dbltStar -1e+0 # stopping parameter: multiplied to || residual || to estimate gap +dblmxIncr 2 # max increase of t +dbltMaior 1e+9 # maximum value for t +dbltInit 1e-3 # initial value for t + +1 # number of string parameters + +str_LagBF_BSCfg LPBSCfg-LDLD.txt # BlockSolverConfig for the LagBFunctions + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END TSSBSCfg-LDLD.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDrec-par.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDrec-par.txt new file mode 100644 index 0000000..8791774 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDrec-par.txt @@ -0,0 +1,85 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - TSSBSCfg-LDrec-par.txt - - - - - - - - - - - - - +# +# TSSBSCfg-LDrec.txt with a ParallelBundleSolver as its bundle: the +# components of an iteration are evaluated by 8 threads and consumed in +# a fixed order (intParFrm 1), so that the run does not depend on the +# order the threads finish in. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +LagrangianDualSolver # name of the Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# the ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the LagrangianDualSolver; it mostly is the +# ComputeConfig of the inner Solver, which is a [Parallel]BundleSolver + +*LDCfg.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +6 # number of integer parameters + +intMaxThread 8 # threads evaluating the components of an iteration +intParFrm 1 # futures consumed in a fixed order: deterministic + +intRecursive 1 # decompose the descendants too + +int_LDSlv_iBCopy 0 # 1 if sub-Block must be R3B-copied +intLogVerb 1 # log verbosity of main Bundle algorithm +intTrgtMng 31 # bit-wise encoding targets and accuracies management: + # bit 0: if lower/upper target is set to each convex/concave component + # bit 1: if upper/lower target is set to each convex/concave component + # bit 2-3: if accuracy is set (2 = upper - lower, 3 = using EpsU) + # bit 4: if Lipschitz constant is used to compute the upper model + +7 # number of double parameters + +dblMaxTime 3600 # maximum time for a call, so that the nested dual is + # given the same budget as the MILP it is compared with + +dblMinNrEvls -1 # every component is evaluated at each iteration: a + # component here is an entire inner LagrangianDualSolver, + # so an iteration made on one of the three alone buys + # little and costs a master problem anyway; on the NC + # instances the evaluations go from 865 and 1705 down + # to 132 and 168 +dblRelAcc 1e-5 # relative accuracy required to solution +dbltStar -1e+0 # stopping parameter: multiplied to || residual || to estimate gap +dblmxIncr 2 # max increase of t +dbltMaior 1e+9 # maximum value for t +dbltInit 1e-3 # initial value for t + +2 # number of string parameters + +str_LDSlv_ISName ParallelBundleSolver # the inner Solver of the LagrangianDualSolver + +str_LagBF_BSCfg InnerBSCfg.txt # BlockSolverConfig for the LagBFunctions + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - END TSSBSCfg-LDrec-par.txt - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDrec.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDrec.txt new file mode 100644 index 0000000..8a4801e --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LDrec.txt @@ -0,0 +1,78 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - TSSBSCfg-LDrec.txt - - - - - - - - - - - - - - - +# +# A TSSBlock solved by the recursive Lagrangian dual, which relaxes the +# Constraint of the scenarios and of their units at once (intRecursive). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +LagrangianDualSolver # name of the Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# the ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the LagrangianDualSolver; it mostly is the +# ComputeConfig of the inner Solver, which is a [Parallel]BundleSolver + +*LDCfg.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +4 # number of integer parameters + +intRecursive 1 # decompose the descendants too + +int_LDSlv_iBCopy 0 # 1 if sub-Block must be R3B-copied +intLogVerb 1 # log verbosity of main Bundle algorithm +intTrgtMng 31 # bit-wise encoding targets and accuracies management: + # bit 0: if lower/upper target is set to each convex/concave component + # bit 1: if upper/lower target is set to each convex/concave component + # bit 2-3: if accuracy is set (2 = upper - lower, 3 = using EpsU) + # bit 4: if Lipschitz constant is used to compute the upper model + +7 # number of double parameters + +dblMaxTime 3600 # maximum time for a call, so that the nested dual is + # given the same budget as the MILP it is compared with + +dblMinNrEvls -1 # every component is evaluated at each iteration: a + # component here is an entire inner LagrangianDualSolver, + # so an iteration made on one of the three alone buys + # little and costs a master problem anyway; on the NC + # instances the evaluations go from 865 and 1705 down + # to 132 and 168 +dblRelAcc 1e-5 # relative accuracy required to solution +dbltStar -1e+0 # stopping parameter: multiplied to || residual || to estimate gap +dblmxIncr 2 # max increase of t +dbltMaior 1e+9 # maximum value for t +dbltInit 1e-3 # initial value for t + +1 # number of string parameters + +str_LagBF_BSCfg InnerBSCfg.txt # BlockSolverConfig for the LagBFunctions + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - END TSSBSCfg-LDrec.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-LP.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LP.txt new file mode 100644 index 0000000..37a276c --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-LP.txt @@ -0,0 +1,33 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - TSSBSCfg-LP.txt - - - - - - - - - - - - - - - +# +# The continuous relaxation of a TSSBlock, solved whole by a :MILPSolver, +# i.e., the linear program PIPS-IPM++ solves with TSSBSCfg-PIPS.txt. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +#CPXMILPSolver # name of 1st Solver +GRBMILPSolver # name of 1st Solver +#SCIPMILPSolver # name of 1st Solver +#HiGHSMILPSolver # name of 1st Solver +# [no second Solver: this configuration times the :MILPSolver alone] + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + +*MILPCfg-LP.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END TSSBSCfg-LP.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-PIPS.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-PIPS.txt new file mode 100644 index 0000000..267b3ef --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-PIPS.txt @@ -0,0 +1,30 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - TSSBSCfg-PIPS.txt - - - - - - - - - - - - - - +# +# A TSSBlock solved whole by PIPS-IPM++, an interior point method for linear +# programs that exploits the block structure of the scenarios; run under +# mpirun, one process per group of scenarios (PIPSCfg.txt). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +0 # the BlockSolverConfig is not a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +PIPSMILPSolver # name of 1st Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the PIPSMILPSolver + +*PIPSCfg.txt + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END TSSBSCfg-PIPS.txt - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TSSBSCfg-PPH.txt b/pysmspp/data/configs/TSSBlock/TSSBSCfg-PPH.txt new file mode 100644 index 0000000..f7d3942 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TSSBSCfg-PPH.txt @@ -0,0 +1,96 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - TSSBSCfg-PPH.txt - - - - - - - - - - - - - - - +# +# A TSSBlock solved by the PrimalProximalHeur over the Lagrangian dual of +# its scenarios (LPBSCfg-LDLD.txt), which fixes the design to its mean over +# the scenarios and solves each one alone (BSCfg1-IP.txt, 8 threads). +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig + +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +PrimalProximalHeur # name of 2nd Solver + +1 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +# 1st ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the :MILPSolver + + +# 2nd ComputeConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# ComputeConfig of the LagrangianDualSolver; it mostly is the +# ComputeConfig of the inner Solver, which is a [Parallel]BundleSolver + +*LDCfg.txt + + +1 # f_diff == 1 ==> only the entries listed below are changed + +5 # number of integer parameters + +intUseWarmStartPSol 0 # the first iteration solves the plain Lagrangian Dual, + # so its bound is valid for the integer problem and + # stronger than the one of the continuous relaxation + +int_LDSlv_iBCopy 0 # 1 if sub-Block must be R3B-copied +intLogVerb 0 # log verbosity of main Bundle algorithm +intTrgtMng 31 # bit-wise targets and accuracies management: lower + # and upper targets, accuracy as upper - lower, and + # the Lipschitz constant in the upper model +intMaxThread 7 # threads solving the scenarios of the recovery, + # besides the one calling compute() + +8 # number of double parameters + +dbl_penaltyFactor 1e-1 # weight of the proximal term + +dblMaxTime 3600 # maximum time for a call, so that the nested dual is + # given the same budget as the MILP it is compared with + +dblMinNrEvls -1 # every component is evaluated at each iteration: a + # component here is an entire inner LagrangianDualSolver, + # so an iteration made on one of the three alone buys + # little and costs a master problem anyway; on the NC + # instances the evaluations go from 865 and 1705 down + # to 132 and 168 +dblRelAcc 1e-5 # relative accuracy required to solution +dbltStar -1e+0 # stopping parameter: multiplied to || residual || to estimate gap +dblmxIncr 2 # max increase of t +dbltMaior 1e+9 # maximum value for t +dbltInit 1e-3 # initial value for t + +3 # number of string parameters + +str_LDSlv_ISCfg ISCfg-PPH.txt # ComputeConfig of the inner Solver: the + # iterations and the accuracy of the + # Lagrangian Dual at each proximal step +str_LagBF_BSCfg LPBSCfg-LDLD.txt +strRecoveryBSC BSCfg1-IP.txt # BlockSolverConfig of the recovery: each + # scenario a MILP at the fixed design + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# end of BlockSolverConfig- - - - - - - - - - - - - - - - - - - - - - - - - - + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END TSSBSCfg-PPH.txt - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TUBCfg.txt b/pysmspp/data/configs/TSSBlock/TUBCfg.txt new file mode 100644 index 0000000..21e46c4 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TUBCfg.txt @@ -0,0 +1,52 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - TUBCfg.txt - - - - - - - - - - - - - - - - - +# +# The BlockConfig of a ThermalUnitBlock: formulation and perspective cuts. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockConfig # exact type of the ComputeConfig object + +1 # the BlockConfig is a "differential" one + +2 # version of the BlockConfig format + +# the Configuration for the structure, i.e., the tree of sub-Block +* # [none] + +# static_constraints +* # [none] + +# dynamic_constraints +SimpleConfiguration> +1e-6 # threshold parameter for P/C separation +1e-4 # tolerance value to consider a binary variable + +# static_variables +SimpleConfiguration +0 # 0 = 3bin, 1 = T, 2 = pt, 3 = DP, 4 = SU, 5 = SD, 6 = SUSD (Formulation) +#9 # +8 with Perspective Cuts +#17 # +16: start-up / shut-down variables are continuous + +# dynamic_variables +* # [none] + +# objective +* # [none] + +# is_feasible +* # [none] + +# is_optimal +* # [none] + +# solution +* # [none] + +# extra +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - END TUBCfg.txt - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pysmspp/data/configs/TSSBlock/TUBSCfg-DP.txt b/pysmspp/data/configs/TSSBlock/TUBSCfg-DP.txt new file mode 100644 index 0000000..542c172 --- /dev/null +++ b/pysmspp/data/configs/TSSBlock/TUBSCfg-DP.txt @@ -0,0 +1,60 @@ +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - TUBSCfg-DP.txt - - - - - - - - - - - - - - - - +# +# A ThermalUnitBlock solved by a ThermalUnitExtDPSolver. +# +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlockSolverConfig # exact type of the Configuration object + +1 # the BlockSolverConfig is a "differential" one + +1 # number of (the names of) Solver in this BlockSolverConfig +# now all the names of the Solver - - - - - - - - - - - - - - - - - - - - - - +ThermalUnitExtDPSolver + +0 # number of ComputeConfig in this BlockSolverConfig + +# now all the ComputeConfig +ComputeConfig # exact type of the ComputeConfig object + +1 # f_diff == 0 ==> all non-provided parameters are set to the default value + # f_diff == 1 ==> all non-provided parameters are not changed + +0 # number of integer parameters + +# now all the integer parameters +# [none] + +0 # number of double parameters + +# now all the double parameters +# [none] + +0 # number of string parameters + +# now all the string parameters +# [none] + +0 # number of vector-of-int parameters + +# now all the vector-of-int parameters +# [none] + +0 # number of vector-of-double parameters + +# now all the vector-of-double parameters +# [none] + +0 # number of vector-of-string parameters + +# now all the vector-of-string parameters +# [none] + +# pointer to the "extra" Configuration +* # [none] + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - END TUBSCfg-DP.txt - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/conftest.py b/test/conftest.py index 46dbca6..9980196 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -294,7 +294,10 @@ def add_hub_to_ucblock(b, name_inner_block="Block_0", **kwargs): ucname = get_new_ucname(ucb) ucb.dimensions["NumberUnits"].value += 1 - ucb.dimensions["NumberElectricalGenerators"].value += 1 + # each arc of a HydroUnitBlock is an electrical generator + ucb.dimensions["NumberElectricalGenerators"].value += hub.dimensions[ + "NumberArcs" + ].value ucb.add("HydroUnitBlock", ucname, block=hub) return b diff --git a/test/test_configs.py b/test/test_configs.py index fc11410..348e4ab 100644 --- a/test/test_configs.py +++ b/test/test_configs.py @@ -1,3 +1,7 @@ +import os + +import pytest + from pysmspp import SMSConfig @@ -21,3 +25,41 @@ def test_get_ucsolverconfig_txt(): assert c.config.endswith("uc_solverconfig.txt") assert str(c).endswith("uc_solverconfig.txt") + + +def _named_files(path): + """The files a template names, i.e., the .txt words out of its comments.""" + names = set() + with open(path) as f: + for line in f: + for word in line.split("#")[0].split(): + if word.endswith(".txt"): + names.add(word.lstrip("*")) + return names + + +@pytest.mark.parametrize( + "template", + [ + "TSSBlock/TSSBSCfg-IP.txt", + "TSSBlock/TSSBSCfg-LD-IP.txt", + "TSSBlock/TSSBSCfg-LDLD.txt", + "TSSBlock/TSSBSCfg-LDrec.txt", + "TSSBlock/TSSBSCfg-BDS.txt", + "TSSBlock/TSSBSCfg-PPH.txt", + "TSSBlock/InnerBCfg.txt", + ], +) +def test_template_names_files_of_its_folder(template): + c = SMSConfig(template=template) + folder = os.path.dirname(c.config) + to_check = [os.path.basename(c.config)] + seen = set() + while to_check: + name = to_check.pop() + if name in seen: + continue + seen.add(name) + path = os.path.join(folder, name) + assert os.path.isfile(path), f"{template} names {name}, which is missing" + to_check.extend(_named_files(path)) diff --git a/test/test_optimize.py b/test/test_optimize.py index ddd56f6..f5ce8ce 100644 --- a/test/test_optimize.py +++ b/test/test_optimize.py @@ -1,490 +1,497 @@ -import os -import shutil -from pathlib import Path - -import numpy as np -import pytest -from conftest import ( - add_base_ucblock, - add_bub_to_ucblock, - add_hub_to_ucblock, - add_iub_to_ucblock, - add_sub_to_ucblock, - add_tub_to_ucblock, - add_ucblock_with_one_unit, - build_svm_network, - build_tssb_block, - get_network, - get_temp_file, -) - -from pysmspp import ( - InvestmentBlockSolver, - SMSConfig, - SMSFileType, - SMSNetwork, - UCBlockSolver, -) - -RTOL = 1e-4 -ATOL = 1e-2 - - -def test_help_ucblocksolver(force_smspp): - ucs = UCBlockSolver() - - if ucs.is_available() or force_smspp: - help_msg = ucs.help() - - assert ( - "SMS++ unit commitment solver" in help_msg - or "SMS++ UCBlock solver" in help_msg - ) - else: - pytest.skip("UCBlockSolver not available in PATH") - - -def test_shell_ucblocksolver(): - # skip if not linux os - if os.name != "posix": - pytest.skip("Shell command test only applicable on Linux/Unix systems") - - fp_network = get_network("microgrid_ALLbutStore_1N.nc4") - fp_config = SMSConfig(template="UCBlock/uc_solverconfig.txt") - - solver_cmd = "bash -lc \"printf 'Status = Success\\nUpper bound = 123.0\\nLower bound = 120.0\\n'\"" - - ucs = UCBlockSolver( - solver_path=solver_cmd, - fp_network=str(fp_network), - configfile=str(fp_config), - shell=True, - ) - - ucs.optimize(logging=False) - - assert "Success" in ucs.status - assert ucs.objective_value == pytest.approx(123.0) - assert ucs.lower_bound == pytest.approx(120.0) - - -def test_help_investmentblocksolver(force_smspp): - ibts = InvestmentBlockSolver() - - if ibts.is_available() or force_smspp: - help_msg = ibts.help() - - assert "SMS++ investment solver" in help_msg - else: - pytest.skip("InvestmentBlockSolver not available in PATH") - - -def test_optimize_example(force_smspp): - fp_network = get_network() - fp_log = get_temp_file("test_optimize_example.txt") - configfile = SMSConfig(template="UCBlock/uc_solverconfig.txt") - - ucs = UCBlockSolver( - configfile=str(configfile), - fp_network=fp_network, - fp_log=fp_log, - ) - - if ucs.is_available() or force_smspp: - ucs.optimize(logging=False) - - assert "Success" in ucs.status - assert np.isclose(ucs.objective_value, 3615.760710, atol=ATOL, rtol=RTOL) - else: - pytest.skip("UCBlockSolver not available in PATH") - - -def test_optimize_example_custom_solver_path(force_smspp): - if not UCBlockSolver().is_available() and not force_smspp: - pytest.skip("UCBlockSolver not available in PATH and --force-smspp not set") - - fp_network = get_network() - fp_log = get_temp_file("test_optimize_example.txt") - configfile = SMSConfig(template="UCBlock/uc_solverconfig.txt") - - path_ucsolver = shutil.which("ucblock_solver") - - ucs = UCBlockSolver( - solver_path=Path(path_ucsolver), - configfile=str(configfile), - fp_network=fp_network, - fp_log=fp_log, - ) - - ucs.optimize(logging=False) - - assert "Success" in ucs.status - assert np.isclose(ucs.objective_value, 3615.760710, atol=ATOL, rtol=RTOL) - - -def test_optimize_ucsolver(force_smspp): - b = SMSNetwork(file_type=SMSFileType.eBlockFile) - add_ucblock_with_one_unit(b) - - fp_log = get_temp_file("test_optimize_ucsolver.txt") - fp_temp = get_temp_file("test_optimize_ucsolver.nc") - configfile = SMSConfig(template="UCBlock/uc_solverconfig.txt") - - if UCBlockSolver().is_available() or force_smspp: - result = b.optimize(configfile, fp_temp, fp_log) - - assert "Success" in result.status - else: - pytest.skip("UCBlockSolver not available in PATH") - - -def test_optimize_ucsolver_all_components(force_smspp): - b = SMSNetwork(file_type=SMSFileType.eBlockFile) - - # Add uc block and specify demand - add_base_ucblock(b) - - # Add thermal unit block - add_tub_to_ucblock(b) - - # Add battery unit block - add_bub_to_ucblock(b) - - # Add hydro unit block - add_hub_to_ucblock(b) - - # Add intermittent unit block - add_iub_to_ucblock(b) - - # Add slack unit block - add_sub_to_ucblock(b) - - fp_log = get_temp_file("test_optimize_ucsolver_all_components.txt") - fp_temp = get_temp_file("test_optimize_ucsolver_all_components.nc") - configfile = SMSConfig(template="UCBlock/uc_solverconfig.txt") - - if UCBlockSolver().is_available() or force_smspp: - result = b.optimize(configfile, fp_temp, fp_log, logging=True) - - assert "success" in result.status.lower() - assert "error" not in result.log.lower() - else: - pytest.skip("UCBlockSolver not available in PATH") - - -def test_investmentsolvertest(force_smspp): - fp_network = get_network("investment_1N.nc4") - fp_log = get_temp_file("test_optimize_investmentsolvertest.txt") - configfile = SMSConfig(template="InvestmentBlock/BSPar.txt") - - ucs = InvestmentBlockSolver( - configfile=str(configfile), - fp_network=fp_network, - fp_log=fp_log, - ) - - if InvestmentBlockSolver().is_available() or force_smspp: - ucs.optimize(logging=True) - - assert "success" in ucs.status.lower() - else: - pytest.skip("InvestmentBlockSolver not available in PATH") - - -def test_is_smspp_installed(force_smspp): - """Test the is_smspp_installed() function.""" - from pysmspp import InvestmentBlockSolver, UCBlockSolver, is_smspp_installed - - # The function should return a boolean - result = is_smspp_installed() - assert isinstance(result, bool) - - # Test with multiple solvers - result_multi = is_smspp_installed([UCBlockSolver(), InvestmentBlockSolver()]) - assert isinstance(result_multi, bool) - - # When force_smspp is True, is_smspp_installed must return True - if force_smspp: - assert result is True, ( - "is_smspp_installed should return True when --force-smspp is set" - ) - assert result_multi is True, ( - "is_smspp_installed should return True for all solvers when --force-smspp is set" - ) - - -def test_optimize_tssbsolver(force_smspp): - fp_network = get_network("TSSB_EC_CO_Test_TUB_simple.nc4") - fp_log = get_temp_file("test_optimize_tssbsolver.txt") - configfile = SMSConfig(template="TSSBlock/TSSBSCfg.txt") - - # Create a new TSSB block from the original network and save to a temp file - fp_tssb_new = get_temp_file("test_tssb_new.nc4") - fp_log_new = get_temp_file("test_optimize_tssbsolver_new.txt") - - build_tssb_block(fp_network).to_netcdf(fp_tssb_new, force=True) - - # Copy the original EC_CO_Test_TUB.nc4 to a temp location - fp_ec = get_network("EC_CO_Test_TUB.nc4") - fp_ec_copy = get_temp_file("EC_CO_Test_TUB.nc4") - shutil.copy(fp_ec, fp_ec_copy) - - from pysmspp import TSSBSolver - - tssb_solver = TSSBSolver( - fp_network=fp_network, - fp_log=fp_log, - configfile=str(configfile), - ) - - tssb_solver_new = TSSBSolver( - fp_network=fp_tssb_new, - fp_log=fp_log_new, - configfile=str(configfile), - ) - - if tssb_solver.is_available() or force_smspp: - tssb_solver.optimize(logging=True) - - assert "success" in tssb_solver.status.lower() - - tssb_solver_new.optimize(logging=True) - - assert "success" in tssb_solver_new.status.lower() - - obj_orig = tssb_solver.objective_value - obj_new = tssb_solver_new.objective_value - assert obj_orig == pytest.approx(obj_new, rel=1e-4), ( - f"Objective values should match between original ({obj_orig:.2f}) and new ({obj_new:.2f}) TSSB blocks" - ) - else: - pytest.skip("TSSBBlockSolver not available in PATH") - - -def test_help_svmsolver(force_smspp): - from pysmspp import SVMSolver - - svm = SVMSolver() - - if svm.is_available() or force_smspp: - assert "SMS++ SVM solver" in svm.help() - else: - pytest.skip("SVMSolver not available in PATH") - - -def test_optimize_svmblock_classification(force_smspp): - """ - Train a SVCBlock with the ad hoc SMOSolver. - """ - from pysmspp import SVMSolver - - b = build_svm_network("SVCBlock", C=10.0) - - fp_log = get_temp_file("test_optimize_svcblock.txt") - fp_temp = get_temp_file("test_optimize_svcblock.nc") - configfile = SMSConfig(template="SVMBlock/SVMSCfg.txt") - - if SVMSolver().is_available() or force_smspp: - result = b.optimize(configfile, fp_temp, fp_log) - - assert "Success" in result.status - assert result.score_name == "accuracy" - assert result.training_score >= 0.9 - else: - pytest.skip("SVMSolver not available in PATH") - - -def test_optimize_svmblock_regression(force_smspp): - """ - Train a SVRBlock with the ad hoc SMOSolver. - """ - from pysmspp import SVMSolver - - b = build_svm_network("SVRBlock", C=100.0, Epsilon=0.1) - - fp_log = get_temp_file("test_optimize_svrblock.txt") - fp_temp = get_temp_file("test_optimize_svrblock.nc") - configfile = SMSConfig(template="SVMBlock/SVMSCfg.txt") - - if SVMSolver().is_available() or force_smspp: - result = b.optimize(configfile, fp_temp, fp_log) - - assert "Success" in result.status - assert result.score_name == "R2" - assert result.training_score >= 0.9 - else: - pytest.skip("SVMSolver not available in PATH") - - -def test_optimize_svmblock_formulations(force_smspp): - """ - The training problem has the same value in every formulation and with - every Solver: the Wolfe dual and the primal solved by a :MILPSolver, the - dual solved by the ad hoc SMOSolver, the consensus structure of the - problem in chunks solved by a LagrangianDualSolver, and LIBSVM, which is - only in the Solver factory when SVMBlock has been built with it. - """ - from pysmspp import SVMSolver - - if not SVMSolver().is_available() and not force_smspp: - pytest.skip("SVMSolver not available in PATH") - - fp_network = get_temp_file("test_svmblock_formulations.nc") - build_svm_network("SVCBlock", C=10.0).to_netcdf(fp_network, force=True) - - runs = { - "dual/SMO": ("SVMBlock/SVMSCfg.txt", {}), - "dual/MILP": ("SVMBlock/SVMSCfg_grb.txt", {}), - "primal/MILP": ("SVMBlock/SVMSCfg_grb.txt", {"B": "SVMCfg-primal.txt"}), - "chunks/LD": ("SVMBlock/SVMSCfg-LD.txt", {"s": 4}), - "dual/LIBSVM": ("SVMBlock/SVMSCfg-libsvm.txt", {}), - } - - values = {} - for name, (template, kwargs) in runs.items(): - svm = SVMSolver( - fp_network=fp_network, - configfile=str(SMSConfig(template=template)), - **kwargs, - ) - svm.optimize(logging=False) - - if name == "dual/LIBSVM" and "Success" not in svm.status: - # LIBSVMSolver is only in the Solver factory when SVMBlock has - # been built with LIBSVM, which is an optional dependency - continue - - assert "Success" in svm.status - values[name] = svm.objective_value - - reference = values["dual/SMO"] - for name, value in values.items(): - assert value == pytest.approx(reference, rel=1e-4), ( - f"the value of the training problem of {name} ({value:.6f}) differs from the " - f"one of dual/SMO ({reference:.6f})" - ) - - -def test_svmsolver_model_selection(force_smspp): - """ - A k-fold cross-validation over a grid of hyper-parameters reports the - score of each point of the grid and the best one. - """ - from pysmspp import SVMSolver - - if not SVMSolver().is_available() and not force_smspp: - pytest.skip("SVMSolver not available in PATH") - - fp_network = get_temp_file("test_svmsolver_model_selection.nc") - build_svm_network("SVCBlock").to_netcdf(fp_network, force=True) - - svm = SVMSolver( - fp_network=fp_network, - configfile=str(SMSConfig(template="SVMBlock/SVMSCfg.txt")), - k=4, - g="C=0.1,1,10", - ) - svm.optimize(logging=False) - - assert "Success" in svm.status - assert len(svm.scores) == 3 - - for point in svm.scores: - assert len(point["scores"]) == 4 # one score per fold - assert set(point["params"]) == {"C"} - - assert svm.best_score == pytest.approx(max(p["score"] for p in svm.scores)) - assert svm.best_params["C"] in (0.1, 1.0, 10.0) - - -def test_svmblock_hyperparameters(force_smspp): - """ - The hyper-parameters reach the solver, i.e., they are scalar variables of - the group and not attributes of it, which SMS++ would silently ignore. - """ - from pysmspp import SVMSolver - - if not SVMSolver().is_available() and not force_smspp: - pytest.skip("SVMSolver not available in PATH") - - configfile = str(SMSConfig(template="SVMBlock/SVMSCfg.txt")) - - def train(**kwargs): - fp_network = get_temp_file("test_svmblock_hyperparameters.nc") - build_svm_network("SVCBlock", **kwargs).to_netcdf(fp_network, force=True) - - svm = SVMSolver(fp_network=fp_network, configfile=configfile) - svm.optimize(logging=False) - - assert "Success" in svm.status - return svm.objective_value - - reference = train(C=1.0) - - # a larger C penalises the training errors more, and a nonlinear kernel, - # a squared loss or a regularised bias are a different problem altogether - assert train(C=10.0) > reference - assert train(C=1.0, Kernel=2, Gamma=0.5) != pytest.approx(reference) - assert train(C=1.0, SquaredLoss=1, RegBias=1) != pytest.approx(reference) - - -def test_svmsolver_trained_model(force_smspp): - """ - The trained model is written to the solution file as a SVMBlockSolution, - i.e., as the multipliers and the bias, and the samples whose multiplier - is nonzero are the support vectors. - """ - from pysmspp import SVMSolver - - if not SVMSolver().is_available() and not force_smspp: - pytest.skip("SVMSolver not available in PATH") - - fp_network = get_temp_file("test_svmsolver_trained_model.nc") - fp_solution = get_temp_file("test_svmsolver_trained_model_sol.nc") - - n_samples = 40 - build_svm_network("SVCBlock", C=10.0).to_netcdf(fp_network, force=True) - - svm = SVMSolver( - fp_network=fp_network, - configfile=str(SMSConfig(template="SVMBlock/SVMSCfg.txt")), - fp_solution=fp_solution, - ) - svm.optimize(logging=False) - - assert "Success" in svm.status - - model = svm.solution.blocks["Solution_0"] - - assert model.attributes["type"].value == "SVMBlockSolution" - - alphas = np.asarray(model.variables["Multipliers"].data) - assert alphas.size == n_samples - assert np.all(alphas >= -1e-9) - assert np.all(alphas <= 10.0 + 1e-9) # the multipliers are bounded by C - - support = np.count_nonzero(alphas) - assert 0 < support < n_samples # some samples support the model, not all - - assert np.isfinite(model.variables["Bias"].data) - - -def test_optimize_sddp(force_smspp): - fp_network = get_network("sddp/SDDPBlock.nc4") - fp_log = get_temp_file("test_optimize_sddp.txt") - configfile = SMSConfig(template="SDDPBlock/SDDPSCfg.txt") - - from pysmspp import SDDPSolver - - sddp_solver = SDDPSolver( - fp_network=fp_network, - fp_log=fp_log, - configfile=str(configfile), - ) - - if sddp_solver.is_available() or force_smspp: - sddp_solver.optimize(logging=True) - - assert "success" in sddp_solver.status.lower() - else: - pytest.skip("SDDPSolver not available in PATH") +import os +import shutil +from pathlib import Path + +import numpy as np +import pytest +from conftest import ( + add_base_ucblock, + add_bub_to_ucblock, + add_hub_to_ucblock, + add_iub_to_ucblock, + add_sub_to_ucblock, + add_tub_to_ucblock, + add_ucblock_with_one_unit, + build_svm_network, + build_tssb_block, + get_network, + get_temp_file, +) + +from pysmspp import ( + InvestmentBlockSolver, + SMSConfig, + SMSFileType, + SMSNetwork, + UCBlockSolver, +) + +RTOL = 1e-4 +ATOL = 1e-2 + + +def test_help_ucblocksolver(force_smspp): + ucs = UCBlockSolver() + + if ucs.is_available() or force_smspp: + help_msg = ucs.help() + + assert ( + "SMS++ unit commitment solver" in help_msg + or "SMS++ UCBlock solver" in help_msg + ) + else: + pytest.skip("UCBlockSolver not available in PATH") + + +def test_shell_ucblocksolver(): + # skip if not linux os + if os.name != "posix": + pytest.skip("Shell command test only applicable on Linux/Unix systems") + + fp_network = get_network("microgrid_ALLbutStore_1N.nc4") + fp_config = SMSConfig(template="UCBlock/uc_solverconfig.txt") + + solver_cmd = "bash -lc \"printf 'Status = Success\\nUpper bound = 123.0\\nLower bound = 120.0\\n'\"" + + ucs = UCBlockSolver( + solver_path=solver_cmd, + fp_network=str(fp_network), + configfile=str(fp_config), + shell=True, + ) + + ucs.optimize(logging=False) + + assert "Success" in ucs.status + assert ucs.objective_value == pytest.approx(123.0) + assert ucs.lower_bound == pytest.approx(120.0) + + +def test_help_investmentblocksolver(force_smspp): + ibts = InvestmentBlockSolver() + + if ibts.is_available() or force_smspp: + help_msg = ibts.help() + + assert "SMS++ investment solver" in help_msg + else: + pytest.skip("InvestmentBlockSolver not available in PATH") + + +def test_optimize_example(force_smspp): + fp_network = get_network() + fp_log = get_temp_file("test_optimize_example.txt") + configfile = SMSConfig(template="UCBlock/uc_solverconfig.txt") + + ucs = UCBlockSolver( + configfile=str(configfile), + fp_network=fp_network, + fp_log=fp_log, + ) + + if ucs.is_available() or force_smspp: + ucs.optimize(logging=False) + + assert "Success" in ucs.status + assert np.isclose(ucs.objective_value, 3615.760710, atol=ATOL, rtol=RTOL) + else: + pytest.skip("UCBlockSolver not available in PATH") + + +def test_optimize_example_custom_solver_path(force_smspp): + if not UCBlockSolver().is_available() and not force_smspp: + pytest.skip("UCBlockSolver not available in PATH and --force-smspp not set") + + fp_network = get_network() + fp_log = get_temp_file("test_optimize_example.txt") + configfile = SMSConfig(template="UCBlock/uc_solverconfig.txt") + + path_ucsolver = shutil.which("ucblock_solver") + + ucs = UCBlockSolver( + solver_path=Path(path_ucsolver), + configfile=str(configfile), + fp_network=fp_network, + fp_log=fp_log, + ) + + ucs.optimize(logging=False) + + assert "Success" in ucs.status + assert np.isclose(ucs.objective_value, 3615.760710, atol=ATOL, rtol=RTOL) + + +def test_optimize_ucsolver(force_smspp): + b = SMSNetwork(file_type=SMSFileType.eBlockFile) + add_ucblock_with_one_unit(b) + + fp_log = get_temp_file("test_optimize_ucsolver.txt") + fp_temp = get_temp_file("test_optimize_ucsolver.nc") + configfile = SMSConfig(template="UCBlock/uc_solverconfig.txt") + + if UCBlockSolver().is_available() or force_smspp: + result = b.optimize(configfile, fp_temp, fp_log) + + assert "Success" in result.status + else: + pytest.skip("UCBlockSolver not available in PATH") + + +def test_optimize_ucsolver_all_components(force_smspp): + b = SMSNetwork(file_type=SMSFileType.eBlockFile) + + # Add uc block and specify demand + add_base_ucblock(b) + + # Add thermal unit block + add_tub_to_ucblock(b) + + # Add battery unit block + add_bub_to_ucblock(b) + + # Add hydro unit block + add_hub_to_ucblock(b) + + # Add intermittent unit block + add_iub_to_ucblock(b) + + # Add slack unit block + add_sub_to_ucblock(b) + + fp_log = get_temp_file("test_optimize_ucsolver_all_components.txt") + fp_temp = get_temp_file("test_optimize_ucsolver_all_components.nc") + configfile = SMSConfig(template="UCBlock/uc_solverconfig.txt") + + if UCBlockSolver().is_available() or force_smspp: + result = b.optimize(configfile, fp_temp, fp_log, logging=True) + + assert "success" in result.status.lower() + assert "error" not in result.log.lower() + else: + pytest.skip("UCBlockSolver not available in PATH") + + +def test_investmentsolvertest(force_smspp): + fp_network = get_network("investment_1N.nc4") + fp_log = get_temp_file("test_optimize_investmentsolvertest.txt") + configfile = SMSConfig(template="InvestmentBlock/BSPar.txt") + + ucs = InvestmentBlockSolver( + configfile=str(configfile), + fp_network=fp_network, + fp_log=fp_log, + ) + + if InvestmentBlockSolver().is_available() or force_smspp: + ucs.optimize(logging=True) + + assert "success" in ucs.status.lower() + else: + pytest.skip("InvestmentBlockSolver not available in PATH") + + +def test_is_smspp_installed(force_smspp): + """Test the is_smspp_installed() function.""" + from pysmspp import InvestmentBlockSolver, UCBlockSolver, is_smspp_installed + + # The function should return a boolean + result = is_smspp_installed() + assert isinstance(result, bool) + + # Test with multiple solvers + result_multi = is_smspp_installed([UCBlockSolver(), InvestmentBlockSolver()]) + assert isinstance(result_multi, bool) + + # When force_smspp is True, is_smspp_installed must return True + if force_smspp: + assert result is True, ( + "is_smspp_installed should return True when --force-smspp is set" + ) + assert result_multi is True, ( + "is_smspp_installed should return True for all solvers when --force-smspp is set" + ) + + +def test_optimize_tssbsolver(force_smspp): + fp_network = get_network("TSSB_EC_CO_Test_TUB_simple.nc4") + fp_log = get_temp_file("test_optimize_tssbsolver.txt") + configfile = SMSConfig(template="TSSBlock/TSSBSCfg.txt") + + # Create a new TSSB block from the original network and save to a temp file + fp_tssb_new = get_temp_file("test_tssb_new.nc4") + fp_log_new = get_temp_file("test_optimize_tssbsolver_new.txt") + + build_tssb_block(fp_network).to_netcdf(fp_tssb_new, force=True) + + # Copy the original EC_CO_Test_TUB.nc4 to a temp location + fp_ec = get_network("EC_CO_Test_TUB.nc4") + fp_ec_copy = get_temp_file("EC_CO_Test_TUB.nc4") + shutil.copy(fp_ec, fp_ec_copy) + + from pysmspp import TSSBSolver + + tssb_solver = TSSBSolver( + fp_network=fp_network, + fp_log=fp_log, + configfile=str(configfile), + ) + + tssb_solver_new = TSSBSolver( + fp_network=fp_tssb_new, + fp_log=fp_log_new, + configfile=str(configfile), + ) + + if tssb_solver.is_available() or force_smspp: + tssb_solver.optimize(logging=True) + + assert "success" in tssb_solver.status.lower() + + tssb_solver_new.optimize(logging=True) + + assert "success" in tssb_solver_new.status.lower() + + obj_orig = tssb_solver.objective_value + obj_new = tssb_solver_new.objective_value + assert obj_orig == pytest.approx(obj_new, rel=1e-4), ( + f"Objective values should match between original ({obj_orig:.2f}) and new ({obj_new:.2f}) TSSB blocks" + ) + else: + pytest.skip("TSSBBlockSolver not available in PATH") + + +def test_help_svmsolver(force_smspp): + from pysmspp import SVMSolver + + svm = SVMSolver() + + if svm.is_available() or force_smspp: + assert "SMS++ SVM solver" in svm.help() + else: + pytest.skip("SVMSolver not available in PATH") + + +def test_optimize_svmblock_classification(force_smspp): + """ + Train a SVCBlock with the ad hoc SMOSolver. + """ + from pysmspp import SVMSolver + + b = build_svm_network("SVCBlock", C=10.0) + + fp_log = get_temp_file("test_optimize_svcblock.txt") + fp_temp = get_temp_file("test_optimize_svcblock.nc") + configfile = SMSConfig(template="SVMBlock/SVMSCfg.txt") + + if SVMSolver().is_available() or force_smspp: + result = b.optimize(configfile, fp_temp, fp_log) + + assert "Success" in result.status + assert result.score_name == "accuracy" + assert result.training_score >= 0.9 + else: + pytest.skip("SVMSolver not available in PATH") + + +def test_optimize_svmblock_regression(force_smspp): + """ + Train a SVRBlock with the ad hoc SMOSolver. + """ + from pysmspp import SVMSolver + + b = build_svm_network("SVRBlock", C=100.0, Epsilon=0.1) + + fp_log = get_temp_file("test_optimize_svrblock.txt") + fp_temp = get_temp_file("test_optimize_svrblock.nc") + configfile = SMSConfig(template="SVMBlock/SVMSCfg.txt") + + if SVMSolver().is_available() or force_smspp: + result = b.optimize(configfile, fp_temp, fp_log) + + assert "Success" in result.status + assert result.score_name == "R2" + assert result.training_score >= 0.9 + else: + pytest.skip("SVMSolver not available in PATH") + + +def test_optimize_svmblock_formulations(force_smspp): + """ + The training problem has the same value in every formulation and with + every Solver: the Wolfe dual and the primal solved by a :MILPSolver, the + dual solved by the ad hoc SMOSolver, the consensus structure of the + problem in chunks solved by a LagrangianDualSolver, and LIBSVM, which is + only in the Solver factory when SVMBlock has been built with it. + """ + from pysmspp import SVMSolver + + if not SVMSolver().is_available() and not force_smspp: + pytest.skip("SVMSolver not available in PATH") + + fp_network = get_temp_file("test_svmblock_formulations.nc") + build_svm_network("SVCBlock", C=10.0).to_netcdf(fp_network, force=True) + + runs = { + "dual/SMO": ("SVMBlock/SVMSCfg.txt", {}), + "dual/MILP": ("SVMBlock/SVMSCfg_grb.txt", {}), + "primal/MILP": ("SVMBlock/SVMSCfg_grb.txt", {"B": "SVMCfg-primal.txt"}), + "chunks/LD": ("SVMBlock/SVMSCfg-LD.txt", {"s": 4}), + "dual/LIBSVM": ("SVMBlock/SVMSCfg-libsvm.txt", {}), + } + + values = {} + for name, (template, kwargs) in runs.items(): + svm = SVMSolver( + fp_network=fp_network, + configfile=str(SMSConfig(template=template)), + **kwargs, + ) + try: + svm.optimize(logging=False) + except ValueError as e: + # a Solver of an optional dependency, e.g., GRBMILPSolver in a + # build of SMS++ without Gurobi, is not in the Solver factory + if "not present in Solver factory" in str(e): + continue + raise + + if name == "dual/LIBSVM" and "Success" not in svm.status: + # LIBSVMSolver is only in the Solver factory when SVMBlock has + # been built with LIBSVM, which is an optional dependency + continue + + assert "Success" in svm.status + values[name] = svm.objective_value + + reference = values["dual/SMO"] + for name, value in values.items(): + assert value == pytest.approx(reference, rel=1e-4), ( + f"the value of the training problem of {name} ({value:.6f}) differs from the " + f"one of dual/SMO ({reference:.6f})" + ) + + +def test_svmsolver_model_selection(force_smspp): + """ + A k-fold cross-validation over a grid of hyper-parameters reports the + score of each point of the grid and the best one. + """ + from pysmspp import SVMSolver + + if not SVMSolver().is_available() and not force_smspp: + pytest.skip("SVMSolver not available in PATH") + + fp_network = get_temp_file("test_svmsolver_model_selection.nc") + build_svm_network("SVCBlock").to_netcdf(fp_network, force=True) + + svm = SVMSolver( + fp_network=fp_network, + configfile=str(SMSConfig(template="SVMBlock/SVMSCfg.txt")), + k=4, + g="C=0.1,1,10", + ) + svm.optimize(logging=False) + + assert "Success" in svm.status + assert len(svm.scores) == 3 + + for point in svm.scores: + assert len(point["scores"]) == 4 # one score per fold + assert set(point["params"]) == {"C"} + + assert svm.best_score == pytest.approx(max(p["score"] for p in svm.scores)) + assert svm.best_params["C"] in (0.1, 1.0, 10.0) + + +def test_svmblock_hyperparameters(force_smspp): + """ + The hyper-parameters reach the solver, i.e., they are scalar variables of + the group and not attributes of it, which SMS++ would silently ignore. + """ + from pysmspp import SVMSolver + + if not SVMSolver().is_available() and not force_smspp: + pytest.skip("SVMSolver not available in PATH") + + configfile = str(SMSConfig(template="SVMBlock/SVMSCfg.txt")) + + def train(**kwargs): + fp_network = get_temp_file("test_svmblock_hyperparameters.nc") + build_svm_network("SVCBlock", **kwargs).to_netcdf(fp_network, force=True) + + svm = SVMSolver(fp_network=fp_network, configfile=configfile) + svm.optimize(logging=False) + + assert "Success" in svm.status + return svm.objective_value + + reference = train(C=1.0) + + # a larger C penalises the training errors more, and a nonlinear kernel, + # a squared loss or a regularised bias are a different problem altogether + assert train(C=10.0) > reference + assert train(C=1.0, Kernel=2, Gamma=0.5) != pytest.approx(reference) + assert train(C=1.0, SquaredLoss=1, RegBias=1) != pytest.approx(reference) + + +def test_svmsolver_trained_model(force_smspp): + """ + The trained model is written to the solution file as a SVMBlockSolution, + i.e., as the multipliers and the bias, and the samples whose multiplier + is nonzero are the support vectors. + """ + from pysmspp import SVMSolver + + if not SVMSolver().is_available() and not force_smspp: + pytest.skip("SVMSolver not available in PATH") + + fp_network = get_temp_file("test_svmsolver_trained_model.nc") + fp_solution = get_temp_file("test_svmsolver_trained_model_sol.nc") + + n_samples = 40 + build_svm_network("SVCBlock", C=10.0).to_netcdf(fp_network, force=True) + + svm = SVMSolver( + fp_network=fp_network, + configfile=str(SMSConfig(template="SVMBlock/SVMSCfg.txt")), + fp_solution=fp_solution, + ) + svm.optimize(logging=False) + + assert "Success" in svm.status + + model = svm.solution.blocks["Solution_0"] + + assert model.attributes["type"].value == "SVMBlockSolution" + + alphas = np.asarray(model.variables["Multipliers"].data) + assert alphas.size == n_samples + assert np.all(alphas >= -1e-9) + assert np.all(alphas <= 10.0 + 1e-9) # the multipliers are bounded by C + + support = np.count_nonzero(alphas) + assert 0 < support < n_samples # some samples support the model, not all + + assert np.isfinite(model.variables["Bias"].data) + + +def test_optimize_sddp(force_smspp): + fp_network = get_network("sddp/SDDPBlock.nc4") + fp_log = get_temp_file("test_optimize_sddp.txt") + configfile = SMSConfig(template="SDDPBlock/SDDPSCfg.txt") + + from pysmspp import SDDPSolver + + sddp_solver = SDDPSolver( + fp_network=fp_network, + fp_log=fp_log, + configfile=str(configfile), + ) + + if sddp_solver.is_available() or force_smspp: + sddp_solver.optimize(logging=True) + + assert "success" in sddp_solver.status.lower() + else: + pytest.skip("SDDPSolver not available in PATH") diff --git a/test/test_smspp_tools.py b/test/test_smspp_tools.py index 3d009e4..53e0b4d 100644 --- a/test/test_smspp_tools.py +++ b/test/test_smspp_tools.py @@ -1,9 +1,10 @@ import sys +from pathlib import Path import numpy as np import pytest -from pysmspp import InvestmentBlockSolver, SMSPPSolverTool, UCBlockSolver +from pysmspp import InvestmentBlockSolver, SDDPSolver, SMSPPSolverTool, UCBlockSolver class FakeSolver(SMSPPSolverTool): @@ -87,3 +88,31 @@ def test_investment_status_is_not_the_value(): assert solver.status_code == 18 assert not solver.is_optimal assert solver.status.startswith("Failed") + + +def test_sddp_lagrangian_recipe_passes_its_block_config(): + """The Lagrangian recipe of the SDDPBlock templates is the pair -B -S: + without -B the tool reads its default SDDPBCfg.txt, i.e., the formulation + of the units for the linear programs, whatever -S says.""" + from pysmspp import SMSConfig + + configfile = SMSConfig(template="SDDPBlock/SDDPSCfg-LD.txt") + training = SDDPSolver( + fp_network="net/SDDPBlock.nc4", + configfile=str(configfile), + B="SDDPBCfg-LD.txt", + ).calculate_executable_call() + simulation = SDDPSolver( + fp_network="net/SDDPBlock.nc4", + configfile=str(configfile).replace("SDDPSCfg-LD", "SDDPSCfg-greedy-LD"), + s=None, + B="SDDPBCfg-LD.txt", + ).calculate_executable_call() + + for command in (training, simulation): + assert command[command.index("-B") + 1] == "SDDPBCfg-LD.txt" + configdir = command[command.index("-c") + 1] + for name in ("SDDPBCfg-LD.txt", command[command.index("-S") + 1]): + assert (Path(configdir) / name).is_file() + assert "-s" in simulation + assert simulation[simulation.index("-S") + 1] == "SDDPSCfg-greedy-LD.txt"