Skip to main content

UPI Commands

General

The following list contains commands which are general commands like global solver settings etc.


RequestArgumentsResponse formatDescriptionPossible errors
is_readyn/ais_ready ok!useful for checking if solver is initialized
exitn/an/akills solver's process
set_end_stringstringset_end_string ok!sets the string that should terminate every solver response
reset_end_stringn/areset_end_string ok!clears end string setting
show_versionn/anumber or texthuman-readable program version
show_build_versionn/anumber or textbuild version
show_hand_ordern/aList poker hands. E.g.
“AcAd AdAh AdAs ...”
This command always returns all 1326 hands
in the same order. Other commands return
1326 numbers representing e.g. frequency of
hands in a certain spot in this order.
Format: 1326 hands separated by “ “: “2d2c 2h2c 2h2d …”
show_preflop_ordern/aList of 169 preflop categoriesAs used for calc_eq_preflop
show_settingsn/amany lines with name: value pairssome global solver settings
benchn/aTime taken: floatbuilds a tree about 2.7GB big, runs 6 full
iterations on it; returns running time for those
(but not time taken to build/free the tree).
Shoud take 2s on a good modern CPU.
load_scriptfilenameload_script ok!reads commands from file; line after line and
executes them as if they were inserted on
stdin; after reaching EOF goes back to receiving input from stdin.
WARNING: it's not recommended to run this command from another program. Use load_script_silent or manually execute commands one after another.
load_script_silentfilenameload_script_silent ok!version of load_script that acts as a single command returns only one END string at the end.

The following are the commands related to running / solving the tree.


RequestArgumentsResponse formatDescriptionPossible errors
go[n seconds | steps]go ok!
Solver will emit:
SOLVER: started
once running
optional argument runs solver for n seconds or steps;
if omitted solver will run indefinitely (unless accuracy is set and reached)
Returs immediately (it's a non-blocking operation)
stopn/ago ok!
Solver will emit:
SOLVER: started
once running
stop signal and waits for solver to stop (SOLVER: stopped) and then issues stop ok!
Can take considerable amount of time on large trees.
wait_for_solvern/await_for_solver ok!waits until solver stops before reading rest ofthe commands from stdin. Useful for scripts if one wants to solve multiple trees (or solve and save for example)
take_a_breakinttake_a_break ok!stops the solver (if it’s running) and waits n seconds
before going back to reading the input
solver_timen/aa floatThe time since the current solver instance started in seconds
set_threadsintset_threads ok!sets number of threads used by solver and
all functions requaring tree traversal
(like show_range, calc_ev etc.)
set_info_freqintset_info_freq ok!sets how often solver info is released (defeault is every 25 steps)
set_accuracyfloat [chips | fraction]set_accuracy ok!accuracy at which solver stops. default is 0 (never).
If optional argument is provided the value is treated either asabsolute value (chips) or fraction of the pot (fraction). “chips” is the default.
set_recalc_accuracyfloat float floatset_recalc_accuracy ok!sets accuracy for flop/turn/river recalculations
(which occur when calling solve_partial or
browsing incomplete tree or
browsing a tree with auto_recalc on.
set_always_recalcstreet timeoutset_always_recalc ok!Enables automatic recalculation of nodes.
First argument is street (3 for Flop etc., 4 Turn, 5 River).
The second argument is timeout in miliseconds.
If street is set to 0 then the feature is disabled.
When the feature is enabled then solver will always recalculate specified streets
to recalc_accuracy or specified time limit (whichever is reached first)
Example: set_always_recalc 4 5000 will always recalculate turn branches when visiting turn / river nodes.
set_isomorphismint intset_isomorphism ok!1st argument ­ isomorhism on/off for flop trees
2nd argument ­ isomorphism on/off for turn trees
the default is on on the flop off on the turn
change_stepfloatchange_step ok!Change solving step parameter (the higher the more aggresive changes solver will make).
show_stepn/afloatreturns current value of step parameter.
show_itersn/aintshows the number of solving iterations performed on the current tree.
set_first_iteration_playerOOP | IPset_first_iteration_player ok!Setting determines during a full iteration if OOP or IP does strategy adjustment first.

Commands related to building the tree.

Building a postflop tree consists of

  • setting global state first (range, stacks, board)
  • adding betting lines
  • executing build_tree command

Building a preflop tree consists of

  • setting global state first (ranges, stacks)
  • adding preflop betting lines
  • building pure preflop tree
  • setting postflop trees and adding them to postflop exits
  • specifying flops subset
  • building full preflop tree by executing add_all_flops command

Postflop tree building


RequestArgumentsResponse formatDescriptionPossible errors
set_rangeOOPIP 1326 floatsset_range ok!sets range for IP/OOP in global state
set_eff_stackintSet_eff_stack ok!Sets effective stack in a global state. This is used in tree building to recognize which nodes are all­in nodes and which aren’t.
set_boardcards (e.g. AcKdJc)set_board ok!sets board in a global state
set_potint int intset_pot ok!Sets starting pot (oop, ip, dead)
add_lineseries of numbers representing bet sizes (cumulative)add_line ok!0 30 30 30 90 represents
a check OOP, bet IP, a call, a check on the turn and a bet of 60 (90 total invested).
See more examples in sample scripts.
remove_lineseries of numbers representing a line to removeremove_line ok!remove_line uses the same syntax as add_line. It’s possible to remove calls and folds as well:
0 30 0 removes a fold for OOP player in response to c­bet
force_lineseries of numbers representing bet sizesforce_line ok!removes all the lines which don’t lead to the one being forced (so any line of which forced line isn’t a prefix of)
clear_linesn/aclear_lines ok!resets the state created by add_line, remove_line and force_line
build_tree[mem_pessimistic | mem_ignore]build_tree ok!build a tree based on a config created by global state and calling add_line and remove_line.
Optional argument specifies the behavior in context of memory estimation.
mem_ignore - no memory check should be performed
default (no argument) - The tree will only be build if there is enough free memory to build it.
mem_pessimistic - The tree will only be build if there is enough free memory to build a tree on an unpairded rainbow board.

Preflop tree building


RequestArgumentsResponse formatDescriptionPossible errors
add_preflop_lineSeries of numbers representing bet sizes (cumulative)Add_preflop_line ok!Identical as add_line but builds a pure preflop tree (one street)
remove_preflop_lineSeries of numbers representing a line to removeremove_preflop_line ok!Same as remove_line but for preflop
clear_preflop_linesn/aClear_preflop_lines ok!Clears preflop tree structure created by add_preflop_line
build_preflop_treen/aBuild_preflop_tree ok!Builds a pure preflop tree using a descriptioin as defined by add_preflop_line’s commands.
add_to_subsetfloat card card cardAdd_to_subset ok!Adds a specified board with specified weight to a flop subset.
That subset can be then used to build a full preflop tree with selected flops
reset_subsetn/aReset_subset ok!Clears the current flop subset
show_subsetn/a(multiline)
weight1 board1
weight2 board2
….
Prints current flops with weights from the flop subset.
recover_subsetn/arecover_subset ok!if preflop tree is loaded then it replaces current flop subset with the subset from this tree.
add_schematic_treenodeIDadd_schematic_tree ok!Attaches a postflop abstraction to a chosen preflop exit. NodeID must point to a SPLIT_NODE which is a valid preflop exit.Current schematic tree (one created by add_line commands) is attached.
The way to use this command is to build a postflop tree with add_line commands,attach it to a chosen preflop exit; reset it, build another postflop tree,attach it to another preflop exit etc.
add_all_flopsn/aadd_all_flops ok!Uses flops in a current flop subset to build a full preflop tree.

Additional tree building settings


RequestArgumentsResponse formatDescriptionPossible errors
list_algorithmsn/an lines with 3 comma separated values
code, name, description
example line:
original_pio,Original PioSolver,Original PioSolver algorithm that uses less memory
set_algorithmalgorithm_codeset_algorithm ok!Sets one of the available algorithms.
Algorithm is a property of a tree. It's decided at the moment of building a tree(not solving) and can't be changed afterwards.
Possible values: auto, pio_cfr, original_pio
ignore_mem_checkon | offignore_mem_check ok!if set to "on" then the memory check will not be performed before building a tree.
small_stratson | offsmall_strats ok!The setting controls if float32 or float16 should be used to hold strategies.
Possible values:
on: use float16
off: use float32
auto: use float16 for preflop trees and float 32 for other.
estimate_treen/ahuman readable estimateEstiamtes preflop tree with current subset
estimate_schematic_treen/ahuman readable estimateEstiamtes postflop tree with different algorithms
show_memoryn/aTotal Physical Memory: 65214 MB
Available Phys Memory: 45093 MB
information about available memory in the system

Traversing the tree / strategies / etc


RequestArgumentsResponse formatDescriptionPossible errors
is_tree_presentn/atrue | falsereturns true if a tree the solver is operating on exists
show_nodenodeID(multiline)
nodeID
NODE_TYPE
board
pot
children_no
flags: f1 … f2
the number of flags can vary from 0 to 64
they are separated by space
show_childrennodeID(multiline)
child 0:
….
…..
child 1:
….
are in the same format as show_node
show_effective_stackn\aintshows the effective starting stack of the current tree
show_rangeOOP | IP [nodeID]1326 floatsrange in given node
dead hands have weight 0.If only one argument is given then IP/OOPrange from solver state is shown (the one set by set_range)
show_strategynodeID(multiline)
1326 floats
1326 floats
….
n'th line represents frequency of n’th action with i’th hand
Error if nodeID doesn’t represent decision node
show_strategy_ppnodeIDhuman readable sorted (by equity vs ALL) outputError if nodeID doesn’t represent decision node
calc_evOOP | IP nodeID(2 lines)
1326 floats
1326 floats
EV of a given player in a given node for all hands. Numbers in the first line are EV, in the second are matchups.
calc_ev_ppOOP | IP nodeIDwins / matchups in human readable formatEV of a given player in a given node for all hands. Numbers in the first line are EV, in the second are matchups.
calc_eqOOP | IP(2 lines)
1326 floats
1326 floats
eq in the first line, matchups in 2nd
board/ranges taken from solver state (set_range, set_board to set)
calc_eq_ppOOP | IPin human readable form
calc_eq_nodeOOP | IP nodeID(3 lines)
1326 floats
1326 floats
1 float
calculate equity for given player assuming ranges in given node
Output format:
1st line: equities
2nd line: matchups
3rd line: total
calc_eq_preflopOOP | IP( 3lines)
169 floats
169 floats
1 float
Calculates preflop equity from IP/OOP range as set by set_range command.
It assumes weights for isomorphic (7s6s = 7h6h) combos is the same.
The results are unpredictable/incorrect if that’s not the case.
Output format:
1st line: equities
2nd line: matchups
3rd line: total
calc_resultsn/a(multiline)
running time: float
EV OOP: float
EV IP: float
OOP’s MES: float
IP’s MES: float
exploitable for: float
calculates EV’s/MES’es in root and prints the whole info
calc_matchups_linenodeIDfloatThe total number of matchups in given line. (can be used to calculate relative probability of different lines)
calc_line_freqnodeIDfloatAbsolute probabality of reaching certain line.
calc_global_freqnodeIDfloatAbsolute probabality of reaching certain node (assuming the node's runout has been selected).
show_all_linesn/a(multiline)
All lines
Lists all lines in the tree.
show_all_freqsglobal | local [pp](multiline)
All lines with corresponsing frequencies
Lists all lines in the tree with corresponding frequncies either local (probability of takinglast action) or global (probability of this line being played); optional argument pp (prettyprint) makes the output easier to read for a human
show_win_evsIP | OOP nodeId3 numbersThis command can be used to see the ICM structure of a tree.
NodeID must denote a final node (either fold, allin or last node on the River)
The result numbers tell what will be the EV of a given player in this node in case he wins / loss / tie.
For non-ICM trees the OOP and IP values are always the same.
For fold nodes three numbers are always identical.
Example values wihtout ICM:
show_win_evs OOP r:0:b99:b200:c
380 -200 90
show_win_evs IP r:0:b99:b200:c
380 -200 90
Example values from the same tree after adding some ICM structure:
show_win_evs OOP r:0:b99:b200:c
29.2733116 -20.3105125 7.67309189
show_win_evs IP r:0:b99:b200:c
32.3092041 -25.1925144 8.78540993

Tree Information


RequestArgumentsResponse formatDescriptionPossible errors
add_info_linetextadd_info_line ok!adds a line to tree information.
reset_tree_infon/areset_tree_info ok!clears tree information.
show_tree_infon/a(multiline)shows all lines either added by add_info_line or loaded from the tree.

Operating on small / partial trees


RequestArgumentsResponse formatDescriptionPossible errors
rebuild_forgotten_streetsn/arebuild_forgotten_streets ok!rebuilds all turns/rivers if this is a small tree. It's possible to resume solving after that
estimate_rebuild_forgotten_streetsn/aOne line e.g:
Rebuild tree. Memory needed: 50519 MB; available: 47930 MB
Memory needed to rebuild current tree and available memory.
solve_partialnodeIDsolve_partial ok!solve a tree from given node to accuracy set by set_accuracy
solve_all_splitsturns | riverssolve_all_splits ok!solve all parts of the tree from either turn or river (e.g. after rebuilding forgotten streets of a small save). Solves to accuracy set by set_recalc_accuracy(it may take a long time)
explo_partialnodeIDfloatreturns exploitability for a subtree strating from given node

Additional commands


RequestArgumentsResponse formatDescriptionPossible errors
stdoutredifilename-­ redirects stdout to file
stdoutredi_appendfilename­-redirects stdout to file but appends it instead of overwriting
stdoutbackn/astdoutback ok!standard output back to console (might be useful when using text interface, not for GUI)
print_all_stratsn/amany lines - each line has either nodeID or 1326 numbersprints nodeID for all nodes in the tree and additionaly strategies for decision nodes.
node_countn/amany lines counting different types of nodes e.g.
H_DEC: 339
FLOP 0
TURN 3
RIVER 336
for each type of node (H_DEC, V_DEC, SPLIT, END, ROOT) prints how many nodes of this kind are in the tree on each street.
clear_cachen/aclear_cache ok!clears cached results in the tree
show_cpu_infon/ae.g. number of CPUs: 16
max threads: 16
thread limit is: 2147483647
affinity policy is: 0
Some information about CPU
show_nutsOOP | IP boardone line per live hand
hand - number
show how many combos in villain range are winning against given hadn (0 for nuts)

Range Explorer


RequestArgumentsResponse formatDescriptionPossible errors
show_category_namesn\a2 lines:
hand strength categories
draw categories
Shows names of hand/draws categories which are then used for range analysis. E.g.
nothing king_high ace_high (...) top_fullhouse quads straight_flush
no_draw 4out_straight_draw 8out_straight_draw flush_draw combo_draw
show_categoriesboard2 lines:
1326 ints
1326 ints
In the first line the are made hand category assignments for each combo and in the second line are draw category assignments for each combo.
Number 0 in the first line denotes nothing, number 1 denotes king_high etc. In the second line number 0 denotes no_draw, etc.
show_catsboard6 lines: 1326 ints each1st line: hand eval (the higher number the stronger made hand)
2nd line: category (as in 1st line of show_categories)
3rd line: total number of draw outs
4th line: number str8 draw outs
5th line: number of flush draw outs
6th line: number of fullhouse draw outs
show_cats_ppboardmany linessame as show_cats but in human readable format
echosome textsome textprints back the first argument
repeatint some textsome text
some text
prints back some text specified number of times (can be useful to test i/o throughput)

Displayed suits change


RequestArgumentsResponse formatDescription
set_display_iso[sh sd sc hd hc dc]set_display_iso ok!swaps the colors of suits in the tree for presentation purposes.
reset_display_ison/areset_display_iso ok!removes the swap and sets back the original board
show_board_no_ison/aBoard (e.g. Qs Js 2h)shows the original board set in the tree

After applying set_display_iso the solver will act effectively as if the original board has been swapped into a new one so all commands that output ranges like calc_ev, and take ranges as an input like set_strategy etc. are affected.

set_display_iso also applies the specified swap sequence on the original board (so the client should call first 'show_board_no_iso' to be sure what is the correct sequence to reach desired board isomorphism)

Alternative EV models

The EV in a tree can be adjusted either with set_rake or set_icm command. It's not possible to use both at the same time.


RequestArgumentsResponse formatDescriptionPossible errors
set_rakefloat intset_range ok!Sets rake in the tree. First argument is fraction of the final pot that is taken as a rake.Second argument is maximum rake taken. E.g. The following command sets 5% rake up to 10 chips
set_rake 0.05 10
To turn off rake set_rake 0 0
set_icm_pointOOP | IP int floatset_icm_point ok!Sets ICM point for a given player.
For a given final stack size in chips it sets the ICM value of this stack.
The final stacks in chips should be stacks from ICM structure set with set_icm (one player can have higher starting stack than effective stack).
reset_icm_tablesn/areset_icm_tables ok!clears all set icm points
set_icmint intset_icm ok!numbers are player's stacks (OOP and IP). Smaller of these two numbers should be equal to effective stack.

Setting strategies and node locking


RequestArgumentsResponse formatDescriptionPossible errors
eliminate_pathnodeIDeliminate_path ok!Sets strategy to 0 for this action in specified line across all runouts.
lock_nodenodeIDlock_node ok!Locks the strategy in given node for all hands.
unlock_nodenodeIDunlock_node ok!Unlocks the strategy in a given node.
combo_lock_nodenodeID 1236 intscombo_lock_node ok!Locks the strategy in a given node for specified combos.Range argument should have 1 for hands that are meant to be locked and 0 for hands that are not supposed to be locked.
show_locked_combosnodeID1326 numbers1 for locked hands 0 for not locked
set_strategynodeID N x 1326 floatsset_strategy ok!Sets strategy in a given node.
i-th out of N group of 1326 floats denotes strategy for the i-th child of a node (in the order returned by show_children).
The numnbers for each combo should add to 1. If they don't the solver will adjust them so that they do.
set_equal_stratsn/aset_equal_strats ok!sets equal strategies in the whole tree.
set_mesOOP | IPset_mes ok!sets most explotive strategy for a player in the whole tree.
round_up_toOOP | IP int streetround_up_to ok!E.g. round_up_to IP 5 flop
Will round all strategies of an IP player in the tree on the flop to multiples of 1/5.
round_up_to OOP 2 river
Will round all strategies of an OOP player.

Player profile modeling via incentives


RequestArgumentsResponse formatDescription
set_incentives_nodenodeID N floatsset_incentives_node ok!Sets EV incentives for N child actions in a specified node.
set_incentives_linenodeID N floatsset_incentives_line ok!Sets EV incentives for N child actions in a specified node and all other nodes on the same betting lines, but different runouts.
show_incentivesnodeIDN floatsShows incentives in a specified node.
clear_incentivesnodeIDclear_incentives ok!Clears incentives in a specified node.

Scripting


RequestArgumentsResponse formatDescriptionPossible errors
skip_if_donefilename labelskip_if_done ok!checks if a filename exists if yes, skips all the lines in the script until label is encountered
LABEL:labelnamenonelabels a place in the script; this is used by skip_if_done command above(remember to include a space after a colon and before the label name)

Save / load / read files


RequestArgumentsResponse formatDescriptionPossible errors
load_treefilename [full | fast | auto (default)]load_tree ok!Loads the tree from the content of the save file into memory.
State.root points to this tree
i/o errors, file format error, out of memory
dump_treeFilename [full | no_turns | no_rivers ]dump_tree ok!saves current tree to disc; if optional argument is provided (no_turns or no_rivers)a small save will be made while the whole tree is preserved in memory.
free_treen/afree_tree ok!deletes current tree and frees the memory.
show_metadatafilename(multiline) shows metadata about the specified save fileWithout loading a tree it prints information ontains information from following commands:
show_node r
show_effective_stack
show_range OOP r
show_range IP r
show_tree_info
show_save_versionfilenameone linetells if the save is a piosolver tree file and shows internal version number of save file.
load_all_nodesn/aload_all_nodes ok!loads all remaining data of a tree loaded with "fast" option

Different options of dumping / loading the tree

There are many ways to dump / load tree and depending if the tree is dumped as full or without later streets or if it's fully loaded or fast loaded different capabilities of solver are affected. The way to check the mode in which the tree was loaded is to check the node flags on the r node.

See this example:

r
ROOT
Qs Jh 2h
0 0 180
1 children
flags: INCOMPLETE_TREE PIO_CFR FAST_LOAD

Here the flag INCOMPLETE_TREE indicates that the tree is either without rivers or without turns. FAST_LOAD flag indicates that the tree has been fast loaded. Fast load keeps the save file open and reads part of the file when they are needed on the fly.

Activating / deactivating licence


RequestArgumentsResponse formatDescriptionPossible errors
deactivatefilename labelDeactivation successful!Deactivates licence and exits solver.

If the program is not activated then the PioSolver will print only one line requesting user to provide a key.

Enter your activation key:

If the activation is successful the solver will print

ERROR code 0:
OK!
Activation ok!

and start normally.