Because of constant changes on product market production companies have to quickly adapt so that they stay relevant and continue operate profitably. One of solutions is flexible manufacturing, which allows fast reaction on such changes, with possibility of producing completely different products on same production line at the same time also called mixed production model. With this concept a new problem arises, how to choose appropriate order of products so that throughput time is short as possible. Solution to this problem is constructing digital twin and using digital agents. Main issue is choosing right simulation software according to our needs and implementation of an algorithm. In master's thesis we focused on this issue. For our subject of analysis hybrid production system Demonstration center smart factory was chosen, for which we implemented off-line digital twin in simulation tool Visual Components. Digital twin simulates order optimization and offers best possible solution. Algorithm is implemented as additional element in digital twin itself that generates different scenarios of an order, simulates, analyzes, compares them and lastly writes results.