,,,
. . , . . . , , . , .
( CM) . , , , , , , .
.. (1878-1929).
, , , , , , ; , ; . , , , .. . . , . , . , . , - , . , : ( ) , .
- , , , . .
, ++, ; ; , , , .
1
1.1
. , (, , , , , .) . , : , , . .
, , :
;
-;
-.
, , . , - . :
( ).
(-).
( ).
, :
()
1.2
1.2.1 -
40- , . -, - , . . , s , (1). . (. .1) , . , , , . (1), .
.1. S
, . , , .
- , , , . , , , . , . - .
- , , , . , ; . , .
1.2.2
, . , . , , . , , . , .
1.2.3
. . . , m , .
, m . , (, ).
: = , (mod), i- , , m . . , 5, . 32- .
1.2.4
ξ, [,b] :
P(x)=
a b
.2
:
:
=
1.2.5
, , . . , , , , . , rand(), (0,1), , [0,0.5) [0.5, 1]. , , rand(). , , , . rand() , , - , , . 1, , , rand(), , , rand().
, rand() , .
. , [0,1] ( rand()) . g , . . , - , int discrete (float p[]):
unsigned int discrete (float p[])
{
float s, r;
int k=0;
s=p[0]; r=rand();
while (s < r)
{
k++;
s=s+p[k];
}
return k;
}
. , , . 0 -1 , . 100 , p={0.5, 0.5}:
0 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 0 1 1 0 1 1 0 0 0 0 0 1 0 1 0 0 0
1 0 1 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
1 0 1 0 1 1 1 0 0 1 1 0 1 0 1 0 0 1 1 1 1 0 0 0 0 1 0 1 0 0 0 0 1
1.2.6 , (a,b)
. . , , :
,
u (a,b) g , (0,1) u g :
, . , (0,1) , (a,b), (b-a) g (b-a), (0,1) (a,b), a.
:
float uniform (float a, float b) {return rand()*(b-a)+a;}
(a,b).
2
2.1 ( 2)
. n. t . τ1 [τ1min,,τ1max] . τ2 P(τ2). c=aτ2.
, . 10 . , .
:
;
R ;
;
r.
:
n=2;
t=8;
τ1min =1, τ1max =15;
P(τ2) = ( 10 12 13 14 15 16 17 18 19)
( 0,05 0,05 0,05 0,05 0,05 0,2 0,2 0,2 0,15)
( - , - );
=3
τ1max, R r=0. ++.
2.2
:
1. , .. ;
2. .
, , :
1. ;
2. , ;
.
2.3
. N . , . 2.2. ++.
:
- ( .);
RIN - ;
RN - ;
n .
. "#define". RIN RN , , . Trafik , . , , Rand., "#include" . "" ( ). "n" . ton[i]=-1 ton[ ], , ( ). ton[ ] , , , , - "-1".
. , int - -32768 32767 . :
1 . :
1.1. ton[ ] "-1":
" for(i=0;i<N;i++) ton[i]=-1;";
2. :
2.1. : "for(j=0;j<N;j++)" {;
2.1.1 . :
2. 1.1.1. :
"for(i=0;i<N;i++)". t-
ton[i]: if(ton[j]==i),
{,
2.1.1.1.1. (): ton[j]=-1;;
2. 1.1. 2. 2.
: "nPos++";
2. 1.1.3. 2.1.1.1.: "}".
2.1.2. :
2. 1.2.1. :
"j=0; while(ton[j]!=-1) j++;
2. 1.2.2. tin: tin=ceil(RIN)+i;
2.2. 2.1.: "}".
3. :
3.1. .
2.4
. , .2.3., , , ++:
:
i, j- ;
t - ;
tin , ( );
ton [ ] - , ;
Cena ;
r ;
m ;
R-
:
1. :
#include //
#include<iostream.h> // /
#include<math.h> //
#include<conio.h> //
#include<stdlib.h> //
# include <values.h> //
#define // , .
#define RCLIENTS x1[discrete(p1)]
float x1[]={7,8,9,10,11,12,13,14,15};
float p1[]={0.05, 0.05, 0.05, 0.2, 0.2, 0.2, 0.05, 0.05, 0.15};
#define CENA x2[discrete(p2)]
floatx1[]={10,12,13,14,15,16,17,18,19};
floatp1[]={0.05, 0.05, 0.05, 0.05, 0.05, 0.2, 0.2, 0.2, 0.15};
#defineC (125*125*125*125*5) // , .1.3.
#definen 2//
#defineT (8*60*30) // ( .)
2. :
floatrand(void) //
{
static unsigned long int u=C;
// static , u
u=u*C; // -
returnu/float(0xfffffffful); // (0xfffffffful) , .
}
3. :
// , .1.7.
unsigned int discrete( float p[ ])
{
float s, r;
int k=0;
s=p[ ];
r=rand( );
while (s<r)
{
k++;
s+=s+p[k];
}
returnk;
}
4.
unsigned long int i,j,cost, R,r,n,k;
float t, tin;
m=0; k=0; R=0;
5.
tin=RIN;
for(i=0;i<T;i++)
6.
for(j=0;j<N;j++) if(ton[j]==i)
{
m++;
ton[j]=-1;
}
7.
if(i==tin)
{
j=0; while((ton[j]!=-1) && (j<N)) j++;
if(j!=N)
{
i=RCLIENTS;
n++;
for(;t<N;i++)
if(rand1()<=P)
{
cost=cost+a*CENA;
k++;
}
} else r++;
tin=RIN+i;
}
}
8. :
cout<<"........................ Rezultati modelirovaniya ..............................";
cout<<"1.Posetili parikmakherskuy:"<<n<<" chel"<<endl;
cout<<"2.Iz nikh obclujeno : "<<m<<" chel"<<endl;
cout<<"3. Iz nikh ne obclujeno: "<<r<<endl;
cout<<"5Viruchka sostavila: "<<n*cost<<" rub"<<endl;
getch();
}
2.5
, ++, :
3.
2, :
-25 ;
-20;
O -5 ;
13690.
2.6
, 1:
1.
- | |||||
1 | 17 | 13 | 4 | 8398 | |
2 | 25 | 20 | 5 | 13690 | |
3 | 45 | 27 | 18 | 17530 | |
4 | 57 | 33 | 24 | 16890 | |
5 | 64 | 43 | 21 | 26540 | |
6 | 78 | 51 | 27 | 23540 | |
7 | 89 | 63 | 26 | 26540 | |
8 | 110 | 76 | 34 | 31790 | |
9 | 124 | 81 | 43 | 37950 | |
10 | 140 | 97 | 43 | 39890 |
, :
4.
7, .
.5.
, , .
, :
.6.
, , .
.7.
, .
, , ( ) . . .
++, , , . . ++. :
. .
, :
1. , , ;
2. ;
3. , , , .. .
1. .- , , 2008, 51 .
2. . ;
3. ., . . CS 3-, 2004.;
4. .. . - .: , 2000.
5. . .-.: ,1979.-432 .
6. . -.: ,1987.-644.
7. .., .., - . ,2002.
8. .. -.-.,1973.
9. .. .: , 1973
, .
#include<iostream.h>
#include<math.h>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
#define VACANCY (-1)
#define T (200*8*60)
#define RCLIENTS x1[discrete(p1)]
float x1[]={7,8,9,10,11,12,13,14,15};
float p1[]={0.05,0.05,0.05,0.2,0.2,0.2,0.05,0.05,0.15};
#define RCOST x2[discrete(p2)]
float x2[]={10,12,13,14,15,16,17,18,19};
float p2[]={0.05,0.05,0.05,0.05,0.05,0.2,0.2,0.2,0.15};
#define a 3
#define L 10
#define RAND (125*125*125*125*5)
float rand1(void)
{
static unsigned long int u=RAND;
u*=RAND;
return u/(float(0xFFFFFFFF)+1.0);
}
unsigned int discrete(float p[])
void main (void)
{
unsigned long int i,j,cost,k,n,r,R;
float t,tin;
n=0; k=0; R=0;
for(t=RIN;t<T;t+=RIN)
{
i=RCLIENTS;
n+=i;
for(;i<RCLIENTS;i++)
if(rand1()<=P)
{
cost=cost+a*RCOST;
k++;
}
}
cout<<"Posetili parikmaherskuu"<<n<<"chel"<<endl;
cout<<"Iz nih obslugeno "<<k<<"chel"<<endl;
cout<<"Iz nih ne obslugeno"<<r<<"chel"<<endl;
cout<<"Viruchka"<<R<<"rub"<<endl;
cout<<"Srednei dlina ocheredi"<<L<<"chel"<<endl;
}
. . ,
Copyright (c) 2025 Stud-Baza.ru , , , .