PySCIPOpt  5.1.1
Python Interface for the SCIP Optimization Suite
even Namespace Reference

Functions

def parity (number)
 

Variables

list example_values
 
 fmtlen = max([len(fmt) for fmt in pfmt(values, width=1).split('\n')])
 
 n = leval(sys.argv[1])
 
dictionary sdic = {0: "even", 1: "odd"}
 
 values = sys.argv[1:]
 
bool verbose = False
 

Function Documentation

◆ parity()

def even.parity ( number  )
Prints if a value is even/odd/neither per each value in a example list

This example is made for newcomers and motivated by:
- modulus is unsupported for pyscipopt.scip.Variable and int
- variables are non-integer by default
Based on this: #172#issuecomment-394644046

Args:
    number: value which parity is checked

Returns:
    sval: 1 if number is odd, 0 if number is even, -1 if neither

Definition at line 28 of file even.py.

Variable Documentation

◆ example_values

list example_values
Initial value:
1 = [0, 1, 1.5, "hallo welt", 20, 25, -101, -15., -10, -int(2 ** 31), int(2 ** 31 - 1),
2  int(2 ** 63) - 1]

Definition at line 70 of file even.py.

◆ fmtlen

fmtlen = max([len(fmt) for fmt in pfmt(values, width=1).split('\n')])

Definition at line 114 of file even.py.

◆ n

n = leval(sys.argv[1])

Definition at line 74 of file even.py.

◆ sdic

dictionary sdic = {0: "even", 1: "odd"}

Definition at line 25 of file even.py.

◆ values

list values = sys.argv[1:]

Definition at line 109 of file even.py.

◆ verbose

bool verbose = False

Definition at line 24 of file even.py.