Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Matematika-11

import numpy as n

G1=[0,2.3,4.5,6.,8.7,9.5]
G2=[0.,1.9,3.8,5.,6.8,8.]
G3=[0,4,5,5.4,7.2,9]

print 'Pripustimo sho vsi resursi v tretyogo pidpriemstva'

for ii in range(6):
    print 'delta3=',ii,'C3=',G3[ii]
    
print 'Viberemo optimalniy rozpodil mizh 2 i 3'
D23={}
AUX23={}
for ii in range(6):
    D23[ii]=[]
    for jj in range(ii+1):
        for kk in range(ii+1):
            if jj+kk==ii:
                D23[ii].append(G2[jj]+G3[kk])
                AUX23[G2[jj]+G3[kk]]=str(jj)+' '+str(kk)
OPT23=[]
for ii in range(6):
    print 'delta23=',ii,'C23=',max(D23[ii])
    OPT23.append(max(D23[ii]))

print 'Viberemo optimalniy rozpodil mizh pershim i inshimi...'

D={}
AUX={}
for ii in range(6):
    D[ii]=[]
    for jj in range(ii+1):
        for kk in range(ii+1):
            if jj+kk==ii:
                D[ii].append(G1[jj]+OPT23[kk])
                AUX[G1[jj]+OPT23[kk]]=str(jj)+' '+str(kk)           

ch1= AUX[max(D[5])].split()[0]
OPTIMUM=max(D[5])
print 'maximalniy pributok= ',OPTIMUM
print 'pershe pidpriyemstvo otrimalo ',ch1

ch23= AUX23[OPTIMUM-G1[int(ch1)]]
print 'druge pidpriyemstvo otrimalo', ch23.split()[0]
print 'tretye pidpriyemstvo otrimalo', ch23.split()[1]

PEREVIRKA=0.
print "perevirimo pereborom usih variantiv..."
for ii in range(6):
    for jj in range(6):
        for kk in range(6):
            if (ii+jj+kk)==5:
                temp=G1[ii]+G2[jj]+G3[kk]
                if temp>PEREVIRKA:
                    PEREVIRKA=temp
                    print 'nove maksimalne znachennya=',temp,ii,jj,kk

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.